@chat21/chat21-web-widget 5.1.32-rc8 → 5.1.33-rc11
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/.angular-mcp-cache/package.json +1 -0
- package/.cursor/angular18-accessibility-auditor-skill.md +442 -0
- package/.cursor/mcp.json +15 -0
- package/.github/workflows/playwright.yml +27 -0
- package/.playwright-mcp/console-2026-05-08T15-31-09-000Z.log +17 -0
- package/.playwright-mcp/console-2026-05-08T15-32-19-412Z.log +89 -0
- package/.playwright-mcp/console-2026-05-08T16-18-48-424Z.log +133 -0
- package/.playwright-mcp/console-2026-05-11T12-54-06-869Z.log +13 -0
- package/.playwright-mcp/console-2026-05-11T12-54-56-229Z.log +147 -0
- package/.playwright-mcp/console-2026-05-11T12-55-47-174Z.log +183 -0
- package/.playwright-mcp/console-2026-05-11T15-34-03-590Z.log +210 -0
- package/.playwright-mcp/console-2026-05-12T15-07-31-880Z.log +118 -0
- package/.playwright-mcp/page-2026-05-08T15-32-19-900Z.yml +851 -0
- package/.playwright-mcp/page-2026-05-08T15-32-47-264Z.yml +857 -0
- package/.playwright-mcp/page-2026-05-08T15-33-17-089Z.yml +1110 -0
- package/.playwright-mcp/page-2026-05-08T15-33-23-486Z.yml +1069 -0
- package/.playwright-mcp/page-2026-05-08T15-33-45-390Z.yml +1076 -0
- package/.playwright-mcp/page-2026-05-08T15-33-52-666Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-01-338Z.yml +1085 -0
- package/.playwright-mcp/page-2026-05-08T15-34-07-227Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-13-875Z.yml +1072 -0
- package/.playwright-mcp/page-2026-05-08T15-34-21-885Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T15-34-32-755Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T15-35-09-607Z.yml +1119 -0
- package/.playwright-mcp/page-2026-05-08T15-35-14-242Z.yml +1109 -0
- package/.playwright-mcp/page-2026-05-08T16-18-48-671Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-08T16-18-52-753Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-13-919Z.yml +68 -0
- package/.playwright-mcp/page-2026-05-08T16-19-17-977Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-25-733Z.yml +120 -0
- package/.playwright-mcp/page-2026-05-08T16-19-29-252Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-19-39-269Z.yml +80 -0
- package/.playwright-mcp/page-2026-05-08T16-19-43-915Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-04-407Z.yml +81 -0
- package/.playwright-mcp/page-2026-05-08T16-20-08-984Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-32-397Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-20-58-658Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-21-12-320Z.yml +86 -0
- package/.playwright-mcp/page-2026-05-08T16-21-39-154Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-21-45-420Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-22-21-062Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-08T16-22-58-232Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-23-36-520Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-08T16-23-46-805Z.yml +100 -0
- package/.playwright-mcp/page-2026-05-08T16-23-55-169Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-24-26-574Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-25-34-414Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-25-59-831Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-26-21-809Z.yml +91 -0
- package/.playwright-mcp/page-2026-05-08T16-26-47-443Z.yml +105 -0
- package/.playwright-mcp/page-2026-05-08T16-26-56-136Z.png +0 -0
- package/.playwright-mcp/page-2026-05-08T16-27-59-610Z.yml +48 -0
- package/.playwright-mcp/page-2026-05-11T12-54-07-180Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-11T12-54-56-946Z.yml +4 -0
- package/.playwright-mcp/page-2026-05-11T12-55-47-503Z.yml +24 -0
- package/.playwright-mcp/page-2026-05-11T12-56-00-766Z.yml +28 -0
- package/.playwright-mcp/page-2026-05-11T12-56-06-438Z.yml +90 -0
- package/.playwright-mcp/page-2026-05-11T12-57-56-838Z.yml +106 -0
- package/.playwright-mcp/page-2026-05-11T12-58-00-124Z.yml +106 -0
- package/.playwright-mcp/page-2026-05-11T12-59-08-836Z.yml +61 -0
- package/.playwright-mcp/page-2026-05-11T12-59-12-088Z.yml +61 -0
- package/.playwright-mcp/page-2026-05-11T12-59-26-215Z.yml +69 -0
- package/.playwright-mcp/page-2026-05-11T12-59-29-519Z.yml +69 -0
- package/.playwright-mcp/page-2026-05-11T12-59-37-309Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-11T12-59-39-968Z.yml +79 -0
- package/.playwright-mcp/page-2026-05-11T12-59-45-983Z.yml +78 -0
- package/.playwright-mcp/page-2026-05-11T12-59-49-951Z.yml +78 -0
- package/.playwright-mcp/page-2026-05-11T15-34-04-515Z.yml +0 -0
- package/.playwright-mcp/page-2026-05-12T15-07-32-171Z.yml +44 -0
- package/.playwright-mcp/page-2026-05-12T15-08-09-820Z.yml +119 -0
- package/CHANGELOG.md +68 -3
- package/angular.json +20 -3
- package/deploy_amazon_beta.sh +7 -17
- package/deploy_amazon_prod.sh +41 -0
- package/docs/TILEDESK_WIDGET_ACCESSIBILITY_STATEMENT_COMPLETE.md +379 -0
- package/env.sample +3 -2
- package/mocks/voice-websocket-mock/server.cjs +245 -0
- package/package.json +7 -3
- package/playwright.config.ts +41 -0
- package/src/app/app.component.html +2 -2
- package/src/app/app.component.scss +25 -14
- package/src/app/app.component.spec.ts +21 -6
- package/src/app/app.module.ts +4 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.html +19 -11
- package/src/app/component/conversation-detail/conversation/conversation.component.scss +28 -0
- package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
- package/src/app/component/conversation-detail/conversation/conversation.component.ts +63 -17
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +25 -13
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +123 -5
- package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +1 -0
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +22 -9
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +23 -1
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +242 -149
- package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +7 -6
- package/src/app/component/conversation-detail/conversation-emojii/conversation-emojii.component.spec.ts +53 -3
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component copy.html +172 -0
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +112 -61
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +133 -16
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +452 -78
- package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +199 -79
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +113 -53
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +12 -4
- package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +274 -29
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +23 -9
- package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.spec.ts +80 -8
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +29 -23
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.spec.ts +185 -16
- package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +34 -14
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.html +46 -19
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +67 -10
- package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +142 -12
- package/src/app/component/error-alert/error-alert.component.spec.ts +65 -5
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +16 -7
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +21 -0
- package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.spec.ts +89 -7
- package/src/app/component/form/form-builder/form-builder.component.html +1 -1
- package/src/app/component/form/form-builder/form-builder.component.spec.ts +163 -21
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.html +8 -4
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +10 -5
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.spec.ts +90 -16
- package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +26 -0
- package/src/app/component/form/inputs/form-label/form-label.component.spec.ts +45 -11
- package/src/app/component/form/inputs/form-radio-button/form-radio-button.component.spec.ts +24 -6
- package/src/app/component/form/inputs/form-select/form-select.component.spec.ts +14 -5
- package/src/app/component/form/inputs/form-text/form-text.component.html +14 -12
- package/src/app/component/form/inputs/form-text/form-text.component.scss +11 -1
- package/src/app/component/form/inputs/form-text/form-text.component.spec.ts +113 -17
- package/src/app/component/form/inputs/form-text/form-text.component.ts +35 -3
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +13 -11
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +6 -5
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.spec.ts +149 -13
- package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +26 -0
- package/src/app/component/form/prechat-form/prechat-form.component.html +14 -11
- package/src/app/component/form/prechat-form/prechat-form.component.spec.ts +102 -10
- package/src/app/component/form/prechat-form/prechat-form.component.ts +8 -1
- package/src/app/component/form/prechat-form-test-mock.ts +35 -0
- package/src/app/component/home/home.component.html +38 -31
- package/src/app/component/home/home.component.scss +4 -2
- package/src/app/component/home/home.component.spec.ts +226 -11
- package/src/app/component/home-conversations/home-conversations.component.html +30 -26
- package/src/app/component/home-conversations/home-conversations.component.scss +3 -0
- package/src/app/component/home-conversations/home-conversations.component.spec.ts +212 -36
- package/src/app/component/last-message/last-message.component.html +15 -9
- package/src/app/component/last-message/last-message.component.scss +16 -2
- package/src/app/component/last-message/last-message.component.spec.ts +204 -23
- package/src/app/component/launcher-button/launcher-button.component.html +8 -13
- package/src/app/component/launcher-button/launcher-button.component.spec.ts +104 -8
- package/src/app/component/list-all-conversations/list-all-conversations.component.html +12 -17
- package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -0
- package/src/app/component/list-conversations/list-conversations.component.html +22 -22
- package/src/app/component/menu-options/menu-options.component.html +30 -20
- package/src/app/component/menu-options/menu-options.component.spec.ts +125 -9
- package/src/app/component/message/audio/audio.component.html +13 -15
- package/src/app/component/message/audio/audio.component.spec.ts +140 -5
- package/src/app/component/message/audio/audio.component.ts +1 -0
- package/src/app/component/message/audio-sync/audio-sync.component.scss +1 -1
- package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +81 -1
- package/src/app/component/message/audio-sync/audio-sync.component.ts +134 -24
- package/src/app/component/message/avatar/avatar.component.html +2 -2
- package/src/app/component/message/avatar/avatar.component.spec.ts +99 -7
- package/src/app/component/message/bubble-message/bubble-message.component.html +39 -52
- package/src/app/component/message/bubble-message/bubble-message.component.scss +59 -1
- package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +154 -57
- package/src/app/component/message/bubble-message/bubble-message.component.ts +152 -110
- package/src/app/component/message/buttons/action-button/action-button.component.html +3 -4
- package/src/app/component/message/buttons/action-button/action-button.component.spec.ts +49 -5
- package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -8
- package/src/app/component/message/buttons/link-button/link-button.component.spec.ts +50 -5
- package/src/app/component/message/buttons/text-button/text-button.component.spec.ts +44 -5
- package/src/app/component/message/carousel/carousel.component.html +29 -16
- package/src/app/component/message/carousel/carousel.component.scss +20 -8
- package/src/app/component/message/carousel/carousel.component.spec.ts +80 -3
- package/src/app/component/message/carousel/carousel.component.ts +16 -0
- package/src/app/component/message/frame/frame.component.html +9 -4
- package/src/app/component/message/frame/frame.component.spec.ts +34 -15
- package/src/app/component/message/frame/frame.component.ts +7 -2
- package/src/app/component/message/html/html.component.html +1 -1
- package/src/app/component/message/html/html.component.scss +1 -1
- package/src/app/component/message/html/html.component.spec.ts +24 -7
- package/src/app/component/message/image/image.component.html +12 -10
- package/src/app/component/message/image/image.component.scss +16 -0
- package/src/app/component/message/image/image.component.spec.ts +101 -15
- package/src/app/component/message/image/image.component.ts +90 -51
- package/src/app/component/message/info-message/info-message.component.spec.ts +26 -14
- package/src/app/component/message/json-sources/json-sources.component.html +38 -0
- package/src/app/component/message/json-sources/json-sources.component.scss +201 -0
- package/src/app/component/message/json-sources/json-sources.component.ts +89 -0
- package/src/app/component/message/like-unlike/like-unlike.component.html +7 -9
- package/src/app/component/message/like-unlike/like-unlike.component.spec.ts +31 -3
- package/src/app/component/message/return-receipt/return-receipt.component.spec.ts +38 -17
- package/src/app/component/message/text/text.component.html +3 -3
- package/src/app/component/message/text/text.component.scss +80 -86
- package/src/app/component/message/text/text.component.spec.ts +106 -13
- package/src/app/component/message-attachment/message-attachment.component.spec.ts +134 -13
- package/src/app/component/selection-department/selection-department.component.html +21 -23
- package/src/app/component/selection-department/selection-department.component.spec.ts +159 -14
- package/src/app/component/selection-department/selection-department.component.ts +8 -1
- package/src/app/component/send-button/send-button.component.html +5 -13
- package/src/app/component/send-button/send-button.component.spec.ts +2 -2
- package/src/app/component/star-rating-widget/star-rating-widget.component.html +51 -81
- package/src/app/directives/tooltip.directive.spec.ts +8 -4
- package/src/app/modals/confirm-close/confirm-close.component.html +20 -8
- package/src/app/modals/confirm-close/confirm-close.component.scss +3 -0
- package/src/app/modals/confirm-close/confirm-close.component.spec.ts +13 -4
- package/src/app/modals/confirm-close/confirm-close.component.ts +8 -1
- package/src/app/pipe/html-entites-encode.pipe.spec.ts +35 -2
- package/src/app/pipe/marked.pipe.spec.ts +38 -2
- package/src/app/pipe/marked.pipe.ts +51 -41
- package/src/app/providers/app-config.service.ts +4 -2
- package/src/app/providers/brand.service.spec.ts +23 -2
- package/src/app/providers/brand.service.ts +1 -1
- package/src/app/providers/global-settings.service.spec.ts +1009 -14
- package/src/app/providers/global-settings.service.ts +59 -2
- package/src/app/providers/json-sources-parser.service.ts +175 -0
- package/src/app/providers/translator.service.ts +24 -6
- package/src/app/providers/tts-audio-playback-coordinator.service.spec.ts +117 -0
- package/src/app/providers/tts-audio-playback-coordinator.service.ts +45 -7
- package/src/app/providers/url-preview.service.ts +82 -0
- package/src/app/providers/voice/audio.types.ts +6 -0
- package/src/app/providers/voice/voice-streaming.service.spec.ts +23 -0
- package/src/app/providers/voice/voice-streaming.service.ts +702 -0
- package/src/app/providers/voice/voice-streaming.types.ts +112 -0
- package/src/app/providers/voice/voice.service.spec.ts +170 -3
- package/src/app/providers/voice/voice.service.ts +695 -16
- package/src/app/sass/_variables.scss +1 -1
- package/src/app/sass/animations.scss +19 -1
- package/src/app/utils/globals.ts +14 -0
- package/src/app/utils/json-sources-utils.ts +27 -0
- package/src/app/utils/url-utils.ts +98 -0
- package/src/app/utils/utils-resources.ts +1 -1
- package/src/assets/i18n/en.json +106 -100
- package/src/assets/i18n/es.json +107 -101
- package/src/assets/i18n/fr.json +107 -101
- package/src/assets/i18n/it.json +107 -99
- package/src/assets/sounds/keyboard.mp3 +0 -0
- package/src/assets/twp/index-dev.html +18 -0
- package/src/assets/twp/tiledesk_widget_files/widget-css-override-example.css +14 -0
- package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
- package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
- package/src/chat21-core/utils/constants.ts +4 -0
- package/src/chat21-core/utils/utils-message.ts +23 -1
- package/src/widget-config-template.json +3 -1
- package/src/widget-config.json +28 -27
- package/tests/widget-form-rich.spec.ts +67 -0
- package/tests/widget-index-dev-settings.spec.ts +52 -0
- package/tests/widget-twp-iframe.spec.ts +39 -0
|
@@ -1,25 +1,85 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { By } from '@angular/platform-browser';
|
|
2
3
|
|
|
4
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
5
|
+
import { FILE_SIZE_LIMIT } from 'src/app/utils/constants';
|
|
3
6
|
import { ErrorAlertComponent } from './error-alert.component';
|
|
4
7
|
|
|
5
8
|
describe('ErrorAlertComponent', () => {
|
|
6
9
|
let component: ErrorAlertComponent;
|
|
7
10
|
let fixture: ComponentFixture<ErrorAlertComponent>;
|
|
11
|
+
let translateStub: { translateLanguage: jasmine.Spy };
|
|
8
12
|
|
|
9
13
|
beforeEach(async () => {
|
|
14
|
+
translateStub = {
|
|
15
|
+
translateLanguage: jasmine.createSpy('translateLanguage').and.callFake((keys: string[]) => {
|
|
16
|
+
const m = new Map<string, string>();
|
|
17
|
+
keys.forEach((k) => m.set(k, `Errore: {{FILE_SIZE_LIMIT}} MB (chiave ${k})`));
|
|
18
|
+
return m;
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
|
|
10
22
|
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [
|
|
12
|
-
|
|
13
|
-
.compileComponents();
|
|
23
|
+
declarations: [ErrorAlertComponent],
|
|
24
|
+
providers: [{ provide: CustomTranslateService, useValue: translateStub }],
|
|
25
|
+
}).compileComponents();
|
|
14
26
|
|
|
15
27
|
fixture = TestBed.createComponent(ErrorAlertComponent);
|
|
16
28
|
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
29
|
});
|
|
19
30
|
|
|
20
31
|
it('should create', () => {
|
|
32
|
+
fixture.detectChanges();
|
|
21
33
|
expect(component).toBeTruthy();
|
|
22
34
|
});
|
|
23
|
-
});
|
|
24
35
|
|
|
36
|
+
describe('inputs and translation key path', () => {
|
|
37
|
+
it('should resolve errorKeyMessage via CustomTranslateService and interpolate constants + errorParams', () => {
|
|
38
|
+
component.errorKeyMessage = 'MY_KEY';
|
|
39
|
+
component.errorParams = { FILE_SIZE_LIMIT: 99 };
|
|
40
|
+
component.ngOnInit();
|
|
41
|
+
expect(translateStub.translateLanguage).toHaveBeenCalledWith(['MY_KEY']);
|
|
42
|
+
expect(component.errorMessage).toContain('99');
|
|
43
|
+
expect(component.errorMessage).toContain('(chiave MY_KEY)');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should render translated message in the alert DOM', () => {
|
|
47
|
+
component.errorKeyMessage = 'NET_ERR';
|
|
48
|
+
component.ngOnInit();
|
|
49
|
+
fixture.detectChanges();
|
|
50
|
+
const content = fixture.debugElement.query(By.css('.alert-content')).nativeElement as HTMLElement;
|
|
51
|
+
expect(content.textContent?.trim().length).toBeGreaterThan(0);
|
|
52
|
+
expect(fixture.nativeElement.querySelector('#alert-container')).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('plain errorMessage and interpolation', () => {
|
|
57
|
+
it('should use raw errorMessage when errorKeyMessage is empty', () => {
|
|
58
|
+
component.errorKeyMessage = '';
|
|
59
|
+
component.errorMessage = 'Connessione persa';
|
|
60
|
+
component.ngOnInit();
|
|
61
|
+
expect(translateStub.translateLanguage).not.toHaveBeenCalled();
|
|
62
|
+
expect(component.errorMessage).toBe('Connessione persa');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should replace {{placeholders}} from merged CONSTANTS and errorParams', () => {
|
|
66
|
+
component.errorKeyMessage = '';
|
|
67
|
+
component.errorMessage = 'Limite {{FILE_SIZE_LIMIT}} MB, extra {{custom}} e {{missing}}';
|
|
68
|
+
component.errorParams = { custom: 'X' };
|
|
69
|
+
component.ngOnInit();
|
|
70
|
+
expect(component.errorMessage).toContain(String(FILE_SIZE_LIMIT));
|
|
71
|
+
expect(component.errorMessage).toContain('X');
|
|
72
|
+
expect(component.errorMessage).toContain('{{missing}}');
|
|
73
|
+
});
|
|
25
74
|
|
|
75
|
+
it('should leave errorMessage empty when neither key nor plain message is set (widget happy path)', () => {
|
|
76
|
+
component.errorKeyMessage = '';
|
|
77
|
+
component.errorMessage = '';
|
|
78
|
+
component.ngOnInit();
|
|
79
|
+
expect(component.errorMessage).toBe('');
|
|
80
|
+
fixture.detectChanges();
|
|
81
|
+
const content = fixture.nativeElement.querySelector('.alert-content') as HTMLElement;
|
|
82
|
+
expect(content.textContent?.trim()).toBe('');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -9,21 +9,30 @@
|
|
|
9
9
|
|
|
10
10
|
<!-- ******* EYE-CATCHER CLOSE BTN IF IS-MOBILE IS FALSE ******** -->
|
|
11
11
|
<div class="eye-catcher-card-close-btn-wrapper">
|
|
12
|
-
<
|
|
13
|
-
|
|
12
|
+
<button type="button"
|
|
13
|
+
class="eye-catcher-card-close-btn c21-button-clean"
|
|
14
|
+
[attr.aria-label]="g.BUTTON_CLOSE_TO_ICON || 'Close'"
|
|
15
|
+
(click)="closeEyeCatcherCard()">
|
|
16
|
+
<svg class="eye-catcher-card-close-btn-img" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="24px" height="24px">
|
|
14
17
|
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
15
18
|
<path d="M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"/>
|
|
16
19
|
</svg>
|
|
17
|
-
</
|
|
20
|
+
</button>
|
|
18
21
|
</div>
|
|
19
22
|
|
|
20
|
-
<
|
|
23
|
+
<button type="button"
|
|
24
|
+
class="eye-catcher_column ec_left c21-button-clean"
|
|
25
|
+
[attr.aria-label]="g.START_A_CONVERSATION || g.BUTTON_OPEN_CHAT"
|
|
26
|
+
(click)="openChatFromEyeCatcherCard()">
|
|
21
27
|
<div [@rotatedState]='state' class="eye-catcher-card-emoticons-wrapper">
|
|
22
28
|
<span *ngIf="emoticon" class="chat21-card-emoticons">{{emoticon}}</span>
|
|
23
29
|
</div>
|
|
24
|
-
</
|
|
30
|
+
</button>
|
|
25
31
|
|
|
26
|
-
<
|
|
32
|
+
<button type="button"
|
|
33
|
+
class="eye-catcher_column ec_right c21-button-clean"
|
|
34
|
+
[attr.aria-label]="g.START_A_CONVERSATION || g.BUTTON_OPEN_CHAT"
|
|
35
|
+
(click)="openChatFromEyeCatcherCard()">
|
|
27
36
|
<div class="eye-catcher-card-text-wrapper">
|
|
28
37
|
<p class="eye-catcher-card-title">{{title}}</p>
|
|
29
38
|
|
|
@@ -37,7 +46,7 @@
|
|
|
37
46
|
</p>
|
|
38
47
|
</ng-template>
|
|
39
48
|
</div>
|
|
40
|
-
</
|
|
49
|
+
</button>
|
|
41
50
|
|
|
42
51
|
</div>
|
|
43
52
|
|
|
@@ -12,6 +12,27 @@
|
|
|
12
12
|
/* height: 300px; */
|
|
13
13
|
/* Should be removed. Only for demonstration */
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
button.eye-catcher-card-close-btn {
|
|
17
|
+
-webkit-appearance: none;
|
|
18
|
+
appearance: none;
|
|
19
|
+
border: none;
|
|
20
|
+
padding: 0;
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button.eye-catcher_column {
|
|
25
|
+
-webkit-appearance: none;
|
|
26
|
+
appearance: none;
|
|
27
|
+
border: none;
|
|
28
|
+
background: transparent;
|
|
29
|
+
text-align: inherit;
|
|
30
|
+
font: inherit;
|
|
31
|
+
padding: 0;
|
|
32
|
+
margin: 0;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
color: inherit;
|
|
35
|
+
}
|
|
15
36
|
|
|
16
37
|
.ec_right::-webkit-scrollbar {
|
|
17
38
|
display: none;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
2
2
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
|
|
5
|
+
import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
|
|
6
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
7
|
+
import { NGXLogger } from 'ngx-logger';
|
|
3
8
|
import { Globals } from '../../utils/globals';
|
|
4
9
|
|
|
5
10
|
import { EyeeyeCatcherCardComponent } from './eyeeye-catcher-card.component';
|
|
@@ -7,25 +12,102 @@ import { EyeeyeCatcherCardComponent } from './eyeeye-catcher-card.component';
|
|
|
7
12
|
describe('EyeeyeCatcherCardComponent', () => {
|
|
8
13
|
let component: EyeeyeCatcherCardComponent;
|
|
9
14
|
let fixture: ComponentFixture<EyeeyeCatcherCardComponent>;
|
|
15
|
+
let globals: Globals;
|
|
16
|
+
const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error', 'info']);
|
|
10
17
|
|
|
11
18
|
beforeEach(waitForAsync(() => {
|
|
19
|
+
LoggerInstance.setInstance(new CustomLogger(ngxlogger));
|
|
12
20
|
TestBed.configureTestingModule({
|
|
13
|
-
declarations: [
|
|
14
|
-
imports: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
providers: [ Globals ]
|
|
18
|
-
})
|
|
19
|
-
.compileComponents();
|
|
21
|
+
declarations: [EyeeyeCatcherCardComponent],
|
|
22
|
+
imports: [BrowserAnimationsModule],
|
|
23
|
+
providers: [Globals],
|
|
24
|
+
}).compileComponents();
|
|
20
25
|
}));
|
|
21
26
|
|
|
22
27
|
beforeEach(() => {
|
|
23
28
|
fixture = TestBed.createComponent(EyeeyeCatcherCardComponent);
|
|
24
29
|
component = fixture.componentInstance;
|
|
30
|
+
globals = TestBed.inject(Globals);
|
|
31
|
+
globals.initDefafultParameters();
|
|
32
|
+
globals.CALLOUT_TITLE_PLACEHOLDER = '👋 Ciao utente';
|
|
33
|
+
globals.calloutTitle = '';
|
|
34
|
+
globals.calloutMsg = 'Messaggio callout';
|
|
35
|
+
globals.isOpen = false;
|
|
36
|
+
globals.calloutStaus = true;
|
|
37
|
+
spyOn(globals, 'setParameter').and.callThrough();
|
|
25
38
|
fixture.detectChanges();
|
|
26
39
|
});
|
|
27
40
|
|
|
28
41
|
it('should create', () => {
|
|
29
42
|
expect(component).toBeTruthy();
|
|
30
43
|
});
|
|
44
|
+
|
|
45
|
+
describe('ngOnInit and layout state', () => {
|
|
46
|
+
it('should set initial state and hide callout via Globals', () => {
|
|
47
|
+
expect(component.state).toBe('default');
|
|
48
|
+
expect(globals.setParameter).toHaveBeenCalledWith('displayEyeCatcherCard', 'none');
|
|
49
|
+
expect(component.displayEyeCatcherCardCloseBtnWrapper).toBe('none');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should render callout card container with alignment class from Globals', () => {
|
|
53
|
+
globals.align = 'left';
|
|
54
|
+
fixture.detectChanges();
|
|
55
|
+
const card = fixture.debugElement.query(By.css('.eye-catcher-card'));
|
|
56
|
+
expect(card.nativeElement.classList.contains('c21-align-left')).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('openEyeCatcher and outputs', () => {
|
|
61
|
+
it('when chat closed and callout enabled should show card and emit onCloseEyeCatcherCard(true)', () => {
|
|
62
|
+
globals.isOpen = false;
|
|
63
|
+
globals.calloutStaus = true;
|
|
64
|
+
spyOn(component.onCloseEyeCatcherCard, 'emit');
|
|
65
|
+
component.openEyeCatcher();
|
|
66
|
+
expect(component.onCloseEyeCatcherCard.emit).toHaveBeenCalledWith(true);
|
|
67
|
+
expect(globals.setParameter).toHaveBeenCalledWith('displayEyeCatcherCard', 'block');
|
|
68
|
+
expect(component.displayEyeCatcherCardCloseBtnWrapper).toBe('block');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('when chat already open should not emit or display card', () => {
|
|
72
|
+
globals.isOpen = true;
|
|
73
|
+
globals.calloutStaus = true;
|
|
74
|
+
spyOn(component.onCloseEyeCatcherCard, 'emit');
|
|
75
|
+
component.openEyeCatcher();
|
|
76
|
+
expect(component.onCloseEyeCatcherCard.emit).not.toHaveBeenCalled();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('when callout is disabled should not show card even if chat is closed', () => {
|
|
80
|
+
globals.isOpen = false;
|
|
81
|
+
globals.calloutStaus = false;
|
|
82
|
+
spyOn(component.onCloseEyeCatcherCard, 'emit');
|
|
83
|
+
component.openEyeCatcher();
|
|
84
|
+
expect(component.onCloseEyeCatcherCard.emit).not.toHaveBeenCalled();
|
|
85
|
+
expect(component.displayEyeCatcherCardCloseBtnWrapper).toBe('none');
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe('checkIsEmoji, openChatFromEyeCatcherCard, closeEyeCatcherCard', () => {
|
|
90
|
+
it('checkIsEmoji should split leading emoji into emoticon and title', () => {
|
|
91
|
+
globals.calloutTitle = '🚀 Supporto';
|
|
92
|
+
component.checkIsEmoji();
|
|
93
|
+
expect(component.emoticon).toBe('🚀');
|
|
94
|
+
expect(component.title).toContain('Supporto');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('openChatFromEyeCatcherCard should hide card and emit onOpenChat', () => {
|
|
98
|
+
spyOn(component.onOpenChat, 'emit');
|
|
99
|
+
component.openChatFromEyeCatcherCard();
|
|
100
|
+
expect(globals.setParameter).toHaveBeenCalledWith('displayEyeCatcherCard', 'none');
|
|
101
|
+
expect(component.onOpenChat.emit).toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('closeEyeCatcherCard should emit false, hide card and disable callout', () => {
|
|
105
|
+
spyOn(component.onCloseEyeCatcherCard, 'emit');
|
|
106
|
+
component.closeEyeCatcherCard();
|
|
107
|
+
expect(component.onCloseEyeCatcherCard.emit).toHaveBeenCalledWith(false);
|
|
108
|
+
expect(globals.setParameter).toHaveBeenCalledWith('displayEyeCatcherCard', 'none');
|
|
109
|
+
expect(globals.setParameter).toHaveBeenCalledWith('calloutStaus', false, true);
|
|
110
|
+
expect(component.displayEyeCatcherCardCloseBtnWrapper).toBe('none');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
31
113
|
});
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</form>
|
|
40
40
|
|
|
41
41
|
<div class="c21-new-conversation">
|
|
42
|
-
<button [tabindex]="lastTabIndex"
|
|
42
|
+
<button [tabindex]="lastTabIndex" type="button" class="c21-button-primary"
|
|
43
43
|
(click)="onSubmitPreChatForm()"
|
|
44
44
|
(keydown.enter)="onEnterButtonPressed($event)"
|
|
45
45
|
[ngStyle]="{'background-color': stylesMap?.get('themeColor'), 'border-color': stylesMap?.get('themeColor'), 'color': stylesMap?.get('foregroundColor') }">
|
|
@@ -1,43 +1,185 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { SimpleChange } from '@angular/core';
|
|
3
3
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
4
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
|
5
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
5
6
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { FormCheckboxComponent } from '../inputs/form-checkbox/form-checkbox.component';
|
|
8
|
+
import { FormLabelComponent } from '../inputs/form-label/form-label.component';
|
|
9
|
+
import { FormTextComponent } from '../inputs/form-text/form-text.component';
|
|
10
|
+
import { FormTextareaComponent } from '../inputs/form-textarea/form-textarea.component';
|
|
11
|
+
import { clonePrechatFormJsonMock } from '../prechat-form-test-mock';
|
|
12
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
9
13
|
import { CustomLogger } from 'src/chat21-core/providers/logger/customLogger';
|
|
14
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
15
|
+
|
|
16
|
+
import { FormBuilderComponent } from './form-builder.component';
|
|
10
17
|
|
|
11
18
|
describe('FormBuilderComponent', () => {
|
|
12
19
|
let component: FormBuilderComponent;
|
|
13
20
|
let fixture: ComponentFixture<FormBuilderComponent>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
const ngxlogger = jasmine.createSpyObj('NGXLogger', ['log', 'trace', 'debug', 'warn', 'error']);
|
|
22
|
+
const customLogger = new CustomLogger(ngxlogger);
|
|
23
|
+
let origLanguages: PropertyDescriptor | undefined;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
origLanguages = Object.getOwnPropertyDescriptor(navigator, 'languages');
|
|
27
|
+
Object.defineProperty(navigator, 'languages', {
|
|
28
|
+
configurable: true,
|
|
29
|
+
get: () => ['en-US', 'en'],
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
if (origLanguages) {
|
|
35
|
+
Object.defineProperty(navigator, 'languages', origLanguages);
|
|
36
|
+
} else {
|
|
37
|
+
delete (navigator as any).languages;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
17
41
|
beforeEach(waitForAsync(() => {
|
|
18
42
|
TestBed.configureTestingModule({
|
|
19
|
-
declarations: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
declarations: [
|
|
44
|
+
FormBuilderComponent,
|
|
45
|
+
FormTextComponent,
|
|
46
|
+
FormTextareaComponent,
|
|
47
|
+
FormCheckboxComponent,
|
|
48
|
+
FormLabelComponent,
|
|
23
49
|
],
|
|
50
|
+
imports: [CommonModule, ReactiveFormsModule, TranslateModule.forRoot()],
|
|
24
51
|
providers: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
{
|
|
53
|
+
provide: CustomTranslateService,
|
|
54
|
+
useValue: {
|
|
55
|
+
translateLanguage: (keys: string[]) => {
|
|
56
|
+
const m = new Map<string, string>();
|
|
57
|
+
keys.forEach((k: string) => m.set(k, k));
|
|
58
|
+
return m;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}).compileComponents();
|
|
29
64
|
}));
|
|
30
65
|
|
|
31
66
|
beforeEach(() => {
|
|
32
67
|
fixture = TestBed.createComponent(FormBuilderComponent);
|
|
33
68
|
component = fixture.componentInstance;
|
|
34
|
-
LoggerInstance.setInstance(customLogger)
|
|
35
|
-
|
|
36
|
-
component
|
|
37
|
-
|
|
69
|
+
LoggerInstance.setInstance(customLogger);
|
|
70
|
+
component['logger'] = LoggerInstance.getInstance();
|
|
71
|
+
component.stylesMap = new Map([
|
|
72
|
+
['themeColor', '#2a6ac1'],
|
|
73
|
+
['foregroundColor', '#ffffff'],
|
|
74
|
+
]);
|
|
75
|
+
component.isOpenPrechatForm = true;
|
|
38
76
|
});
|
|
39
77
|
|
|
78
|
+
function applyFormArray(arr: any[]) {
|
|
79
|
+
component.formArray = arr;
|
|
80
|
+
component.ngOnChanges({ formArray: new SimpleChange(null, arr, true) } as any);
|
|
81
|
+
fixture.detectChanges();
|
|
82
|
+
}
|
|
83
|
+
|
|
40
84
|
it('should create', () => {
|
|
85
|
+
applyFormArray([]);
|
|
41
86
|
expect(component).toBeTruthy();
|
|
42
87
|
});
|
|
88
|
+
|
|
89
|
+
it('with pre-chat mock should translate labels to English and build validators', () => {
|
|
90
|
+
const mock = clonePrechatFormJsonMock();
|
|
91
|
+
applyFormArray(mock);
|
|
92
|
+
expect(mock[0].text).toBe('User fullname');
|
|
93
|
+
expect(mock[1].text).toBe('Email');
|
|
94
|
+
expect(mock[1].errorLabel).toBe('Invalid email address');
|
|
95
|
+
expect(component.preChatFormGroupCustom.get('userFullname')?.hasError('required')).toBe(true);
|
|
96
|
+
expect(component.preChatFormGroupCustom.valid).toBe(false);
|
|
97
|
+
component.preChatFormGroupCustom.patchValue({
|
|
98
|
+
userFullname: 'John',
|
|
99
|
+
userEmail: 'john@example.com',
|
|
100
|
+
});
|
|
101
|
+
expect(component.preChatFormGroupCustom.valid).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('onSubmitPreChatForm should emit value when form is valid', () => {
|
|
105
|
+
spyOn(component.onSubmitForm, 'emit');
|
|
106
|
+
applyFormArray(clonePrechatFormJsonMock());
|
|
107
|
+
component.preChatFormGroupCustom.patchValue({
|
|
108
|
+
userFullname: 'John',
|
|
109
|
+
userEmail: 'john@example.com',
|
|
110
|
+
});
|
|
111
|
+
component.onSubmitPreChatForm();
|
|
112
|
+
expect(component.onSubmitForm.emit).toHaveBeenCalledWith({
|
|
113
|
+
userFullname: 'John',
|
|
114
|
+
userEmail: 'john@example.com',
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('onSubmitPreChatForm should not emit when invalid but set submitted', () => {
|
|
119
|
+
spyOn(component.onSubmitForm, 'emit');
|
|
120
|
+
applyFormArray(clonePrechatFormJsonMock());
|
|
121
|
+
component.onSubmitPreChatForm();
|
|
122
|
+
expect(component.onSubmitForm.emit).not.toHaveBeenCalled();
|
|
123
|
+
expect(component.submitted).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('onEnterButtonPressed should delegate to submit', () => {
|
|
127
|
+
spyOn(component, 'onSubmitPreChatForm');
|
|
128
|
+
component.onEnterButtonPressed({});
|
|
129
|
+
expect(component.onSubmitPreChatForm).toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('unsupported field type should emit onErrorRenderForm and yield empty group', () => {
|
|
133
|
+
spyOn(component.onErrorRenderForm, 'emit');
|
|
134
|
+
applyFormArray([{ name: 'x', type: 'select', label: { en: 'X' } }]);
|
|
135
|
+
expect(component.onErrorRenderForm.emit).toHaveBeenCalled();
|
|
136
|
+
expect(Object.keys(component.preChatFormGroupCustom.controls)).toEqual([]);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('getAcceptLanguage should pick browser language when keys match navigator.languages', () => {
|
|
140
|
+
const lang = component.getAcceptLanguage({ default: 'fallback', en: 'English', it: 'Italian' } as any);
|
|
141
|
+
expect(lang).toBe('en');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('getAcceptLanguage with non-matching browser languages', () => {
|
|
145
|
+
beforeEach(() => {
|
|
146
|
+
Object.defineProperty(navigator, 'languages', {
|
|
147
|
+
configurable: true,
|
|
148
|
+
get: () => ['xx-XX'],
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
afterEach(() => {
|
|
152
|
+
Object.defineProperty(navigator, 'languages', {
|
|
153
|
+
configurable: true,
|
|
154
|
+
get: () => ['en-US', 'en'],
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('should return default when present and no other key matches', () => {
|
|
159
|
+
const lang = component.getAcceptLanguage({ default: 'fallback', fr: 'Français' } as any);
|
|
160
|
+
expect(lang).toBe('default');
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('onResetForm should clear submitted flag and reset controls', () => {
|
|
165
|
+
applyFormArray(clonePrechatFormJsonMock());
|
|
166
|
+
component.preChatFormGroupCustom.patchValue({
|
|
167
|
+
userFullname: 'John',
|
|
168
|
+
userEmail: 'john@example.com',
|
|
169
|
+
});
|
|
170
|
+
component.onSubmitPreChatForm();
|
|
171
|
+
expect(component.submitted).toBe(true);
|
|
172
|
+
component.onResetForm();
|
|
173
|
+
expect(component.submitted).toBe(false);
|
|
174
|
+
expect(component.preChatFormGroupCustom.value).toEqual({
|
|
175
|
+
userFullname: null,
|
|
176
|
+
userEmail: null,
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('should render text inputs from mock in the template', () => {
|
|
181
|
+
applyFormArray(clonePrechatFormJsonMock());
|
|
182
|
+
const inputs = fixture.nativeElement.querySelectorAll('input[type="text"], input[type="email"]');
|
|
183
|
+
expect(inputs.length).toBeGreaterThanOrEqual(2);
|
|
184
|
+
});
|
|
43
185
|
});
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<form [formGroup]="form">
|
|
2
2
|
<div class="c21-body-header-checkbox">
|
|
3
|
-
<input class="form-check-input errors"
|
|
4
|
-
type="checkbox"
|
|
3
|
+
<input class="form-check-input errors"
|
|
4
|
+
type="checkbox"
|
|
5
|
+
[id]="fieldBaseId"
|
|
5
6
|
[formControlName]="element?.name"
|
|
6
7
|
[checked]="element?.value"
|
|
7
8
|
[tabIndex]="element?.tabIndex"
|
|
8
9
|
[ngClass]="{'errors': hasSubmitted && form.controls[element?.name].errors}"
|
|
10
|
+
[attr.aria-required]="element?.mandatory ? 'true' : null"
|
|
11
|
+
[attr.aria-invalid]="ariaInvalid"
|
|
12
|
+
[attr.aria-describedby]="ariaDescribedByErrors"
|
|
9
13
|
(keydown.enter)="onEnterPressed($event)">
|
|
10
|
-
<label class="c21-form-message-field">{{element?.text}}</label>
|
|
11
|
-
<div *ngIf="hasSubmitted && form.get(element?.name)
|
|
14
|
+
<label class="c21-form-message-field" [attr.for]="fieldBaseId">{{element?.text}}</label>
|
|
15
|
+
<div [id]="errorsId" *ngIf="hasSubmitted && form.get(element?.name)?.errors" class="text-danger" role="alert">
|
|
12
16
|
{{translationErrorLabelMap.get('LABEL_ERROR_FIELD_REQUIRED')}}
|
|
13
17
|
</div>
|
|
14
18
|
</div>
|
|
@@ -40,7 +40,7 @@ input[type="checkbox"] {
|
|
|
40
40
|
|
|
41
41
|
// /* hover state */
|
|
42
42
|
input[type="checkbox"]:not(:checked):hover,
|
|
43
|
-
input[type="checkbox"]:not(:checked):focus {
|
|
43
|
+
input[type="checkbox"]:not(:checked):focus:not(:focus-visible) {
|
|
44
44
|
border-width: 2px;
|
|
45
45
|
|
|
46
46
|
//box-shadow
|
|
@@ -59,10 +59,15 @@ input[type="checkbox"]:active:not(:disabled) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// /* focus state */
|
|
62
|
-
input[type="radio"]:focus,
|
|
63
|
-
input[type="checkbox"]:focus {
|
|
64
|
-
outline:none;
|
|
65
|
-
|
|
62
|
+
input[type="radio"]:focus:not(:focus-visible),
|
|
63
|
+
input[type="checkbox"]:focus:not(:focus-visible) {
|
|
64
|
+
outline: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
input[type="radio"]:focus-visible,
|
|
68
|
+
input[type="checkbox"]:focus-visible {
|
|
69
|
+
outline: 2px solid var(--themeColor, #1a73e8);
|
|
70
|
+
outline-offset: 2px;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
// /* input checked border color */
|