@tacdaed/fragments 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/ng-package.json +20 -0
- package/package.json +22 -29
- package/src/lib/components/accordion/accordion.component.html +103 -0
- package/src/lib/components/accordion/accordion.component.scss +382 -0
- package/src/lib/components/accordion/accordion.component.spec.ts +147 -0
- package/src/lib/components/accordion/accordion.component.ts +211 -0
- package/src/lib/components/accordion/accordion.type.ts +82 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +43 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +112 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +33 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +103 -0
- package/src/lib/components/breadcrumb/breadcrumb.interface.ts +7 -0
- package/src/lib/components/button/button.component.html +57 -0
- package/src/lib/components/button/button.component.scss +445 -0
- package/src/lib/components/button/button.component.spec.ts +99 -0
- package/src/lib/components/button/button.component.ts +143 -0
- package/src/lib/components/button/button.type.ts +7 -0
- package/src/lib/components/card/card.component.html +44 -0
- package/src/lib/components/card/card.component.scss +114 -0
- package/src/lib/components/card/card.component.spec.ts +65 -0
- package/src/lib/components/card/card.component.ts +21 -0
- package/src/lib/components/card/card.type.ts +3 -0
- package/src/lib/components/code-block/code-block.component.html +55 -0
- package/src/lib/components/code-block/code-block.component.scss +122 -0
- package/src/lib/components/code-block/code-block.component.spec.ts +81 -0
- package/src/lib/components/code-block/code-block.component.ts +302 -0
- package/src/lib/components/code-block/code-block.interface.ts +28 -0
- package/src/lib/components/code-block/code-block.type.ts +73 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +14 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +20 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +38 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +181 -0
- package/src/lib/components/input/input-base.ts +187 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.html +76 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.scss +179 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +44 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.ts +299 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.html +37 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +128 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +43 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +112 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +43 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +140 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +62 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +136 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +81 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +228 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +62 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +178 -0
- package/src/lib/components/input/input-consts.ts +132 -0
- package/src/lib/components/input/input-date/input-date-validators.ts +41 -0
- package/src/lib/components/input/input-date/input-date.component.html +41 -0
- package/src/lib/components/input/input-date/input-date.component.scss +95 -0
- package/src/lib/components/input/input-date/input-date.component.spec.ts +43 -0
- package/src/lib/components/input/input-date/input-date.component.ts +359 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.html +70 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.scss +133 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +36 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.ts +387 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.html +89 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +171 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +43 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +351 -0
- package/src/lib/components/input/input-interface.ts +8 -0
- package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
- package/src/lib/components/input/input-number/input-number.component.html +51 -0
- package/src/lib/components/input/input-number/input-number.component.scss +140 -0
- package/src/lib/components/input/input-number/input-number.component.spec.ts +44 -0
- package/src/lib/components/input/input-number/input-number.component.ts +343 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.html +44 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +139 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +58 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +132 -0
- package/src/lib/components/input/input-slider/input-slider.component.html +111 -0
- package/src/lib/components/input/input-slider/input-slider.component.scss +203 -0
- package/src/lib/components/input/input-slider/input-slider.component.spec.ts +46 -0
- package/src/lib/components/input/input-slider/input-slider.component.ts +410 -0
- package/src/lib/components/input/input-text/input-text-validators.ts +67 -0
- package/src/lib/components/input/input-text/input-text.component.html +71 -0
- package/src/lib/components/input/input-text/input-text.component.scss +118 -0
- package/src/lib/components/input/input-text/input-text.component.spec.ts +55 -0
- package/src/lib/components/input/input-text/input-text.component.ts +215 -0
- package/src/lib/components/input/input-time/input-time-validators.ts +42 -0
- package/src/lib/components/input/input-time/input-time.component.html +92 -0
- package/src/lib/components/input/input-time/input-time.component.scss +191 -0
- package/src/lib/components/input/input-time/input-time.component.spec.ts +39 -0
- package/src/lib/components/input/input-time/input-time.component.ts +691 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +36 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +121 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +54 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +117 -0
- package/src/lib/components/input/input-type.ts +18 -0
- package/src/lib/components/input/input-validation/input-validation.component.html +19 -0
- package/src/lib/components/input/input-validation/input-validation.component.scss +39 -0
- package/src/lib/components/input/input-validation/input-validation.component.spec.ts +45 -0
- package/src/lib/components/input/input-validation/input-validation.component.ts +13 -0
- package/src/lib/components/input/input.pipe.ts +14 -0
- package/src/lib/components/layout/container/container.component.html +1 -0
- package/src/lib/components/layout/container/container.component.scss +33 -0
- package/src/lib/components/layout/container/container.component.ts +32 -0
- package/src/lib/components/layout/container/container.type.ts +1 -0
- package/src/lib/components/layout/divider/divider.component.html +1 -0
- package/src/lib/components/layout/divider/divider.component.scss +60 -0
- package/src/lib/components/layout/divider/divider.component.ts +38 -0
- package/src/lib/components/layout/divider/divider.type.ts +2 -0
- package/src/lib/components/layout/section/section.component.html +21 -0
- package/src/lib/components/layout/section/section.component.scss +43 -0
- package/src/lib/components/layout/section/section.component.ts +33 -0
- package/src/lib/components/layout/section/section.type.ts +2 -0
- package/src/lib/components/layout/separator/separator.component.html +9 -0
- package/src/lib/components/layout/separator/separator.component.scss +52 -0
- package/src/lib/components/layout/separator/separator.component.ts +25 -0
- package/src/lib/components/layout/separator/separator.type.ts +1 -0
- package/src/lib/components/loader/content-blur/content-blur.component.html +13 -0
- package/src/lib/components/loader/content-blur/content-blur.component.scss +43 -0
- package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +42 -0
- package/src/lib/components/loader/content-blur/content-blur.component.ts +34 -0
- package/src/lib/components/loader/loader.type.ts +2 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.html +26 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.scss +151 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +47 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.ts +28 -0
- package/src/lib/components/loader/progress-bar/progress-bar.type.ts +8 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +12 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +202 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +55 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +73 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +6 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +13 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +113 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +37 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +51 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +6 -0
- package/src/lib/components/loader/spinner/spinner.component.html +20 -0
- package/src/lib/components/loader/spinner/spinner.component.scss +137 -0
- package/src/lib/components/loader/spinner/spinner.component.spec.ts +43 -0
- package/src/lib/components/loader/spinner/spinner.component.ts +32 -0
- package/src/lib/components/loader/spinner/spinner.type.ts +6 -0
- package/src/lib/components/modal/modal.component.html +47 -0
- package/src/lib/components/modal/modal.component.scss +139 -0
- package/src/lib/components/modal/modal.component.spec.ts +60 -0
- package/src/lib/components/modal/modal.component.ts +83 -0
- package/src/lib/components/modal/modal.type.ts +9 -0
- package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +79 -0
- package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +96 -0
- package/src/lib/components/morph/blob-moph/blob-morph.component.html +34 -0
- package/src/lib/components/morph/blob-moph/blob-morph.component.scss +7 -0
- package/src/lib/components/morph/morph.abstract.ts +13 -0
- package/src/lib/components/pagination/pagination.interface.ts +4 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.html +61 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +187 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +88 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +177 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.html +170 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +312 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +61 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +372 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.html +125 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +267 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +66 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +315 -0
- package/src/lib/components/selection-lists/selection-lists-base.ts +35 -0
- package/src/lib/components/selection-lists/selection-lists-const.ts +17 -0
- package/src/lib/components/selection-lists/selection-lists-interface.ts +7 -0
- package/src/lib/components/selection-lists/selection-lists.type.ts +1 -0
- package/src/lib/components/side-nav/side-nav.component.html +101 -0
- package/src/lib/components/side-nav/side-nav.component.scss +295 -0
- package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
- package/src/lib/components/side-nav/side-nav.component.ts +18 -0
- package/src/lib/components/side-nav/side-nav.type.ts +28 -0
- package/src/lib/components/snackbar/snackbar.component.html +33 -0
- package/src/lib/components/snackbar/snackbar.component.scss +195 -0
- package/src/lib/components/snackbar/snackbar.component.ts +112 -0
- package/src/lib/components/snackbar/snackbar.type.ts +27 -0
- package/src/lib/components/status/chip/chip.component.html +51 -0
- package/src/lib/components/status/chip/chip.component.scss +149 -0
- package/src/lib/components/status/chip/chip.component.spec.ts +62 -0
- package/src/lib/components/status/chip/chip.component.ts +83 -0
- package/src/lib/components/status/chip/chip.type.ts +42 -0
- package/src/lib/components/status/directives/badge/badge.directive.spec.ts +60 -0
- package/src/lib/components/status/directives/badge/badge.directive.ts +190 -0
- package/src/lib/components/status/directives/badge/badge.interface.ts +19 -0
- package/src/lib/components/status/pill/pill.component.html +40 -0
- package/src/lib/components/status/pill/pill.component.scss +113 -0
- package/src/lib/components/status/pill/pill.component.spec.ts +47 -0
- package/src/lib/components/status/pill/pill.component.ts +83 -0
- package/src/lib/components/status/pill/pill.type.ts +42 -0
- package/src/lib/components/status/status.interface.ts +57 -0
- package/src/lib/components/status/status.type.ts +62 -0
- package/src/lib/components/status/tag/tag.component.html +39 -0
- package/src/lib/components/status/tag/tag.component.scss +140 -0
- package/src/lib/components/status/tag/tag.component.spec.ts +47 -0
- package/src/lib/components/status/tag/tag.component.ts +83 -0
- package/src/lib/components/status/tag/tag.type.ts +42 -0
- package/src/lib/components/stepper/stepper.component.html +83 -0
- package/src/lib/components/stepper/stepper.component.scss +196 -0
- package/src/lib/components/stepper/stepper.component.ts +482 -0
- package/src/lib/components/stepper/stepper.type.ts +60 -0
- package/src/lib/components/table/table.component.html +438 -0
- package/src/lib/components/table/table.component.scss +259 -0
- package/src/lib/components/table/table.component.spec.ts +117 -0
- package/src/lib/components/table/table.component.ts +215 -0
- package/src/lib/components/table/table.enum.ts +4 -0
- package/src/lib/components/table/table.function.ts +47 -0
- package/src/lib/components/table/table.interface.ts +143 -0
- package/src/lib/components/table/table.pipe.ts +62 -0
- package/src/lib/components/table/table.type.ts +15 -0
- package/src/lib/components/tabs/tabs.component.html +88 -0
- package/src/lib/components/tabs/tabs.component.scss +305 -0
- package/src/lib/components/tabs/tabs.component.spec.ts +94 -0
- package/src/lib/components/tabs/tabs.component.ts +282 -0
- package/src/lib/components/tabs/tabs.type.ts +81 -0
- package/src/lib/components/title-bar/title-bar.component.html +21 -0
- package/src/lib/components/title-bar/title-bar.component.scss +139 -0
- package/src/lib/components/title-bar/title-bar.component.spec.ts +44 -0
- package/src/lib/components/title-bar/title-bar.component.ts +13 -0
- package/src/lib/components/toast/toast.component.html +36 -0
- package/src/lib/components/toast/toast.component.scss +241 -0
- package/src/lib/components/toast/toast.component.ts +165 -0
- package/src/lib/components/toast/toast.type.ts +37 -0
- package/src/lib/components/toast-stack/toast-stack.component.html +30 -0
- package/src/lib/components/toast-stack/toast-stack.component.scss +35 -0
- package/src/lib/components/toast-stack/toast-stack.component.ts +51 -0
- package/src/lib/consts/country-prefix.ts +244 -0
- package/src/lib/directives/tooltip/popover.directive.ts +274 -0
- package/src/lib/directives/tooltip/tooltip.directive.spec.ts +86 -0
- package/src/lib/directives/tooltip/tooltip.directive.ts +234 -0
- package/src/lib/directives/tooltip/tooltip.interface.ts +29 -0
- package/src/lib/directives/tooltip/tooltip.type.ts +9 -0
- package/src/lib/interfaces/common.interfaces.ts +4 -0
- package/src/lib/pipes/chunk.pipe.ts +16 -0
- package/src/lib/pipes/safe-html.pipe.ts +14 -0
- package/src/lib/pipes/sanitize-html.pipe.ts +23 -0
- package/src/lib/types/base.types.ts +23 -0
- package/src/lib/types/common.types.ts +98 -0
- package/src/lib/types/form.types.ts +5 -0
- package/src/lib/utils/common.utils.ts +53 -0
- package/src/lib/utils/date.utils.ts +474 -0
- package/src/lib/utils/number.utils.ts +16 -0
- package/src/lib/utils/uuid.utils.ts +39 -0
- package/src/public-api.ts +114 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +9 -0
- package/fesm2022/tacdaed-fragments.mjs +0 -8928
- package/fesm2022/tacdaed-fragments.mjs.map +0 -1
- package/index.d.ts +0 -3929
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
+
import { RouterLink, RouterLinkActive } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
import { TButtonIconPosition, TButtonShape, TButtonSize, TButtonStyle, TButtonType } from './button.type';
|
|
6
|
+
import { TBaseStyle } from '../../types/base.types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Button component for displaying a button with various styles and behaviors
|
|
10
|
+
*/
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'frg-button',
|
|
13
|
+
imports: [NgClass, RouterLink, RouterLinkActive],
|
|
14
|
+
templateUrl: './button.component.html',
|
|
15
|
+
styleUrl: './button.component.scss'
|
|
16
|
+
})
|
|
17
|
+
export class ButtonComponent {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for the button
|
|
20
|
+
*/
|
|
21
|
+
@Input() id: string = '';
|
|
22
|
+
/**
|
|
23
|
+
* CSS classes applied to the button element
|
|
24
|
+
*/
|
|
25
|
+
@Input() class: string = '';
|
|
26
|
+
/**
|
|
27
|
+
* CSS classes for the text span
|
|
28
|
+
*/
|
|
29
|
+
@Input() textClass: string = '';
|
|
30
|
+
/**
|
|
31
|
+
* CSS classes for the icon element
|
|
32
|
+
*/
|
|
33
|
+
@Input() iconClass: string = '';
|
|
34
|
+
/**
|
|
35
|
+
* Optional style token for icon color
|
|
36
|
+
*/
|
|
37
|
+
@Input() iconStyleType: TBaseStyle | undefined = undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Position of the icon relative to the text
|
|
40
|
+
* @see TButtonIconPosition
|
|
41
|
+
*/
|
|
42
|
+
@Input() iconPosition: TButtonIconPosition = 'left';
|
|
43
|
+
/**
|
|
44
|
+
* Type of the button
|
|
45
|
+
* @see TButtonType
|
|
46
|
+
*/
|
|
47
|
+
@Input() type: TButtonType = 'button';
|
|
48
|
+
/**
|
|
49
|
+
* Size of the button
|
|
50
|
+
* @see TButtonSize
|
|
51
|
+
*/
|
|
52
|
+
@Input() size: TButtonSize = 'medium';
|
|
53
|
+
/**
|
|
54
|
+
* Router link for navigation
|
|
55
|
+
*/
|
|
56
|
+
@Input() buttonRouterLink: string | (string | number)[] | null | undefined = null;
|
|
57
|
+
/**
|
|
58
|
+
* CSS classes applied when the button is active
|
|
59
|
+
*/
|
|
60
|
+
@Input() buttonRouterLinkActive: string | string[] = '';
|
|
61
|
+
/**
|
|
62
|
+
* Determines whether the button is disabled
|
|
63
|
+
*/
|
|
64
|
+
@Input() disabled: boolean | null = null;
|
|
65
|
+
/**
|
|
66
|
+
* Style type of the button
|
|
67
|
+
* @see TButtonStyle
|
|
68
|
+
*/
|
|
69
|
+
@Input() styleType: TButtonStyle = 'primary';
|
|
70
|
+
/**
|
|
71
|
+
* Shape of the button.
|
|
72
|
+
* @see TButtonShape
|
|
73
|
+
*/
|
|
74
|
+
@Input() shape: TButtonShape = 'default';
|
|
75
|
+
/**
|
|
76
|
+
* Text content of the button
|
|
77
|
+
*/
|
|
78
|
+
@Input() text: string = '';
|
|
79
|
+
/**
|
|
80
|
+
* Accessible label for icon-only buttons
|
|
81
|
+
*/
|
|
82
|
+
@Input() ariaLabel: string = '';
|
|
83
|
+
/**
|
|
84
|
+
* Emits when the button is clicked
|
|
85
|
+
*/
|
|
86
|
+
@Output() clickEvent: EventEmitter<void> = new EventEmitter();
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* CSS classes applied to the container element based on its position
|
|
90
|
+
* @see TButtonStyle
|
|
91
|
+
*/
|
|
92
|
+
public get containerNgClass() {
|
|
93
|
+
return {
|
|
94
|
+
'flex-column-reverse': this.iconPosition === 'top',
|
|
95
|
+
'flex-row-reverse': this.iconPosition === 'left',
|
|
96
|
+
'flex-row': this.iconPosition === 'right',
|
|
97
|
+
'flex-column': this.iconPosition === 'bottom'
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* CSS classes applied to the icon element based on its position
|
|
103
|
+
* @see TButtonIconPosition
|
|
104
|
+
*/
|
|
105
|
+
public get iconNgClass() {
|
|
106
|
+
return {
|
|
107
|
+
'mb-2': this.iconPosition === 'top',
|
|
108
|
+
'me-2': this.iconPosition === 'left',
|
|
109
|
+
'ms-2': this.iconPosition === 'right',
|
|
110
|
+
'mt-2': this.iconPosition === 'bottom'
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Combined classes for icon color + spacing
|
|
116
|
+
*/
|
|
117
|
+
public get iconClassMap() {
|
|
118
|
+
const hasText = !!this.text;
|
|
119
|
+
return {
|
|
120
|
+
'frg-btn__icon-primary': this.iconStyleType === 'primary',
|
|
121
|
+
'frg-btn__icon-secondary': this.iconStyleType === 'secondary',
|
|
122
|
+
'frg-btn__icon-tertiary': this.iconStyleType === 'tertiary',
|
|
123
|
+
'frg-btn__icon-info': this.iconStyleType === 'info',
|
|
124
|
+
'frg-btn__icon-success': this.iconStyleType === 'success',
|
|
125
|
+
'frg-btn__icon-warning': this.iconStyleType === 'warning',
|
|
126
|
+
'frg-btn__icon-danger': this.iconStyleType === 'danger',
|
|
127
|
+
'frg-btn__icon-dark': this.iconStyleType === 'dark',
|
|
128
|
+
'frg-btn__icon-light': this.iconStyleType === 'light',
|
|
129
|
+
'frg-btn__icon-pill': this.shape === 'pill' && hasText,
|
|
130
|
+
...(hasText ? this.iconNgClass : {})
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Emits when the button is clicked
|
|
136
|
+
*/
|
|
137
|
+
onClick(): void {
|
|
138
|
+
if(!this.disabled) {
|
|
139
|
+
this.clickEvent.emit();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TBasePosition, TBaseSize, TBaseStyle } from '../../types/base.types';
|
|
2
|
+
|
|
3
|
+
export type TButtonType = 'button' | 'reset' | 'submit';
|
|
4
|
+
export type TButtonStyle = TBaseStyle | 'ghost' | 'icon' | 'neutral';
|
|
5
|
+
export type TButtonSize = TBaseSize;
|
|
6
|
+
export type TButtonIconPosition = TBasePosition;
|
|
7
|
+
export type TButtonShape = 'default' | 'pill';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@if (!isClosed) {
|
|
2
|
+
<div
|
|
3
|
+
class="frg-card"
|
|
4
|
+
[ngClass]="{
|
|
5
|
+
'frg-card__primary': styleType === 'primary',
|
|
6
|
+
'frg-card__secondary': styleType === 'secondary',
|
|
7
|
+
'frg-card__tertiary': styleType === 'tertiary',
|
|
8
|
+
'frg-card__dark': styleType === 'dark',
|
|
9
|
+
'frg-card__light': styleType === 'light',
|
|
10
|
+
'frg-card__success': styleType === 'success',
|
|
11
|
+
'frg-card__warning': styleType === 'warning',
|
|
12
|
+
'frg-card__danger': styleType === 'danger',
|
|
13
|
+
'frg-card__outline-primary': styleType === 'outline-primary',
|
|
14
|
+
'frg-card__outline-secondary': styleType === 'outline-secondary',
|
|
15
|
+
'frg-card__outline-tertiary': styleType === 'outline-tertiary',
|
|
16
|
+
'frg-card__outline-dark': styleType === 'outline-dark',
|
|
17
|
+
'frg-card__outline-light': styleType === 'outline-light',
|
|
18
|
+
'frg-card__outline-success': styleType === 'outline-success',
|
|
19
|
+
'frg-card__outline-warning': styleType === 'outline-warning',
|
|
20
|
+
'frg-card__outline-danger': styleType === 'outline-danger'
|
|
21
|
+
}"
|
|
22
|
+
>
|
|
23
|
+
@if(hasCloseCard) {
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
class="frg-card__close-btn"
|
|
27
|
+
(click)="onCloseCard()"
|
|
28
|
+
aria-label="Close"
|
|
29
|
+
>
|
|
30
|
+
×
|
|
31
|
+
</button>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
<div class="frg-card__head">
|
|
35
|
+
<ng-content select="[frg-card-head]"></ng-content>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="frg-card__body">
|
|
38
|
+
<ng-content select="[frg-card-body]"></ng-content>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="frg-card__footer">
|
|
41
|
+
<ng-content select="[frg-card-footer]"></ng-content>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use '../../../../assets/styles/scss/variables' as *;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
.frg-card {
|
|
5
|
+
position: relative;
|
|
6
|
+
margin-top: 0;
|
|
7
|
+
border-radius: 0.25rem;
|
|
8
|
+
padding: 20px 1.5rem;
|
|
9
|
+
box-shadow:
|
|
10
|
+
0 1px 3px 0 rgba(0, 0, 0, 0.1),
|
|
11
|
+
0 1px 2px -1px rgba(0, 0, 0, 0.1);
|
|
12
|
+
transition: all 0.15s ease-in-out;
|
|
13
|
+
color: $color-dark;
|
|
14
|
+
background-color: $color-light;
|
|
15
|
+
font-family: $base-font;
|
|
16
|
+
|
|
17
|
+
&__primary {
|
|
18
|
+
color: $color-light;
|
|
19
|
+
background-color: $color-primary;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__secondary {
|
|
23
|
+
color: $color-light;
|
|
24
|
+
background-color: $color-secondary;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__tertiary {
|
|
28
|
+
color: $color-light;
|
|
29
|
+
background-color: $color-tertiary;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__danger {
|
|
33
|
+
color: $color-light;
|
|
34
|
+
background-color: $color-danger;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__warning {
|
|
38
|
+
color: $color-light;
|
|
39
|
+
background-color: $color-warning;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__success {
|
|
43
|
+
color: $color-light;
|
|
44
|
+
background-color: $color-success;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Outline variants
|
|
48
|
+
&__outline-primary {
|
|
49
|
+
color: $color-dark;
|
|
50
|
+
background-color: $color-light;
|
|
51
|
+
border: 2px solid $color-primary;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__outline-secondary {
|
|
55
|
+
color: $color-dark;
|
|
56
|
+
background-color: $color-light;
|
|
57
|
+
border: 2px solid $color-secondary;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&__outline-tertiary {
|
|
61
|
+
color: $color-dark;
|
|
62
|
+
background-color: $color-light;
|
|
63
|
+
border: 2px solid $color-tertiary;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__outline-danger {
|
|
67
|
+
color: $color-dark;
|
|
68
|
+
background-color: $color-light;
|
|
69
|
+
border: 2px solid $color-danger;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__outline-warning {
|
|
73
|
+
color: $color-dark;
|
|
74
|
+
background-color: $color-light;
|
|
75
|
+
border: 2px solid $color-warning;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__outline-success {
|
|
79
|
+
color: $color-dark;
|
|
80
|
+
background-color: $color-light;
|
|
81
|
+
border: 2px solid $color-success;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__head {
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
align-items: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&__close-btn {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: .5rem;
|
|
93
|
+
right: .5rem;
|
|
94
|
+
background: transparent;
|
|
95
|
+
border: none;
|
|
96
|
+
color: $color-dark-soft;
|
|
97
|
+
font-size: 1.5rem;
|
|
98
|
+
line-height: 1;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
padding: 0.25rem 0.5rem;
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
z-index: 2;
|
|
106
|
+
|
|
107
|
+
&:hover,
|
|
108
|
+
&:focus {
|
|
109
|
+
color: $color-dark;
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { CardComponent } from './card.component';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CardComponent],
|
|
9
|
+
template: `
|
|
10
|
+
<frg-card [styleType]="styleType" [hasCloseCard]="hasCloseCard" (closeCard)="closed = true">
|
|
11
|
+
<div frg-card-head>Head</div>
|
|
12
|
+
<div frg-card-body>Body</div>
|
|
13
|
+
<div frg-card-footer>Footer</div>
|
|
14
|
+
</frg-card>
|
|
15
|
+
`
|
|
16
|
+
})
|
|
17
|
+
class TestHostComponent {
|
|
18
|
+
styleType: any = 'default';
|
|
19
|
+
hasCloseCard = false;
|
|
20
|
+
closed = false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('CardComponent', () => {
|
|
24
|
+
let fixture: ComponentFixture<TestHostComponent>;
|
|
25
|
+
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
await TestBed.configureTestingModule({
|
|
28
|
+
imports: [TestHostComponent]
|
|
29
|
+
}).compileComponents();
|
|
30
|
+
|
|
31
|
+
fixture = TestBed.createComponent(TestHostComponent);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders projected head, body, and footer content', () => {
|
|
35
|
+
fixture.detectChanges();
|
|
36
|
+
|
|
37
|
+
expect(fixture.debugElement.query(By.css('.frg-card__head'))?.nativeElement.textContent).toContain('Head');
|
|
38
|
+
expect(fixture.debugElement.query(By.css('.frg-card__body'))?.nativeElement.textContent).toContain('Body');
|
|
39
|
+
expect(fixture.debugElement.query(By.css('.frg-card__footer'))?.nativeElement.textContent).toContain('Footer');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('applies style classes based on styleType', () => {
|
|
43
|
+
fixture.componentInstance.styleType = 'primary';
|
|
44
|
+
|
|
45
|
+
fixture.detectChanges();
|
|
46
|
+
|
|
47
|
+
const card = fixture.debugElement.query(By.css('.frg-card'));
|
|
48
|
+
expect(card.nativeElement.classList).toContain('frg-card__primary');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('shows and triggers close behavior when enabled', () => {
|
|
52
|
+
fixture.componentInstance.hasCloseCard = true;
|
|
53
|
+
|
|
54
|
+
fixture.detectChanges();
|
|
55
|
+
|
|
56
|
+
const closeBtn = fixture.debugElement.query(By.css('.frg-card__close-btn'));
|
|
57
|
+
expect(closeBtn).toBeTruthy();
|
|
58
|
+
|
|
59
|
+
closeBtn.nativeElement.click();
|
|
60
|
+
fixture.detectChanges();
|
|
61
|
+
|
|
62
|
+
expect(fixture.componentInstance.closed).toBeTrue();
|
|
63
|
+
expect(fixture.debugElement.query(By.css('.frg-card'))).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
+
import { TCardStyle } from './card.type';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'frg-card',
|
|
7
|
+
imports: [NgClass],
|
|
8
|
+
templateUrl: './card.component.html',
|
|
9
|
+
styleUrl: './card.component.scss'
|
|
10
|
+
})
|
|
11
|
+
export class CardComponent {
|
|
12
|
+
@Input() styleType: TCardStyle = 'default';
|
|
13
|
+
@Input() hasCloseCard: boolean = false;
|
|
14
|
+
@Output() closeCard = new EventEmitter<void>();
|
|
15
|
+
isClosed = false;
|
|
16
|
+
|
|
17
|
+
onCloseCard() {
|
|
18
|
+
this.closeCard.emit();
|
|
19
|
+
this.isClosed = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@if (config) {
|
|
2
|
+
<div #container class="code-block">
|
|
3
|
+
@if (header) {
|
|
4
|
+
<div class="code-block__header">
|
|
5
|
+
<span class="code-block__header__title">{{ title }}</span>
|
|
6
|
+
@if (showCopyButton) {
|
|
7
|
+
<button
|
|
8
|
+
type="button"
|
|
9
|
+
class="code-block__header__action"
|
|
10
|
+
(click)="copyToClipboard()"
|
|
11
|
+
[attr.aria-label]="copied ? copiedLabel : copyLabel"
|
|
12
|
+
>
|
|
13
|
+
<span class="code-block__header__action-content" [class.is-copied]="copied">
|
|
14
|
+
@if (copied) {
|
|
15
|
+
<span class="code-block__header__action-label">{{ copiedLabel }}</span>
|
|
16
|
+
} @else {
|
|
17
|
+
<span class="fa-regular fa-copy" aria-hidden="true"></span>
|
|
18
|
+
}
|
|
19
|
+
</span>
|
|
20
|
+
</button>
|
|
21
|
+
}
|
|
22
|
+
</div>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@if (body) {
|
|
26
|
+
<div class="code-block__body">
|
|
27
|
+
@switch (type) {
|
|
28
|
+
@case ('text') {
|
|
29
|
+
<pre
|
|
30
|
+
#codeElement
|
|
31
|
+
class="language-{{ language || 'typescript' }}"
|
|
32
|
+
[attr.data-line]="highlightLines"
|
|
33
|
+
>
|
|
34
|
+
<code [textContent]="content"></code>
|
|
35
|
+
</pre>
|
|
36
|
+
}
|
|
37
|
+
@case ('component') {
|
|
38
|
+
@if (component) {
|
|
39
|
+
<ng-template
|
|
40
|
+
addComponent
|
|
41
|
+
[component]="component"
|
|
42
|
+
[inputComponent]="inputs"
|
|
43
|
+
></ng-template>
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
49
|
+
@if (config.footer?.text) {
|
|
50
|
+
<div class="code-block__footer">
|
|
51
|
+
{{ config.footer?.text }}
|
|
52
|
+
</div>
|
|
53
|
+
}
|
|
54
|
+
</div>
|
|
55
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@use './../../../../assets/styles/scss/variables' as *;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
|
|
6
|
+
.code-block {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
position: relative;
|
|
9
|
+
background: $color-dark;
|
|
10
|
+
box-shadow: $box-shadow-sm;
|
|
11
|
+
border-radius: .25rem;
|
|
12
|
+
min-width: 0; // Prevent overflow
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
|
|
15
|
+
&__header {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
align-items: center;
|
|
19
|
+
border-radius: .25rem .25rem 0 0;
|
|
20
|
+
gap: 0.25rem;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 1.5rem;
|
|
23
|
+
background: $color-dark-neutral;
|
|
24
|
+
box-shadow: $box-shadow-sm;
|
|
25
|
+
|
|
26
|
+
&__title {
|
|
27
|
+
font-size: 0.7rem;
|
|
28
|
+
padding: 0 0.5rem;
|
|
29
|
+
font-weight: 300;
|
|
30
|
+
color: $color-light;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__action {
|
|
34
|
+
border: 0;
|
|
35
|
+
background: transparent;
|
|
36
|
+
color: $color-light;
|
|
37
|
+
font-size: 0.7rem;
|
|
38
|
+
font-weight: 400;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 0.25rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__action:hover,
|
|
46
|
+
&__action:focus-visible {
|
|
47
|
+
color: $color-light-soft;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&__action-content {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
min-width: 1.25rem;
|
|
55
|
+
transition: transform 0.2s ease, opacity 0.2s ease;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&__action-content.is-copied {
|
|
59
|
+
animation: code-block-copy-pop 0.35s ease;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__action-label {
|
|
63
|
+
letter-spacing: 0.02em;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__body {
|
|
68
|
+
color: $color-light;
|
|
69
|
+
text-align: left;
|
|
70
|
+
font-size: 0.75rem;
|
|
71
|
+
padding: 0.5rem 1rem;
|
|
72
|
+
white-space: pre;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__footer {
|
|
76
|
+
padding: 0.5rem 1rem;
|
|
77
|
+
font-size: 0.6rem;
|
|
78
|
+
color: $color-light-soft;
|
|
79
|
+
background: $color-dark-neutral;
|
|
80
|
+
border-radius: 0 0 .25rem .25rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
pre[class*='language-'] {
|
|
84
|
+
padding: 0;
|
|
85
|
+
margin: 0;
|
|
86
|
+
background: none;
|
|
87
|
+
box-shadow: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes code-block-copy-pop {
|
|
92
|
+
0% {
|
|
93
|
+
transform: scale(0.85);
|
|
94
|
+
opacity: 0.6;
|
|
95
|
+
}
|
|
96
|
+
60% {
|
|
97
|
+
transform: scale(1.08);
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
100% {
|
|
101
|
+
transform: scale(1);
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
pre.hljs {
|
|
107
|
+
scrollbar-width: thin;
|
|
108
|
+
scrollbar-color: $color-light-soft transparent;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
pre.hljs::-webkit-scrollbar-track {
|
|
112
|
+
background: transparent;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
pre.hljs::-webkit-scrollbar-thumb {
|
|
116
|
+
background-color: $color-light-soft;
|
|
117
|
+
border-radius: 6px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pre.hljs::-webkit-scrollbar-button {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { By } from '@angular/platform-browser';
|
|
3
|
+
import hljs from 'highlight.js';
|
|
4
|
+
import { CodeBlockComponent } from './code-block.component';
|
|
5
|
+
import { CodeBlockConfig } from './code-block.interface';
|
|
6
|
+
|
|
7
|
+
describe('CodeBlockComponent', () => {
|
|
8
|
+
let fixture: ComponentFixture<CodeBlockComponent>;
|
|
9
|
+
let component: CodeBlockComponent;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [CodeBlockComponent]
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
|
|
16
|
+
fixture = TestBed.createComponent(CodeBlockComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders the header title when provided', () => {
|
|
21
|
+
component.config = {
|
|
22
|
+
header: { title: 'Example' },
|
|
23
|
+
body: { type: 'text', content: 'const a = 1;' }
|
|
24
|
+
} as CodeBlockConfig;
|
|
25
|
+
|
|
26
|
+
fixture.detectChanges();
|
|
27
|
+
|
|
28
|
+
const title = fixture.debugElement.query(By.css('.code-block__header__title'));
|
|
29
|
+
expect(title.nativeElement.textContent).toContain('Example');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders the footer text when provided', () => {
|
|
33
|
+
component.config = {
|
|
34
|
+
header: { title: 'Example' },
|
|
35
|
+
body: { type: 'text', content: 'const a = 1;' },
|
|
36
|
+
footer: { text: 'Footer text' }
|
|
37
|
+
} as CodeBlockConfig;
|
|
38
|
+
|
|
39
|
+
fixture.detectChanges();
|
|
40
|
+
|
|
41
|
+
const footer = fixture.debugElement.query(By.css('.code-block__footer'));
|
|
42
|
+
expect(footer.nativeElement.textContent).toContain('Footer text');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('highlights code after view init for text body', () => {
|
|
46
|
+
const highlightSpy = spyOn(hljs, 'highlightElement').and.callThrough();
|
|
47
|
+
|
|
48
|
+
component.config = {
|
|
49
|
+
header: { title: 'Example' },
|
|
50
|
+
body: { type: 'text', content: 'const a = 1;', language: 'typescript' }
|
|
51
|
+
} as CodeBlockConfig;
|
|
52
|
+
|
|
53
|
+
fixture.detectChanges();
|
|
54
|
+
|
|
55
|
+
expect(highlightSpy).toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('adds line numbers when configured', () => {
|
|
59
|
+
const highlightSpy = spyOn(hljs, 'highlightElement').and.callThrough();
|
|
60
|
+
|
|
61
|
+
component.config = {
|
|
62
|
+
header: { title: 'Example' },
|
|
63
|
+
body: { type: 'text', content: 'first\nsecond', hasNumberLine: true }
|
|
64
|
+
} as CodeBlockConfig;
|
|
65
|
+
|
|
66
|
+
fixture.detectChanges();
|
|
67
|
+
|
|
68
|
+
const pre = fixture.debugElement.query(By.css('pre')).nativeElement as HTMLElement;
|
|
69
|
+
expect(pre.textContent).toContain('1 | first');
|
|
70
|
+
expect(pre.textContent).toContain('2 | second');
|
|
71
|
+
expect(highlightSpy).toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('does not render when config is undefined', () => {
|
|
75
|
+
component.config = undefined;
|
|
76
|
+
|
|
77
|
+
fixture.detectChanges();
|
|
78
|
+
|
|
79
|
+
expect(fixture.debugElement.query(By.css('.code-block'))).toBeNull();
|
|
80
|
+
});
|
|
81
|
+
});
|