@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,28 +1,124 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Injectable, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
2
5
|
import { AppStorageService } from '../../../chat21-core/providers/abstract/app-storage.service';
|
|
6
|
+
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
3
7
|
import { Globals } from '../../utils/globals';
|
|
4
|
-
|
|
5
8
|
import { LauncherButtonComponent } from './launcher-button.component';
|
|
6
9
|
|
|
10
|
+
@Injectable()
|
|
11
|
+
class AppStorageStub extends AppStorageService {
|
|
12
|
+
initialize(): void {}
|
|
13
|
+
getItem(): any {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
setItem(): void {}
|
|
17
|
+
getItemWithoutProjectID(): any {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
setItemWithoutProjectID(): void {}
|
|
21
|
+
removeItem(): void {}
|
|
22
|
+
clear(): void {}
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
describe('LauncherButtonComponent', () => {
|
|
8
|
-
let component: LauncherButtonComponent;
|
|
9
26
|
let fixture: ComponentFixture<LauncherButtonComponent>;
|
|
27
|
+
let component: LauncherButtonComponent;
|
|
28
|
+
let globals: Globals;
|
|
10
29
|
|
|
11
30
|
beforeEach(waitForAsync(() => {
|
|
12
31
|
TestBed.configureTestingModule({
|
|
13
|
-
declarations: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
declarations: [LauncherButtonComponent],
|
|
33
|
+
imports: [NoopAnimationsModule],
|
|
34
|
+
providers: [Globals, { provide: AppStorageService, useClass: AppStorageStub }],
|
|
35
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
36
|
+
}).compileComponents();
|
|
17
37
|
}));
|
|
18
38
|
|
|
19
39
|
beforeEach(() => {
|
|
20
40
|
fixture = TestBed.createComponent(LauncherButtonComponent);
|
|
21
41
|
component = fixture.componentInstance;
|
|
22
|
-
|
|
42
|
+
globals = TestBed.inject(Globals);
|
|
43
|
+
globals.initDefafultParameters();
|
|
44
|
+
globals.isOpen = false;
|
|
45
|
+
globals.align = 'right';
|
|
46
|
+
globals.marginX = '20px';
|
|
47
|
+
globals.marginY = '24px';
|
|
48
|
+
globals.themeColor = '#2a6ac1';
|
|
49
|
+
globals.themeForegroundColor = '#ffffff';
|
|
50
|
+
globals.launcherWidth = '60px';
|
|
51
|
+
globals.launcherHeight = '60px';
|
|
52
|
+
globals.baloonShape = '50%';
|
|
53
|
+
globals.baloonImage = '';
|
|
23
54
|
});
|
|
24
55
|
|
|
25
56
|
it('should create', () => {
|
|
26
57
|
expect(component).toBeTruthy();
|
|
27
58
|
});
|
|
59
|
+
|
|
60
|
+
it('mostra il pulsante quando il widget è chiuso (isOpen=false)', () => {
|
|
61
|
+
fixture.detectChanges();
|
|
62
|
+
const btn = fixture.debugElement.query(By.css('#c21-launcher-button'));
|
|
63
|
+
expect(btn).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('non mostra il launcher quando il widget è aperto', () => {
|
|
67
|
+
globals.isOpen = true;
|
|
68
|
+
fixture.detectChanges();
|
|
69
|
+
expect(fixture.debugElement.query(By.css('#c21-launcher-button'))).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('applica border-radius da baloonShape e dimensioni da launcherWidth/Height', () => {
|
|
73
|
+
globals.baloonShape = '12px 4px 18px 8px';
|
|
74
|
+
globals.launcherWidth = '72px';
|
|
75
|
+
globals.launcherHeight = '80px';
|
|
76
|
+
fixture.detectChanges();
|
|
77
|
+
const btn = fixture.debugElement.query(By.css('#c21-launcher-button')).nativeElement as HTMLElement;
|
|
78
|
+
expect(btn.style.borderRadius).toBe('12px 4px 18px 8px');
|
|
79
|
+
expect(btn.style.width).toBe('72px');
|
|
80
|
+
expect(btn.style.height).toBe('80px');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('con baloonImage: sfondo pulsante null e immagine con stesso border-radius', () => {
|
|
84
|
+
globals.baloonImage = 'https://cdn.example/launcher.svg';
|
|
85
|
+
globals.baloonShape = '8px';
|
|
86
|
+
fixture.detectChanges();
|
|
87
|
+
const btn = fixture.debugElement.query(By.css('#c21-launcher-button')).nativeElement as HTMLElement;
|
|
88
|
+
expect(btn.style.backgroundColor === '' || btn.style.backgroundColor === 'rgba(0, 0, 0, 0)').toBe(true);
|
|
89
|
+
const img = fixture.debugElement.query(By.css('img')).nativeElement as HTMLImageElement;
|
|
90
|
+
expect(img.src).toContain('launcher.svg');
|
|
91
|
+
expect(img.style.borderRadius).toBe('8px');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('senza baloonImage: usa themeColor come background e classe allineamento sinistro', () => {
|
|
95
|
+
globals.baloonImage = '';
|
|
96
|
+
globals.align = 'left';
|
|
97
|
+
globals.themeColor = '#ff0000';
|
|
98
|
+
fixture.detectChanges();
|
|
99
|
+
const btn = fixture.debugElement.query(By.css('#c21-launcher-button')).nativeElement as HTMLElement;
|
|
100
|
+
expect(btn.style.backgroundColor).not.toBe('');
|
|
101
|
+
expect(btn.classList.contains('c21-align-left')).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('ngAfterViewInit imposta box-shadow quando widget chiuso', fakeAsync(() => {
|
|
105
|
+
globals.isOpen = false;
|
|
106
|
+
fixture.detectChanges();
|
|
107
|
+
tick(0);
|
|
108
|
+
const btn = fixture.debugElement.query(By.css('#c21-launcher-button'))?.nativeElement as HTMLElement;
|
|
109
|
+
expect(btn).toBeTruthy();
|
|
110
|
+
const shadow = btn.style.boxShadow.replace(/\s/g, '');
|
|
111
|
+
expect(shadow).toContain('0px4px20px');
|
|
112
|
+
expect(shadow).toContain(convertColorToRGBA(globals.themeColor, 50).replace(/\s/g, ''));
|
|
113
|
+
}));
|
|
114
|
+
|
|
115
|
+
it('openCloseWidget emette lo stato corrente di isOpen', () => {
|
|
116
|
+
globals.isOpen = false;
|
|
117
|
+
spyOn(component.onButtonClicked, 'emit');
|
|
118
|
+
component.openCloseWidget();
|
|
119
|
+
expect(component.onButtonClicked.emit).toHaveBeenCalledWith(false);
|
|
120
|
+
globals.isOpen = true;
|
|
121
|
+
component.openCloseWidget();
|
|
122
|
+
expect(component.onButtonClicked.emit).toHaveBeenCalledWith(true);
|
|
123
|
+
});
|
|
28
124
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<div id='c21-app-list-all-conversations'
|
|
2
|
-
|
|
1
|
+
<div id='c21-app-list-all-conversations'
|
|
2
|
+
role="region"
|
|
3
|
+
[attr.aria-label]="g?.project?.widgetTitle || 'Conversations history'">
|
|
3
4
|
|
|
4
5
|
<!-- HEADER -->
|
|
5
6
|
<div class="c21-header" [ngStyle]="{'color': g.themeForegroundColor, 'background-image': g.colorGradient180 }">
|
|
@@ -7,12 +8,11 @@
|
|
|
7
8
|
<!-- CONTENT HEADER -->
|
|
8
9
|
<div class="c21-header-content">
|
|
9
10
|
<!-- ICON CLOSE CHAT -->
|
|
10
|
-
<div class="c21-header-button c21-right c21-close">
|
|
11
|
-
<svg
|
|
11
|
+
<div class="c21-header-button c21-right c21-close" [attr.aria-label]="g.BUTTON_CLOSE_TO_ICON" role="img">
|
|
12
|
+
<svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': g.themeForegroundColor }" xmlns="http://www.w3.org/2000/svg"
|
|
12
13
|
width="24px" height="24px" viewBox="0 0 24 24">
|
|
13
14
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
|
14
15
|
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
|
|
15
|
-
<title id="altIconTitle">{{g.BUTTON_CLOSE_TO_ICON}}</title>
|
|
16
16
|
</svg>
|
|
17
17
|
</div>
|
|
18
18
|
|
|
@@ -54,26 +54,21 @@
|
|
|
54
54
|
</div> -->
|
|
55
55
|
|
|
56
56
|
<!-- ICON BACK -->
|
|
57
|
-
<button
|
|
58
|
-
|
|
57
|
+
<button type="button"
|
|
58
|
+
[attr.aria-label]="g.PREV_CONVERSATIONS"
|
|
59
|
+
class="c21-header-button c21-left c21-button-clean"
|
|
60
|
+
(click)="returnClosePage()">
|
|
61
|
+
<svg aria-hidden="true" focusable="false" [ngStyle]="{'fill': g.themeForegroundColor }" xmlns="http://www.w3.org/2000/svg"
|
|
59
62
|
width="24px" height="24px" viewBox="0 0 24 24">
|
|
60
|
-
<!-- <path fill="none" d="M0 0h24v24H0V0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7.07 18.28c.43-.9 3.05-1.78 4.93-1.78s4.51.88 4.93 1.78C15.57 19.36 13.86 20 12 20s-3.57-.64-4.93-1.72zm11.29-1.45c-1.43-1.74-4.9-2.33-6.36-2.33s-4.93.59-6.36 2.33C4.62 15.49 4 13.82 4 12c0-4.41 3.59-8 8-8s8 3.59 8 8c0 1.82-.62 3.49-1.64 4.83zM12 6c-1.94 0-3.5 1.56-3.5 3.5S10.06 13 12 13s3.5-1.56 3.5-3.5S13.94 6 12 6zm0 5c-.83 0-1.5-.67-1.5-1.5S11.17 8 12 8s1.5.67 1.5 1.5S12.83 11 12 11z"/> -->
|
|
61
63
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
|
62
64
|
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z" />
|
|
63
|
-
<title id="altIconTitle">{{g.PREV_CONVERSATIONS}}</title>
|
|
64
65
|
</svg>
|
|
65
66
|
</button>
|
|
66
67
|
|
|
67
68
|
<!-- TITLE HEADER -->
|
|
68
69
|
<div class="c21-title" [ngStyle]="{'color': g.themeForegroundColor}">
|
|
69
|
-
|
|
70
|
-
<div *ngIf="g.project.logoChat == 'tiledesklogo'" #avatarPlaceholder class="avatar-placeholder" [style.background-color]="g.project.color" [innerHTML]="g.project.avatar"></div>
|
|
71
|
-
<div *ngIf="g.project.logoChat !== 'tiledesklogo'" #avatarImage class="avatar-image" [style.background-image]="'url(' + g.project.logoChat + ')'"></div>
|
|
72
|
-
</div> -->
|
|
73
|
-
<div class="titleText">{{g.project.widgetTitle}}</div>
|
|
74
|
-
<!-- <span id="agent-available-status">{{areAgentsAvailableText}}</span> -->
|
|
70
|
+
<h2 class="titleText">{{g.project.widgetTitle}}</h2>
|
|
75
71
|
</div>
|
|
76
|
-
<!-- <p class="c21-header-writing">{{writingMessage}}</p> -->
|
|
77
72
|
|
|
78
73
|
</div>
|
|
79
74
|
|
|
@@ -82,7 +77,7 @@
|
|
|
82
77
|
</div>
|
|
83
78
|
|
|
84
79
|
<!-- CONTENT -->
|
|
85
|
-
<div class="c21-body"
|
|
80
|
+
<div class="c21-body">
|
|
86
81
|
|
|
87
82
|
<chat-list-conversations
|
|
88
83
|
[listConversations]="allConversations"
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
<div id='c21-app-list-conversations'>
|
|
2
|
-
<div *ngFor="let conversation of listConversations | slice:0:limit">
|
|
3
|
-
<button
|
|
1
|
+
<div id='c21-app-list-conversations' role="list">
|
|
2
|
+
<div *ngFor="let conversation of listConversations | slice:0:limit" role="listitem">
|
|
3
|
+
<button type="button"
|
|
4
|
+
class="c21-item-conversation"
|
|
5
|
+
[attr.aria-label]="conversation?.sender_fullname + ': ' + conversation.last_message_text"
|
|
6
|
+
(click)="openConversationByID(conversation)">
|
|
4
7
|
<div class="c21-body-conv">
|
|
5
8
|
<div class="c21-left-conv">
|
|
6
9
|
<div class="c21-ball" [ngStyle]="{'background': isImageLoaded(conversation) ? 'transparent' : 'linear-gradient(rgb(255,255,255) -125%, ' + conversation.color + ')'}">
|
|
7
|
-
<span *ngIf="!isImageLoaded(conversation)" class="c21-ball-label">{{conversation?.avatar}}</span>
|
|
8
|
-
<img *ngIf="conversation?.image"
|
|
9
|
-
[src]="conversation.image"
|
|
10
|
+
<span *ngIf="!isImageLoaded(conversation)" class="c21-ball-label" aria-hidden="true">{{conversation?.avatar}}</span>
|
|
11
|
+
<img *ngIf="conversation?.image"
|
|
12
|
+
[src]="conversation.image"
|
|
13
|
+
alt=""
|
|
10
14
|
style="display: none;"
|
|
11
15
|
(load)="onImageLoad(conversation)"
|
|
12
16
|
(error)="onImageError(conversation)">
|
|
@@ -16,21 +20,19 @@
|
|
|
16
20
|
<div class="c21-right-conv">
|
|
17
21
|
<div class="c21-last-time">{{conversation?.timestamp | dateAgo}}</div>
|
|
18
22
|
<div class="truncate c21-name">{{conversation?.sender_fullname }}</div>
|
|
19
|
-
|
|
23
|
+
|
|
20
24
|
<!-- --- IMAGE PREVIEW ICON ---- -->
|
|
21
25
|
<div *ngIf="conversation?.type ==='image'" [class.not-read]="conversation?.is_new" class="c21-msg" style="float: left; margin-right: 5px;">
|
|
22
|
-
<svg
|
|
26
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" fill="#000000"
|
|
23
27
|
width="20px" height="20px" viewBox="0 0 24 24">
|
|
24
28
|
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
25
29
|
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
|
|
26
30
|
</svg>
|
|
27
31
|
</div>
|
|
28
|
-
|
|
29
|
-
<!-- <div [class.not-read]="conversation.is_new" class="truncate c21-msg" [innerHTML]="conversation.last_message_text"></div> -->
|
|
30
|
-
|
|
32
|
+
|
|
31
33
|
<!-- --- ATTACHMENT ICON ---- -->
|
|
32
34
|
<div *ngIf="conversation.type !== 'image' && conversation.type !== 'text'" [class.not-read]="conversation.is_new" class="c21-msg" style="float: left; margin-right: 5px;">
|
|
33
|
-
<svg
|
|
35
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" fill="#000000"
|
|
34
36
|
width="20px" height="20px" viewBox="0 0 24 24" transform="rotate(45)">
|
|
35
37
|
<path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z" />
|
|
36
38
|
</svg>
|
|
@@ -38,25 +40,23 @@
|
|
|
38
40
|
|
|
39
41
|
<!-- --- LAST MESSAGE ---- -->
|
|
40
42
|
<div [class.not-read]="conversation.is_new" [class.archived]="conversation.archived" class="truncate c21-msg">{{conversation.last_message_text}}</div>
|
|
41
|
-
<!-- <div *ngIf="conversation.type !=='image'" [class.not-read]="conversation.is_new" [class.archived]="conversation.archived" class="truncate c21-msg" [innerHTML]="conversation.last_message_text"></div> -->
|
|
42
43
|
</div>
|
|
43
|
-
|
|
44
|
-
<div *ngIf="conversation.is_new" [ngStyle]
|
|
45
|
-
<div
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<svg role="img" aria-labelledby="altIconTitle" xmlns="http://www.w3.org/2000/svg" fill="#aaaaaa"
|
|
44
|
+
|
|
45
|
+
<div *ngIf="conversation.is_new" [ngStyle]="{ 'background-color': stylesMap.get('themeColor') }" class="c21-divBudge" aria-hidden="true">{{conversation.badge}}</div>
|
|
46
|
+
<div class="c21-icon-archived-chat" *ngIf="conversation.archived">
|
|
47
|
+
<span class="c21-header-button c21-right c21-close" [attr.aria-label]="translationMap.get('CLOSED')" role="img">
|
|
48
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" fill="#aaaaaa"
|
|
49
49
|
width="24px" height="24px" viewBox="0 0 24 24">
|
|
50
50
|
<path fill="none" d="M0 0h24v24H0z"/>
|
|
51
51
|
<path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"/>
|
|
52
|
-
<title id="altIconTitle">{{ translationMap.get('CLOSED') }}</title>
|
|
53
52
|
</svg>
|
|
54
|
-
</
|
|
53
|
+
</span>
|
|
55
54
|
</div>
|
|
56
55
|
</div>
|
|
57
56
|
<div class="clear"></div>
|
|
58
57
|
</button>
|
|
59
|
-
|
|
58
|
+
|
|
60
59
|
</div>
|
|
61
60
|
</div>
|
|
62
61
|
|
|
62
|
+
|
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
<div id='c21-menu-options'>
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<button type="button"
|
|
3
|
+
class="button-menu-options c21-button-clean"
|
|
4
|
+
[attr.aria-label]="g.OPTIONS"
|
|
5
|
+
[attr.aria-expanded]="g.isOpenMenuOptions ? 'true' : 'false'"
|
|
6
|
+
aria-haspopup="true"
|
|
7
|
+
(click)="f21_toggle_options()"
|
|
8
|
+
(mouseover)="isHover=true"
|
|
9
|
+
(mouseleave)="isHover=false">
|
|
10
|
+
<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" width="24px" viewBox="0 0 24 24" [ngStyle]="{'display': (isHover || g.isOpenMenuOptions)? 'block': 'none'}">
|
|
4
11
|
<g>
|
|
5
12
|
<path d="M0,0h24v24H0V0z" fill="none"/>
|
|
6
13
|
<path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/>
|
|
7
14
|
</g>
|
|
8
15
|
</svg>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<div *ngIf="g.isOpenMenuOptions" class="modal-menu-options">
|
|
16
|
+
</button>
|
|
17
|
+
<div *ngIf="g.isOpenMenuOptions"
|
|
18
|
+
class="modal-menu-options"
|
|
19
|
+
role="group"
|
|
20
|
+
[attr.aria-label]="g.OPTIONS"
|
|
21
|
+
(keydown.escape)="$event.preventDefault(); $event.stopPropagation(); f21_toggle_options()">
|
|
16
22
|
<div class="">
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
<button type="button"
|
|
25
|
+
class="c21-button c21-button-clean"
|
|
26
|
+
[attr.aria-pressed]="g.soundEnabled ? 'true' : 'false'"
|
|
27
|
+
[attr.aria-label]="g.soundEnabled ? g.SOUND_ON : g.SOUND_OFF"
|
|
28
|
+
(click)="toggleSound()">
|
|
29
|
+
<svg *ngIf="!g.soundEnabled" aria-hidden="true" focusable="false" class="icon-menu" xmlns="http://www.w3.org/2000/svg"
|
|
20
30
|
width="20" height="20" viewBox="0 0 24 24">
|
|
21
31
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
|
22
32
|
<path d="M4.34 2.93L2.93 4.34 7.29 8.7 7 9H3v6h4l5 5v-6.59l4.18 4.18c-.65.49-1.38.88-2.18 1.11v2.06c1.34-.3 2.57-.92 3.61-1.75l2.05 2.05 1.41-1.41L4.34 2.93zM10 15.17L7.83 13H5v-2h2.83l.88-.88L10 11.41v3.76zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zm-7-8l-1.88 1.88L12 7.76zm4.5 8c0-1.77-1.02-3.29-2.5-4.03v1.79l2.48 2.48c.01-.08.02-.16.02-.24z" />
|
|
23
|
-
<title id="altIconTitle">{{g.SOUND_OFF}}</title>
|
|
24
33
|
</svg>
|
|
25
|
-
<svg *ngIf="g.soundEnabled" aria-
|
|
34
|
+
<svg *ngIf="g.soundEnabled" aria-hidden="true" focusable="false" class="icon-menu" xmlns="http://www.w3.org/2000/svg"
|
|
26
35
|
width="20" height="20" viewBox="0 0 24 24">
|
|
27
36
|
<path fill="none" d="M0 0h24v24H0V0z" />
|
|
28
37
|
<path d="M3 9v6h4l5 5V4L7 9H3zm7-.17v6.34L7.83 13H5v-2h2.83L10 8.83zM16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77 0-4.28-2.99-7.86-7-8.77z" />
|
|
29
|
-
<title id="altIconTitle">{{g.SOUND_ON}}</title>
|
|
30
38
|
</svg>
|
|
31
39
|
<span *ngIf="!g.soundEnabled" class="label-menu-item"> {{g.SOUND_OFF}}</span>
|
|
32
40
|
<span *ngIf="g.soundEnabled" class="label-menu-item"> {{g.SOUND_ON}}</span>
|
|
33
41
|
|
|
34
|
-
</
|
|
35
|
-
<
|
|
36
|
-
|
|
42
|
+
</button>
|
|
43
|
+
<button type="button"
|
|
44
|
+
class="c21-button c21-button-clean" *ngIf="g.isLogged && g.showLogoutOption"
|
|
45
|
+
[attr.aria-label]="g.LOGOUT"
|
|
46
|
+
(click)="signOut()">
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="icon-menu">
|
|
37
48
|
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
38
49
|
<path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>
|
|
39
|
-
<title id="altIconTitle">{{g.LOGOUT}}</title>
|
|
40
50
|
</svg>
|
|
41
51
|
<span *ngIf="g.isLogged && g.showLogoutOption" class="label-menu-item"> {{g.LOGOUT}}</span>
|
|
42
|
-
</
|
|
52
|
+
</button>
|
|
43
53
|
<div class="c21-button build_version_menu">
|
|
44
54
|
<span class="label-menu-item"> {{g.BUILD_VERSION}}</span>
|
|
45
55
|
</div>
|
|
@@ -1,27 +1,143 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
|
|
2
5
|
import { Globals } from '../../utils/globals';
|
|
3
|
-
|
|
4
6
|
import { MenuOptionsComponent } from './menu-options.component';
|
|
5
7
|
|
|
6
8
|
describe('MenuOptionsComponent', () => {
|
|
7
|
-
let component: MenuOptionsComponent;
|
|
8
9
|
let fixture: ComponentFixture<MenuOptionsComponent>;
|
|
10
|
+
let component: MenuOptionsComponent;
|
|
11
|
+
let globals: Globals;
|
|
9
12
|
|
|
10
|
-
beforeEach(
|
|
13
|
+
beforeEach(waitForAsync(() => {
|
|
11
14
|
TestBed.configureTestingModule({
|
|
12
|
-
declarations: [
|
|
13
|
-
providers: [
|
|
14
|
-
|
|
15
|
-
.compileComponents();
|
|
15
|
+
declarations: [MenuOptionsComponent],
|
|
16
|
+
providers: [Globals],
|
|
17
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
18
|
+
}).compileComponents();
|
|
16
19
|
}));
|
|
17
20
|
|
|
18
21
|
beforeEach(() => {
|
|
19
22
|
fixture = TestBed.createComponent(MenuOptionsComponent);
|
|
20
23
|
component = fixture.componentInstance;
|
|
21
|
-
|
|
24
|
+
globals = TestBed.inject(Globals);
|
|
25
|
+
globals.initDefafultParameters();
|
|
26
|
+
globals.OPTIONS = 'Opzioni';
|
|
27
|
+
globals.SOUND_ON = 'Suono on';
|
|
28
|
+
globals.SOUND_OFF = 'Suono off';
|
|
29
|
+
globals.LOGOUT = 'Esci';
|
|
30
|
+
globals.BUILD_VERSION = 'v9.9.9-test';
|
|
31
|
+
globals.themeColor = '#2a6ac1';
|
|
32
|
+
globals.soundEnabled = true;
|
|
33
|
+
globals.isOpenMenuOptions = false;
|
|
34
|
+
globals.isLogged = false;
|
|
35
|
+
globals.showLogoutOption = true;
|
|
22
36
|
});
|
|
23
37
|
|
|
24
38
|
it('should create', () => {
|
|
25
39
|
expect(component).toBeTruthy();
|
|
26
40
|
});
|
|
41
|
+
|
|
42
|
+
it('ngOnInit calcola themeColor50 da themeColor', () => {
|
|
43
|
+
fixture.detectChanges();
|
|
44
|
+
expect(component.themeColor50).toBe(convertColorToRGBA(globals.themeColor, 50));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('f21_toggle_options apre e chiude il menu', () => {
|
|
48
|
+
fixture.detectChanges();
|
|
49
|
+
const toggle = fixture.debugElement.query(By.css('.button-menu-options'));
|
|
50
|
+
toggle.triggerEventHandler('click', null);
|
|
51
|
+
expect(globals.isOpenMenuOptions).toBe(true);
|
|
52
|
+
fixture.detectChanges();
|
|
53
|
+
expect(fixture.debugElement.query(By.css('.modal-menu-options'))).toBeTruthy();
|
|
54
|
+
component.f21_toggle_options();
|
|
55
|
+
expect(globals.isOpenMenuOptions).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('toggleSound inverte soundEnabled e chiude il menu', () => {
|
|
59
|
+
globals.soundEnabled = false;
|
|
60
|
+
globals.isOpenMenuOptions = true;
|
|
61
|
+
fixture.detectChanges();
|
|
62
|
+
component.toggleSound();
|
|
63
|
+
expect(globals.soundEnabled).toBe(true);
|
|
64
|
+
expect(globals.isOpenMenuOptions).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('signOut emette onSignOut e chiude il menu', () => {
|
|
68
|
+
spyOn(component.onSignOut, 'emit');
|
|
69
|
+
globals.isOpenMenuOptions = true;
|
|
70
|
+
component.signOut();
|
|
71
|
+
expect(globals.isOpenMenuOptions).toBe(false);
|
|
72
|
+
expect(component.onSignOut.emit).toHaveBeenCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('menu aperto: etichette suono e versione visibili', () => {
|
|
76
|
+
globals.isOpenMenuOptions = true;
|
|
77
|
+
globals.soundEnabled = true;
|
|
78
|
+
fixture.detectChanges();
|
|
79
|
+
const root = fixture.nativeElement as HTMLElement;
|
|
80
|
+
expect(root.textContent).toContain('Suono on');
|
|
81
|
+
expect(root.textContent).toContain('v9.9.9-test');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('logout visibile solo con isLogged e showLogoutOption', () => {
|
|
85
|
+
globals.isOpenMenuOptions = true;
|
|
86
|
+
globals.isLogged = false;
|
|
87
|
+
globals.showLogoutOption = true;
|
|
88
|
+
fixture.detectChanges();
|
|
89
|
+
let logoutBtn = fixture.debugElement.queryAll(By.css('.modal-menu-options button')).find((d) =>
|
|
90
|
+
(d.nativeElement as HTMLElement).getAttribute('aria-label')?.includes('Esci'),
|
|
91
|
+
);
|
|
92
|
+
expect(logoutBtn).toBeFalsy();
|
|
93
|
+
|
|
94
|
+
globals.isLogged = true;
|
|
95
|
+
fixture.detectChanges();
|
|
96
|
+
logoutBtn = fixture.debugElement.queryAll(By.css('.modal-menu-options button')).find((d) =>
|
|
97
|
+
(d.nativeElement as HTMLElement).getAttribute('aria-label') === 'Esci',
|
|
98
|
+
);
|
|
99
|
+
expect(logoutBtn).toBeTruthy();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('isHover espone l’icona ingranaggio (mouseover / mouseleave)', () => {
|
|
103
|
+
fixture.detectChanges();
|
|
104
|
+
const toggle = fixture.debugElement.query(By.css('.button-menu-options'));
|
|
105
|
+
expect(component.isHover).toBe(false);
|
|
106
|
+
toggle.triggerEventHandler('mouseover', null);
|
|
107
|
+
expect(component.isHover).toBe(true);
|
|
108
|
+
toggle.triggerEventHandler('mouseleave', null);
|
|
109
|
+
expect(component.isHover).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('aria-expanded del toggle riflette isOpenMenuOptions', () => {
|
|
113
|
+
globals.isOpenMenuOptions = true;
|
|
114
|
+
fixture.detectChanges();
|
|
115
|
+
const btn = fixture.debugElement.query(By.css('.button-menu-options')).nativeElement as HTMLButtonElement;
|
|
116
|
+
expect(btn.getAttribute('aria-expanded')).toBe('true');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('keydown escape sul pannello opzioni chiude il menu', () => {
|
|
120
|
+
globals.isOpenMenuOptions = true;
|
|
121
|
+
fixture.detectChanges();
|
|
122
|
+
const modal = fixture.debugElement.query(By.css('.modal-menu-options'));
|
|
123
|
+
const ev = new KeyboardEvent('keydown', { key: 'Escape' });
|
|
124
|
+
spyOn(ev, 'preventDefault');
|
|
125
|
+
spyOn(ev, 'stopPropagation');
|
|
126
|
+
modal.triggerEventHandler('keydown.escape', ev);
|
|
127
|
+
expect(globals.isOpenMenuOptions).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('pulsante suono espone aria-pressed e aria-label in base a soundEnabled', () => {
|
|
131
|
+
globals.isOpenMenuOptions = true;
|
|
132
|
+
globals.soundEnabled = false;
|
|
133
|
+
fixture.detectChanges();
|
|
134
|
+
const soundBtn = fixture.debugElement.query(By.css('button[aria-label="Suono off"]'))
|
|
135
|
+
.nativeElement as HTMLButtonElement;
|
|
136
|
+
expect(soundBtn.getAttribute('aria-pressed')).toBe('false');
|
|
137
|
+
globals.soundEnabled = true;
|
|
138
|
+
fixture.detectChanges();
|
|
139
|
+
const soundOn = fixture.debugElement.query(By.css('button[aria-label="Suono on"]'))
|
|
140
|
+
.nativeElement as HTMLButtonElement;
|
|
141
|
+
expect(soundOn.getAttribute('aria-pressed')).toBe('true');
|
|
142
|
+
});
|
|
27
143
|
});
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
<!-- <audio *ngIf="metadata" controls>
|
|
3
|
-
<source [src]="metadata.src" type="audio/mpeg">
|
|
4
|
-
</audio> *ngIf="!metadata"-->
|
|
5
1
|
<div class="audio-container">
|
|
6
|
-
|
|
2
|
+
|
|
7
3
|
<div class="audio-track">
|
|
8
|
-
<button
|
|
9
|
-
|
|
4
|
+
<button type="button"
|
|
5
|
+
class="play-pause"
|
|
6
|
+
[attr.aria-label]="isPlaying
|
|
7
|
+
? (translationMap?.get('BUTTON_PAUSE_AUDIO') || 'Pause audio')
|
|
8
|
+
: (translationMap?.get('BUTTON_PLAY_AUDIO') || 'Play audio')"
|
|
9
|
+
[attr.aria-pressed]="isPlaying ? 'true' : 'false'"
|
|
10
|
+
(click)="playPauseAudio()">
|
|
11
|
+
<svg *ngIf="!isPlaying" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" aria-hidden="true" focusable="false">
|
|
10
12
|
<path d="M320-200v-560l440 280-440 280Z"/>
|
|
11
13
|
</svg>
|
|
12
|
-
|
|
13
|
-
</button>
|
|
14
|
-
<button *ngIf="isPlaying" class="play-pause" (click)="playPauseAudio()">
|
|
15
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" >
|
|
14
|
+
<svg *ngIf="isPlaying" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" aria-hidden="true" focusable="false">
|
|
16
15
|
<path d="M560-200v-560h160v560H560Zm-320 0v-560h160v560H240Z"/>
|
|
17
16
|
</svg>
|
|
18
|
-
<!-- <i class="material-icons">pause</i> -->
|
|
19
17
|
</button>
|
|
20
|
-
<div class="duration" [style.color]="color">
|
|
18
|
+
<div class="duration" [style.color]="color" aria-live="off">
|
|
21
19
|
<span *ngIf="!isPlaying">{{ audioDuration ? formatTime(audioDuration) : '00:00' }}</span>
|
|
22
20
|
<span *ngIf="isPlaying">{{ formatTime(currentTime) }}</span>
|
|
23
21
|
</div>
|
|
@@ -26,7 +24,7 @@
|
|
|
26
24
|
|
|
27
25
|
<div class="audio-player-custom">
|
|
28
26
|
<audio #audioElement [src]="audioUrl"></audio>
|
|
29
|
-
<canvas #canvasElement class="waveformCanvas"></canvas>
|
|
27
|
+
<canvas #canvasElement class="waveformCanvas" aria-hidden="true"></canvas>
|
|
30
28
|
</div>
|
|
31
29
|
|
|
32
|
-
</div>
|
|
30
|
+
</div>
|