@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.10
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +2 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/sagas/__tests__/assetPolling.test.js +74 -3
- package/sagas/assetPolling.js +8 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +18 -0
- package/translations/en.json +0 -1
- package/utils/common.js +5 -0
- package/utils/commonUtils.js +14 -1
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -42
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +14 -54
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +0 -4
- package/v2Components/CapTagList/index.js +6 -1
- package/v2Components/CapTagListWithInput/index.js +5 -1
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/ErrorInfoNote/index.js +412 -72
- package/v2Components/ErrorInfoNote/messages.js +22 -0
- package/v2Components/ErrorInfoNote/style.scss +279 -2
- package/v2Components/HtmlEditor/HTMLEditor.js +220 -91
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
- package/v2Components/HtmlEditor/_htmlEditor.scss +107 -45
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +10 -11
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +70 -72
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +95 -85
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +193 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -2
- package/v2Containers/CreativesContainer/index.js +173 -193
- package/v2Containers/CreativesContainer/messages.js +4 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +13 -0
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +41 -6
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
- package/v2Containers/EmailWrapper/index.js +99 -23
- package/v2Containers/EmailWrapper/messages.js +61 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +20 -4
- package/v2Containers/InApp/index.js +801 -357
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +148 -0
- package/v2Containers/InAppWrapper/messages.js +49 -0
- package/v2Containers/InappAdvance/index.js +1099 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
- package/v2Containers/TagList/index.js +67 -1
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -200
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +124 -277
- package/v2Containers/Templates/messages.js +4 -24
- package/v2Containers/Templates/reducer.js +0 -2
- package/v2Containers/Templates/tests/index.test.js +0 -10
- package/v2Containers/TemplatesV2/index.js +2 -3
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
- package/v2Components/CapImageUrlUpload/constants.js +0 -19
- package/v2Components/CapImageUrlUpload/index.js +0 -455
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
- package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
- package/v2Containers/WebPush/Create/index.js +0 -1755
- package/v2Containers/WebPush/Create/index.scss +0 -123
- package/v2Containers/WebPush/Create/messages.js +0 -199
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
- package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
- package/v2Containers/WebPush/Create/preview/constants.js +0 -162
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -108
- package/v2Containers/WebPush/index.js +0 -2
- package/v2Containers/WebPush/reducer.js +0 -104
- package/v2Containers/WebPush/sagas.js +0 -119
- package/v2Containers/WebPush/selectors.js +0 -65
- package/v2Containers/WebPush/tests/reducer.test.js +0 -863
- package/v2Containers/WebPush/tests/sagas.test.js +0 -566
- package/v2Containers/WebPush/tests/selectors.test.js +0 -960
|
@@ -1,1077 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { mountWithIntl, shallowWithIntl } from '../../../../../helpers/intl-enzym-test-helpers';
|
|
3
|
-
import NotificationContainer from '../NotificationContainer';
|
|
4
|
-
import NotificationHeader from '../components/NotificationHeader';
|
|
5
|
-
import AndroidMobileChromeHeader from '../components/AndroidMobileChromeHeader';
|
|
6
|
-
import AndroidMobileExpanded from '../components/AndroidMobileExpanded';
|
|
7
|
-
import IOSHeader from '../components/IOSHeader';
|
|
8
|
-
import WindowsChromeExpanded from '../components/WindowsChromeExpanded';
|
|
9
|
-
import NotificationExpandedContent from '../components/NotificationExpandedContent';
|
|
10
|
-
import {
|
|
11
|
-
OS_MACOS,
|
|
12
|
-
OS_IOS,
|
|
13
|
-
OS_IPADOS,
|
|
14
|
-
OS_WINDOWS,
|
|
15
|
-
OS_ANDROID_MOBILE,
|
|
16
|
-
OS_ANDROID_TABLET,
|
|
17
|
-
BROWSER_CHROME,
|
|
18
|
-
BROWSER_FIREFOX,
|
|
19
|
-
BROWSER_EDGE,
|
|
20
|
-
BROWSER_OPERA,
|
|
21
|
-
BROWSER_SAFARI,
|
|
22
|
-
NOTIFICATION_STATE_COLLAPSED,
|
|
23
|
-
NOTIFICATION_STATE_EXPANDED,
|
|
24
|
-
} from '../constants';
|
|
25
|
-
|
|
26
|
-
describe('NotificationContainer', () => {
|
|
27
|
-
const defaultProps = {
|
|
28
|
-
notificationTitle: 'Test Notification Title',
|
|
29
|
-
notificationBody: 'Test notification body text',
|
|
30
|
-
url: 'https://www.example.com',
|
|
31
|
-
selectedOS: OS_MACOS,
|
|
32
|
-
selectedBrowser: BROWSER_CHROME,
|
|
33
|
-
notificationState: NOTIFICATION_STATE_COLLAPSED,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
jest.clearAllMocks();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe('Basic Rendering', () => {
|
|
41
|
-
it('should render correctly with default props', () => {
|
|
42
|
-
const wrapper = shallowWithIntl(<NotificationContainer {...defaultProps} />);
|
|
43
|
-
expect(wrapper).toMatchSnapshot();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should render with required props only', () => {
|
|
47
|
-
const minimalProps = {
|
|
48
|
-
selectedOS: OS_MACOS,
|
|
49
|
-
selectedBrowser: BROWSER_CHROME,
|
|
50
|
-
};
|
|
51
|
-
const wrapper = shallowWithIntl(<NotificationContainer {...minimalProps} />);
|
|
52
|
-
expect(wrapper.exists()).toBe(true);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should apply custom className when provided', () => {
|
|
56
|
-
const wrapper = mountWithIntl(
|
|
57
|
-
<NotificationContainer {...defaultProps} className="custom-class" />
|
|
58
|
-
);
|
|
59
|
-
const container = wrapper.find('.notification-container');
|
|
60
|
-
expect(container.hasClass('custom-class')).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe('CSS Class Name Generation', () => {
|
|
65
|
-
it('should generate correct class name for macOS Chrome', () => {
|
|
66
|
-
const wrapper = mountWithIntl(
|
|
67
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_MACOS} selectedBrowser={BROWSER_CHROME} />
|
|
68
|
-
);
|
|
69
|
-
const container = wrapper.find('.notification-container');
|
|
70
|
-
expect(container.hasClass('macos-chrome')).toBe(true);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should generate correct class name for macOS Firefox', () => {
|
|
74
|
-
const wrapper = mountWithIntl(
|
|
75
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_MACOS} selectedBrowser={BROWSER_FIREFOX} />
|
|
76
|
-
);
|
|
77
|
-
const container = wrapper.find('.notification-container');
|
|
78
|
-
expect(container.hasClass('macos-firefox')).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should generate correct class name for Windows Chrome', () => {
|
|
82
|
-
const wrapper = mountWithIntl(
|
|
83
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_WINDOWS} selectedBrowser={BROWSER_CHROME} />
|
|
84
|
-
);
|
|
85
|
-
const container = wrapper.find('.notification-container');
|
|
86
|
-
expect(container.hasClass('windows-chrome')).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should generate correct class name for Windows Edge', () => {
|
|
90
|
-
const wrapper = mountWithIntl(
|
|
91
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_WINDOWS} selectedBrowser={BROWSER_EDGE} />
|
|
92
|
-
);
|
|
93
|
-
const container = wrapper.find('.notification-container');
|
|
94
|
-
expect(container.hasClass('windows-edge')).toBe(true);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should generate correct class name for Android Mobile Chrome', () => {
|
|
98
|
-
const wrapper = mountWithIntl(
|
|
99
|
-
<NotificationContainer
|
|
100
|
-
{...defaultProps}
|
|
101
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
102
|
-
selectedBrowser={BROWSER_CHROME}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
const container = wrapper.find('.notification-container');
|
|
106
|
-
expect(container.hasClass('android-mobile-chrome')).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should generate correct class name for Android Tablet Chrome', () => {
|
|
110
|
-
const wrapper = mountWithIntl(
|
|
111
|
-
<NotificationContainer
|
|
112
|
-
{...defaultProps}
|
|
113
|
-
selectedOS={OS_ANDROID_TABLET}
|
|
114
|
-
selectedBrowser={BROWSER_CHROME}
|
|
115
|
-
/>
|
|
116
|
-
);
|
|
117
|
-
const container = wrapper.find('.notification-container');
|
|
118
|
-
expect(container.hasClass('android-tablet-chrome')).toBe(true);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('should generate correct class name for iOS Safari', () => {
|
|
122
|
-
const wrapper = mountWithIntl(
|
|
123
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_IOS} selectedBrowser={BROWSER_SAFARI} />
|
|
124
|
-
);
|
|
125
|
-
const container = wrapper.find('.notification-container');
|
|
126
|
-
expect(container.hasClass('ios-safari')).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should generate correct class name for iPadOS Safari', () => {
|
|
130
|
-
const wrapper = mountWithIntl(
|
|
131
|
-
<NotificationContainer {...defaultProps} selectedOS={OS_IPADOS} selectedBrowser={BROWSER_SAFARI} />
|
|
132
|
-
);
|
|
133
|
-
const container = wrapper.find('.notification-container');
|
|
134
|
-
expect(container.hasClass('ipados-safari')).toBe(true);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('should add collapsed state class by default', () => {
|
|
138
|
-
const wrapper = mountWithIntl(<NotificationContainer {...defaultProps} />);
|
|
139
|
-
const container = wrapper.find('.notification-container');
|
|
140
|
-
expect(container.hasClass('collapsed')).toBe(true);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('should add expanded state class when expanded', () => {
|
|
144
|
-
const wrapper = mountWithIntl(
|
|
145
|
-
<NotificationContainer {...defaultProps} notificationState={NOTIFICATION_STATE_EXPANDED} />
|
|
146
|
-
);
|
|
147
|
-
const container = wrapper.find('.notification-container');
|
|
148
|
-
expect(container.hasClass('expanded')).toBe(true);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('should add windows-chrome-expanded class for Windows expanded notifications', () => {
|
|
152
|
-
const wrapper = mountWithIntl(
|
|
153
|
-
<NotificationContainer
|
|
154
|
-
{...defaultProps}
|
|
155
|
-
selectedOS={OS_WINDOWS}
|
|
156
|
-
selectedBrowser={BROWSER_CHROME}
|
|
157
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
158
|
-
/>
|
|
159
|
-
);
|
|
160
|
-
const container = wrapper.find('.notification-container');
|
|
161
|
-
expect(container.hasClass('windows-chrome-expanded')).toBe(true);
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe('URL Formatting', () => {
|
|
166
|
-
it('should format URL by removing protocol', () => {
|
|
167
|
-
const wrapper = mountWithIntl(
|
|
168
|
-
<NotificationContainer {...defaultProps} url="https://example.com" />
|
|
169
|
-
);
|
|
170
|
-
const header = wrapper.find(NotificationHeader);
|
|
171
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('should format URL by removing www prefix', () => {
|
|
175
|
-
const wrapper = mountWithIntl(
|
|
176
|
-
<NotificationContainer {...defaultProps} url="https://www.example.com" />
|
|
177
|
-
);
|
|
178
|
-
const header = wrapper.find(NotificationHeader);
|
|
179
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('should format URL by removing trailing slashes', () => {
|
|
183
|
-
const wrapper = mountWithIntl(
|
|
184
|
-
<NotificationContainer {...defaultProps} url="https://example.com/" />
|
|
185
|
-
);
|
|
186
|
-
const header = wrapper.find(NotificationHeader);
|
|
187
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('should format URL with all transformations', () => {
|
|
191
|
-
const wrapper = mountWithIntl(
|
|
192
|
-
<NotificationContainer {...defaultProps} url="https://www.example.com/path/" />
|
|
193
|
-
);
|
|
194
|
-
const header = wrapper.find(NotificationHeader);
|
|
195
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('should remove child paths from URL', () => {
|
|
199
|
-
const wrapper = mountWithIntl(
|
|
200
|
-
<NotificationContainer {...defaultProps} url="https://example.com/path/to/page" />
|
|
201
|
-
);
|
|
202
|
-
const header = wrapper.find(NotificationHeader);
|
|
203
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it('should preserve subdomain while removing child paths', () => {
|
|
207
|
-
const wrapper = mountWithIntl(
|
|
208
|
-
<NotificationContainer {...defaultProps} url="https://subdomain.example.com/path/to/page" />
|
|
209
|
-
);
|
|
210
|
-
const header = wrapper.find(NotificationHeader);
|
|
211
|
-
expect(header.prop('displayUrl')).toBe('subdomain.example.com');
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('should remove child paths with www prefix', () => {
|
|
215
|
-
const wrapper = mountWithIntl(
|
|
216
|
-
<NotificationContainer {...defaultProps} url="https://www.example.com/path/to/page" />
|
|
217
|
-
);
|
|
218
|
-
const header = wrapper.find(NotificationHeader);
|
|
219
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('should handle HTTP protocol', () => {
|
|
223
|
-
const wrapper = mountWithIntl(
|
|
224
|
-
<NotificationContainer {...defaultProps} url="http://example.com" />
|
|
225
|
-
);
|
|
226
|
-
const header = wrapper.find(NotificationHeader);
|
|
227
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('should use empty string when url is empty', () => {
|
|
231
|
-
const wrapper = mountWithIntl(<NotificationContainer {...defaultProps} url="" />);
|
|
232
|
-
const header = wrapper.find(NotificationHeader);
|
|
233
|
-
expect(header.prop('displayUrl')).toBe('');
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it('should use empty string when url is undefined', () => {
|
|
237
|
-
const wrapper = mountWithIntl(<NotificationContainer {...defaultProps} url={undefined} />);
|
|
238
|
-
const header = wrapper.find(NotificationHeader);
|
|
239
|
-
expect(header.prop('displayUrl')).toBe('');
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it('should handle URL with multiple trailing slashes', () => {
|
|
243
|
-
const wrapper = mountWithIntl(
|
|
244
|
-
<NotificationContainer {...defaultProps} url="https://example.com///" />
|
|
245
|
-
);
|
|
246
|
-
const header = wrapper.find(NotificationHeader);
|
|
247
|
-
expect(header.prop('displayUrl')).toBe('example.com');
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
describe('Platform-Specific Rendering - macOS', () => {
|
|
252
|
-
it('should render NotificationHeader for macOS Chrome collapsed', () => {
|
|
253
|
-
const wrapper = mountWithIntl(
|
|
254
|
-
<NotificationContainer
|
|
255
|
-
{...defaultProps}
|
|
256
|
-
selectedOS={OS_MACOS}
|
|
257
|
-
selectedBrowser={BROWSER_CHROME}
|
|
258
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
259
|
-
/>
|
|
260
|
-
);
|
|
261
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
262
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(false);
|
|
263
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(false);
|
|
264
|
-
expect(wrapper.find(WindowsChromeExpanded).exists()).toBe(false);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('should render NotificationHeader and NotificationExpandedContent for macOS Chrome expanded', () => {
|
|
268
|
-
const wrapper = mountWithIntl(
|
|
269
|
-
<NotificationContainer
|
|
270
|
-
{...defaultProps}
|
|
271
|
-
selectedOS={OS_MACOS}
|
|
272
|
-
selectedBrowser={BROWSER_CHROME}
|
|
273
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
274
|
-
/>
|
|
275
|
-
);
|
|
276
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
277
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(true);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('should render NotificationHeader for macOS Firefox collapsed', () => {
|
|
281
|
-
const wrapper = mountWithIntl(
|
|
282
|
-
<NotificationContainer
|
|
283
|
-
{...defaultProps}
|
|
284
|
-
selectedOS={OS_MACOS}
|
|
285
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
286
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
287
|
-
/>
|
|
288
|
-
);
|
|
289
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
it('should render NotificationHeader for macOS Edge collapsed', () => {
|
|
293
|
-
const wrapper = mountWithIntl(
|
|
294
|
-
<NotificationContainer
|
|
295
|
-
{...defaultProps}
|
|
296
|
-
selectedOS={OS_MACOS}
|
|
297
|
-
selectedBrowser={BROWSER_EDGE}
|
|
298
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
299
|
-
/>
|
|
300
|
-
);
|
|
301
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('should render NotificationHeader for macOS Opera collapsed', () => {
|
|
305
|
-
const wrapper = mountWithIntl(
|
|
306
|
-
<NotificationContainer
|
|
307
|
-
{...defaultProps}
|
|
308
|
-
selectedOS={OS_MACOS}
|
|
309
|
-
selectedBrowser={BROWSER_OPERA}
|
|
310
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
311
|
-
/>
|
|
312
|
-
);
|
|
313
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
describe('Platform-Specific Rendering - Windows', () => {
|
|
318
|
-
it('should render NotificationHeader for Windows Chrome collapsed', () => {
|
|
319
|
-
const wrapper = mountWithIntl(
|
|
320
|
-
<NotificationContainer
|
|
321
|
-
{...defaultProps}
|
|
322
|
-
selectedOS={OS_WINDOWS}
|
|
323
|
-
selectedBrowser={BROWSER_CHROME}
|
|
324
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
325
|
-
/>
|
|
326
|
-
);
|
|
327
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
328
|
-
expect(wrapper.find(WindowsChromeExpanded).exists()).toBe(false);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('should render WindowsChromeExpanded for Windows Chrome expanded', () => {
|
|
332
|
-
const wrapper = mountWithIntl(
|
|
333
|
-
<NotificationContainer
|
|
334
|
-
{...defaultProps}
|
|
335
|
-
selectedOS={OS_WINDOWS}
|
|
336
|
-
selectedBrowser={BROWSER_CHROME}
|
|
337
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
338
|
-
/>
|
|
339
|
-
);
|
|
340
|
-
expect(wrapper.find(WindowsChromeExpanded).exists()).toBe(true);
|
|
341
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(false);
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
it('should render NotificationHeader for Windows Edge collapsed', () => {
|
|
345
|
-
const wrapper = mountWithIntl(
|
|
346
|
-
<NotificationContainer
|
|
347
|
-
{...defaultProps}
|
|
348
|
-
selectedOS={OS_WINDOWS}
|
|
349
|
-
selectedBrowser={BROWSER_EDGE}
|
|
350
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
351
|
-
/>
|
|
352
|
-
);
|
|
353
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
it('should render NotificationHeader for Windows Firefox collapsed', () => {
|
|
357
|
-
const wrapper = mountWithIntl(
|
|
358
|
-
<NotificationContainer
|
|
359
|
-
{...defaultProps}
|
|
360
|
-
selectedOS={OS_WINDOWS}
|
|
361
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
362
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
363
|
-
/>
|
|
364
|
-
);
|
|
365
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(true);
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('should pass correct props to WindowsChromeExpanded when expanded', () => {
|
|
369
|
-
const props = {
|
|
370
|
-
...defaultProps,
|
|
371
|
-
selectedOS: OS_WINDOWS,
|
|
372
|
-
selectedBrowser: BROWSER_CHROME,
|
|
373
|
-
notificationState: NOTIFICATION_STATE_EXPANDED,
|
|
374
|
-
brandIcon: 'brand-icon.png',
|
|
375
|
-
imageSrc: 'media-image.jpg',
|
|
376
|
-
};
|
|
377
|
-
const wrapper = mountWithIntl(<NotificationContainer {...props} />);
|
|
378
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
379
|
-
expect(windowsExpanded.prop('notificationTitle')).toBe(props.notificationTitle);
|
|
380
|
-
expect(windowsExpanded.prop('notificationBody')).toBe(props.notificationBody);
|
|
381
|
-
expect(windowsExpanded.prop('brandIcon')).toBe('brand-icon.png');
|
|
382
|
-
expect(windowsExpanded.prop('mediaImageUrl')).toBe('media-image.jpg');
|
|
383
|
-
expect(windowsExpanded.prop('browserName')).toBe('Google Chrome');
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
describe('Platform-Specific Rendering - Android Mobile', () => {
|
|
388
|
-
it('should render AndroidMobileChromeHeader for Android Mobile Chrome collapsed', () => {
|
|
389
|
-
const wrapper = mountWithIntl(
|
|
390
|
-
<NotificationContainer
|
|
391
|
-
{...defaultProps}
|
|
392
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
393
|
-
selectedBrowser={BROWSER_CHROME}
|
|
394
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
395
|
-
/>
|
|
396
|
-
);
|
|
397
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
398
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(false);
|
|
399
|
-
expect(wrapper.find(AndroidMobileExpanded).exists()).toBe(false);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
it('should render AndroidMobileExpanded for Android Mobile Chrome expanded', () => {
|
|
403
|
-
const wrapper = mountWithIntl(
|
|
404
|
-
<NotificationContainer
|
|
405
|
-
{...defaultProps}
|
|
406
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
407
|
-
selectedBrowser={BROWSER_CHROME}
|
|
408
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
409
|
-
/>
|
|
410
|
-
);
|
|
411
|
-
expect(wrapper.find(AndroidMobileExpanded).exists()).toBe(true);
|
|
412
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(false);
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
it('should render AndroidMobileChromeHeader for Android Mobile Firefox collapsed', () => {
|
|
416
|
-
const wrapper = mountWithIntl(
|
|
417
|
-
<NotificationContainer
|
|
418
|
-
{...defaultProps}
|
|
419
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
420
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
421
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
422
|
-
/>
|
|
423
|
-
);
|
|
424
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
it('should render AndroidMobileChromeHeader for Android Mobile Edge collapsed', () => {
|
|
428
|
-
const wrapper = mountWithIntl(
|
|
429
|
-
<NotificationContainer
|
|
430
|
-
{...defaultProps}
|
|
431
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
432
|
-
selectedBrowser={BROWSER_EDGE}
|
|
433
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
434
|
-
/>
|
|
435
|
-
);
|
|
436
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it('should render AndroidMobileChromeHeader for Android Mobile Opera collapsed', () => {
|
|
440
|
-
const wrapper = mountWithIntl(
|
|
441
|
-
<NotificationContainer
|
|
442
|
-
{...defaultProps}
|
|
443
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
444
|
-
selectedBrowser={BROWSER_OPERA}
|
|
445
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
446
|
-
/>
|
|
447
|
-
);
|
|
448
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
it('should pass correct props to AndroidMobileExpanded when expanded', () => {
|
|
452
|
-
const props = {
|
|
453
|
-
...defaultProps,
|
|
454
|
-
selectedOS: OS_ANDROID_MOBILE,
|
|
455
|
-
selectedBrowser: BROWSER_CHROME,
|
|
456
|
-
notificationState: NOTIFICATION_STATE_EXPANDED,
|
|
457
|
-
brandIcon: 'brand-icon.png',
|
|
458
|
-
imageSrc: 'media-image.jpg',
|
|
459
|
-
};
|
|
460
|
-
const wrapper = mountWithIntl(<NotificationContainer {...props} />);
|
|
461
|
-
const androidExpanded = wrapper.find(AndroidMobileExpanded);
|
|
462
|
-
expect(androidExpanded.prop('notificationTitle')).toBe(props.notificationTitle);
|
|
463
|
-
expect(androidExpanded.prop('notificationBody')).toBe(props.notificationBody);
|
|
464
|
-
expect(androidExpanded.prop('brandIcon')).toBe('brand-icon.png');
|
|
465
|
-
expect(androidExpanded.prop('mediaImageUrl')).toBe('media-image.jpg');
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
describe('Platform-Specific Rendering - Android Tablet', () => {
|
|
470
|
-
it('should render AndroidMobileChromeHeader for Android Tablet Chrome collapsed', () => {
|
|
471
|
-
const wrapper = mountWithIntl(
|
|
472
|
-
<NotificationContainer
|
|
473
|
-
{...defaultProps}
|
|
474
|
-
selectedOS={OS_ANDROID_TABLET}
|
|
475
|
-
selectedBrowser={BROWSER_CHROME}
|
|
476
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
477
|
-
/>
|
|
478
|
-
);
|
|
479
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
it('should render AndroidMobileExpanded for Android Tablet Chrome expanded', () => {
|
|
483
|
-
const wrapper = mountWithIntl(
|
|
484
|
-
<NotificationContainer
|
|
485
|
-
{...defaultProps}
|
|
486
|
-
selectedOS={OS_ANDROID_TABLET}
|
|
487
|
-
selectedBrowser={BROWSER_CHROME}
|
|
488
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
489
|
-
/>
|
|
490
|
-
);
|
|
491
|
-
expect(wrapper.find(AndroidMobileExpanded).exists()).toBe(true);
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
it('should render AndroidMobileChromeHeader for Android Tablet Firefox collapsed', () => {
|
|
495
|
-
const wrapper = mountWithIntl(
|
|
496
|
-
<NotificationContainer
|
|
497
|
-
{...defaultProps}
|
|
498
|
-
selectedOS={OS_ANDROID_TABLET}
|
|
499
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
500
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
501
|
-
/>
|
|
502
|
-
);
|
|
503
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(true);
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
describe('Platform-Specific Rendering - iOS', () => {
|
|
508
|
-
it('should render IOSHeader for iOS Safari collapsed', () => {
|
|
509
|
-
const wrapper = mountWithIntl(
|
|
510
|
-
<NotificationContainer
|
|
511
|
-
{...defaultProps}
|
|
512
|
-
selectedOS={OS_IOS}
|
|
513
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
514
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
515
|
-
/>
|
|
516
|
-
);
|
|
517
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(true);
|
|
518
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(false);
|
|
519
|
-
expect(wrapper.find(AndroidMobileChromeHeader).exists()).toBe(false);
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
it('should render IOSHeader for iOS Safari even when expanded (iOS does not support expanded)', () => {
|
|
523
|
-
const wrapper = mountWithIntl(
|
|
524
|
-
<NotificationContainer
|
|
525
|
-
{...defaultProps}
|
|
526
|
-
selectedOS={OS_IOS}
|
|
527
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
528
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
529
|
-
supportsExpanded={false}
|
|
530
|
-
/>
|
|
531
|
-
);
|
|
532
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(true);
|
|
533
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(false);
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
it('should render IOSHeader for iOS Chrome collapsed', () => {
|
|
537
|
-
const wrapper = mountWithIntl(
|
|
538
|
-
<NotificationContainer
|
|
539
|
-
{...defaultProps}
|
|
540
|
-
selectedOS={OS_IOS}
|
|
541
|
-
selectedBrowser={BROWSER_CHROME}
|
|
542
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
543
|
-
/>
|
|
544
|
-
);
|
|
545
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(true);
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
describe('Platform-Specific Rendering - iPadOS', () => {
|
|
550
|
-
it('should render IOSHeader for iPadOS Safari collapsed', () => {
|
|
551
|
-
const wrapper = mountWithIntl(
|
|
552
|
-
<NotificationContainer
|
|
553
|
-
{...defaultProps}
|
|
554
|
-
selectedOS={OS_IPADOS}
|
|
555
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
556
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
557
|
-
/>
|
|
558
|
-
);
|
|
559
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(true);
|
|
560
|
-
expect(wrapper.find(NotificationHeader).exists()).toBe(false);
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
it('should render IOSHeader for iPadOS Safari even when expanded (iPadOS does not support expanded)', () => {
|
|
564
|
-
const wrapper = mountWithIntl(
|
|
565
|
-
<NotificationContainer
|
|
566
|
-
{...defaultProps}
|
|
567
|
-
selectedOS={OS_IPADOS}
|
|
568
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
569
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
570
|
-
supportsExpanded={false}
|
|
571
|
-
/>
|
|
572
|
-
);
|
|
573
|
-
expect(wrapper.find(IOSHeader).exists()).toBe(true);
|
|
574
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(false);
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
describe('Brand Icon Visibility Logic', () => {
|
|
579
|
-
it('should show brand icon for macOS Chrome collapsed when brandIcon is provided', () => {
|
|
580
|
-
const wrapper = mountWithIntl(
|
|
581
|
-
<NotificationContainer
|
|
582
|
-
{...defaultProps}
|
|
583
|
-
selectedOS={OS_MACOS}
|
|
584
|
-
selectedBrowser={BROWSER_CHROME}
|
|
585
|
-
brandIcon="brand-icon.png"
|
|
586
|
-
enableBrandIconPreview={true}
|
|
587
|
-
/>
|
|
588
|
-
);
|
|
589
|
-
const header = wrapper.find(NotificationHeader);
|
|
590
|
-
expect(header.prop('shouldShowBrandIcon')).toBe(true);
|
|
591
|
-
expect(header.prop('brandIcon')).toBe('brand-icon.png');
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
it('should not show brand icon for macOS Chrome collapsed when brandIcon is empty', () => {
|
|
595
|
-
const wrapper = mountWithIntl(
|
|
596
|
-
<NotificationContainer
|
|
597
|
-
{...defaultProps}
|
|
598
|
-
selectedOS={OS_MACOS}
|
|
599
|
-
selectedBrowser={BROWSER_CHROME}
|
|
600
|
-
brandIcon=""
|
|
601
|
-
enableBrandIconPreview={true}
|
|
602
|
-
/>
|
|
603
|
-
);
|
|
604
|
-
const header = wrapper.find(NotificationHeader);
|
|
605
|
-
expect(header.prop('shouldShowBrandIcon')).toBe(false);
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
it('should not show brand icon for macOS Chrome collapsed when enableBrandIconPreview is false', () => {
|
|
609
|
-
const wrapper = mountWithIntl(
|
|
610
|
-
<NotificationContainer
|
|
611
|
-
{...defaultProps}
|
|
612
|
-
selectedOS={OS_MACOS}
|
|
613
|
-
selectedBrowser={BROWSER_CHROME}
|
|
614
|
-
brandIcon="brand-icon.png"
|
|
615
|
-
enableBrandIconPreview={false}
|
|
616
|
-
/>
|
|
617
|
-
);
|
|
618
|
-
const header = wrapper.find(NotificationHeader);
|
|
619
|
-
expect(header.prop('shouldShowBrandIcon')).toBe(false);
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
it('should show brand icon for macOS Chrome expanded when brandIcon is provided and browser supports it', () => {
|
|
623
|
-
const wrapper = mountWithIntl(
|
|
624
|
-
<NotificationContainer
|
|
625
|
-
{...defaultProps}
|
|
626
|
-
selectedOS={OS_MACOS}
|
|
627
|
-
selectedBrowser={BROWSER_CHROME}
|
|
628
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
629
|
-
brandIcon="brand-icon.png"
|
|
630
|
-
enableBrandIconPreview={true}
|
|
631
|
-
/>
|
|
632
|
-
);
|
|
633
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
634
|
-
expect(expandedContent.prop('shouldShowBrandIconInExpandedMac')).toBe(true);
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
it('should show brand icon for macOS Firefox expanded (Firefox supports brand icon)', () => {
|
|
638
|
-
const wrapper = mountWithIntl(
|
|
639
|
-
<NotificationContainer
|
|
640
|
-
{...defaultProps}
|
|
641
|
-
selectedOS={OS_MACOS}
|
|
642
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
643
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
644
|
-
brandIcon="brand-icon.png"
|
|
645
|
-
enableBrandIconPreview={true}
|
|
646
|
-
/>
|
|
647
|
-
);
|
|
648
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
649
|
-
expect(expandedContent.prop('shouldShowBrandIconInExpandedMac')).toBe(true);
|
|
650
|
-
});
|
|
651
|
-
|
|
652
|
-
it('should show brand icon for Windows Chrome collapsed when brandIcon is provided', () => {
|
|
653
|
-
const wrapper = mountWithIntl(
|
|
654
|
-
<NotificationContainer
|
|
655
|
-
{...defaultProps}
|
|
656
|
-
selectedOS={OS_WINDOWS}
|
|
657
|
-
selectedBrowser={BROWSER_CHROME}
|
|
658
|
-
brandIcon="brand-icon.png"
|
|
659
|
-
enableBrandIconPreview={true}
|
|
660
|
-
/>
|
|
661
|
-
);
|
|
662
|
-
const header = wrapper.find(NotificationHeader);
|
|
663
|
-
expect(header.prop('shouldShowBrandIcon')).toBe(true);
|
|
664
|
-
});
|
|
665
|
-
|
|
666
|
-
it('should show brand icon for Android Mobile Chrome collapsed when brandIcon is provided', () => {
|
|
667
|
-
const wrapper = mountWithIntl(
|
|
668
|
-
<NotificationContainer
|
|
669
|
-
{...defaultProps}
|
|
670
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
671
|
-
selectedBrowser={BROWSER_CHROME}
|
|
672
|
-
brandIcon="brand-icon.png"
|
|
673
|
-
enableBrandIconPreview={true}
|
|
674
|
-
/>
|
|
675
|
-
);
|
|
676
|
-
const header = wrapper.find(AndroidMobileChromeHeader);
|
|
677
|
-
expect(header.prop('shouldShowBrandIcon')).toBe(true);
|
|
678
|
-
});
|
|
679
|
-
|
|
680
|
-
it('should show brand icon for Android Mobile Chrome expanded when brandIcon is provided', () => {
|
|
681
|
-
const wrapper = mountWithIntl(
|
|
682
|
-
<NotificationContainer
|
|
683
|
-
{...defaultProps}
|
|
684
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
685
|
-
selectedBrowser={BROWSER_CHROME}
|
|
686
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
687
|
-
brandIcon="brand-icon.png"
|
|
688
|
-
enableBrandIconPreview={true}
|
|
689
|
-
/>
|
|
690
|
-
);
|
|
691
|
-
const expanded = wrapper.find(AndroidMobileExpanded);
|
|
692
|
-
expect(expanded.prop('shouldShowBrandIconExpanded')).toBe(true);
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
it('should not show brand icon for iOS Safari (iOS does not support brand icons)', () => {
|
|
696
|
-
const wrapper = mountWithIntl(
|
|
697
|
-
<NotificationContainer
|
|
698
|
-
{...defaultProps}
|
|
699
|
-
selectedOS={OS_IOS}
|
|
700
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
701
|
-
brandIcon="brand-icon.png"
|
|
702
|
-
enableBrandIconPreview={true}
|
|
703
|
-
/>
|
|
704
|
-
);
|
|
705
|
-
const header = wrapper.find(IOSHeader);
|
|
706
|
-
// IOSHeader doesn't have brand icon props, which is correct
|
|
707
|
-
expect(header.exists()).toBe(true);
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
it('should not show brand icon for iPadOS Safari (iPadOS does not support brand icons)', () => {
|
|
711
|
-
const wrapper = mountWithIntl(
|
|
712
|
-
<NotificationContainer
|
|
713
|
-
{...defaultProps}
|
|
714
|
-
selectedOS={OS_IPADOS}
|
|
715
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
716
|
-
brandIcon="brand-icon.png"
|
|
717
|
-
enableBrandIconPreview={true}
|
|
718
|
-
/>
|
|
719
|
-
);
|
|
720
|
-
const header = wrapper.find(IOSHeader);
|
|
721
|
-
expect(header.exists()).toBe(true);
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
it('should prefer brandIconSrc over brandIcon prop', () => {
|
|
725
|
-
const wrapper = mountWithIntl(
|
|
726
|
-
<NotificationContainer
|
|
727
|
-
{...defaultProps}
|
|
728
|
-
selectedOS={OS_MACOS}
|
|
729
|
-
selectedBrowser={BROWSER_CHROME}
|
|
730
|
-
brandIcon="old-brand-icon.png"
|
|
731
|
-
brandIconSrc="new-brand-icon.png"
|
|
732
|
-
enableBrandIconPreview={true}
|
|
733
|
-
/>
|
|
734
|
-
);
|
|
735
|
-
const header = wrapper.find(NotificationHeader);
|
|
736
|
-
expect(header.prop('brandIcon')).toBe('new-brand-icon.png');
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
describe('Expanded Content Rendering', () => {
|
|
741
|
-
it('should render NotificationExpandedContent for macOS Chrome expanded', () => {
|
|
742
|
-
const wrapper = mountWithIntl(
|
|
743
|
-
<NotificationContainer
|
|
744
|
-
{...defaultProps}
|
|
745
|
-
selectedOS={OS_MACOS}
|
|
746
|
-
selectedBrowser={BROWSER_CHROME}
|
|
747
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
748
|
-
/>
|
|
749
|
-
);
|
|
750
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(true);
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
it('should not render NotificationExpandedContent for macOS Chrome collapsed', () => {
|
|
754
|
-
const wrapper = mountWithIntl(
|
|
755
|
-
<NotificationContainer
|
|
756
|
-
{...defaultProps}
|
|
757
|
-
selectedOS={OS_MACOS}
|
|
758
|
-
selectedBrowser={BROWSER_CHROME}
|
|
759
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
760
|
-
/>
|
|
761
|
-
);
|
|
762
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(false);
|
|
763
|
-
});
|
|
764
|
-
|
|
765
|
-
it('should not render NotificationExpandedContent when supportsExpanded is false', () => {
|
|
766
|
-
const wrapper = mountWithIntl(
|
|
767
|
-
<NotificationContainer
|
|
768
|
-
{...defaultProps}
|
|
769
|
-
selectedOS={OS_MACOS}
|
|
770
|
-
selectedBrowser={BROWSER_CHROME}
|
|
771
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
772
|
-
supportsExpanded={false}
|
|
773
|
-
/>
|
|
774
|
-
);
|
|
775
|
-
expect(wrapper.find(NotificationExpandedContent).exists()).toBe(false);
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
it('should render media image when imageSrc is provided and enableMedia is true for non-brand browsers', () => {
|
|
779
|
-
const wrapper = mountWithIntl(
|
|
780
|
-
<NotificationContainer
|
|
781
|
-
{...defaultProps}
|
|
782
|
-
selectedOS={OS_MACOS}
|
|
783
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
784
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
785
|
-
imageSrc="media-image.jpg"
|
|
786
|
-
enableMedia={true}
|
|
787
|
-
/>
|
|
788
|
-
);
|
|
789
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
790
|
-
expect(expandedContent.prop('shouldRenderExpandedMedia')).toBe(true);
|
|
791
|
-
expect(expandedContent.prop('mediaImageUrl')).toBe('media-image.jpg');
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
it('should render brand icon as media for macOS Chrome expanded when brand icon is available', () => {
|
|
795
|
-
const wrapper = mountWithIntl(
|
|
796
|
-
<NotificationContainer
|
|
797
|
-
{...defaultProps}
|
|
798
|
-
selectedOS={OS_MACOS}
|
|
799
|
-
selectedBrowser={BROWSER_CHROME}
|
|
800
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
801
|
-
imageSrc="media-image.jpg"
|
|
802
|
-
enableMedia={true}
|
|
803
|
-
brandIcon="brand-icon.png"
|
|
804
|
-
enableBrandIconPreview={true}
|
|
805
|
-
/>
|
|
806
|
-
);
|
|
807
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
808
|
-
expect(expandedContent.prop('shouldRenderExpandedMedia')).toBe(true);
|
|
809
|
-
expect(expandedContent.prop('shouldShowBrandIconInExpandedMac')).toBe(true);
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
it('should not render media for macOS Chrome expanded when brand icon is not available', () => {
|
|
813
|
-
const wrapper = mountWithIntl(
|
|
814
|
-
<NotificationContainer
|
|
815
|
-
{...defaultProps}
|
|
816
|
-
selectedOS={OS_MACOS}
|
|
817
|
-
selectedBrowser={BROWSER_CHROME}
|
|
818
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
819
|
-
imageSrc="media-image.jpg"
|
|
820
|
-
enableMedia={true}
|
|
821
|
-
brandIcon=""
|
|
822
|
-
enableBrandIconPreview={true}
|
|
823
|
-
/>
|
|
824
|
-
);
|
|
825
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
826
|
-
expect(expandedContent.prop('shouldRenderExpandedMedia')).toBe(false);
|
|
827
|
-
});
|
|
828
|
-
|
|
829
|
-
it('should not render media image when enableMedia is false', () => {
|
|
830
|
-
const wrapper = mountWithIntl(
|
|
831
|
-
<NotificationContainer
|
|
832
|
-
{...defaultProps}
|
|
833
|
-
selectedOS={OS_MACOS}
|
|
834
|
-
selectedBrowser={BROWSER_CHROME}
|
|
835
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
836
|
-
imageSrc="media-image.jpg"
|
|
837
|
-
enableMedia={false}
|
|
838
|
-
/>
|
|
839
|
-
);
|
|
840
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
841
|
-
expect(expandedContent.prop('shouldRenderExpandedMedia')).toBe(false);
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
it('should not render media image when imageSrc is empty', () => {
|
|
845
|
-
const wrapper = mountWithIntl(
|
|
846
|
-
<NotificationContainer
|
|
847
|
-
{...defaultProps}
|
|
848
|
-
selectedOS={OS_MACOS}
|
|
849
|
-
selectedBrowser={BROWSER_CHROME}
|
|
850
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
851
|
-
imageSrc=""
|
|
852
|
-
enableMedia={true}
|
|
853
|
-
/>
|
|
854
|
-
);
|
|
855
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
856
|
-
expect(expandedContent.prop('shouldRenderExpandedMedia')).toBe(false);
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
it('should render CTA buttons when enableCtas is true', () => {
|
|
860
|
-
const wrapper = mountWithIntl(
|
|
861
|
-
<NotificationContainer
|
|
862
|
-
{...defaultProps}
|
|
863
|
-
selectedOS={OS_MACOS}
|
|
864
|
-
selectedBrowser={BROWSER_CHROME}
|
|
865
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
866
|
-
enableCtas={true}
|
|
867
|
-
/>
|
|
868
|
-
);
|
|
869
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
870
|
-
expect(expandedContent.prop('enableCtas')).toBe(true);
|
|
871
|
-
expect(expandedContent.prop('ctaButtons').length).toBeGreaterThan(0);
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
it('should not render CTA buttons when enableCtas is false', () => {
|
|
875
|
-
const wrapper = mountWithIntl(
|
|
876
|
-
<NotificationContainer
|
|
877
|
-
{...defaultProps}
|
|
878
|
-
selectedOS={OS_MACOS}
|
|
879
|
-
selectedBrowser={BROWSER_CHROME}
|
|
880
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
881
|
-
enableCtas={false}
|
|
882
|
-
/>
|
|
883
|
-
);
|
|
884
|
-
const expandedContent = wrapper.find(NotificationExpandedContent);
|
|
885
|
-
expect(expandedContent.prop('enableCtas')).toBe(false);
|
|
886
|
-
});
|
|
887
|
-
});
|
|
888
|
-
|
|
889
|
-
describe('Edge Cases and Error Handling', () => {
|
|
890
|
-
it('should handle empty notificationTitle', () => {
|
|
891
|
-
const wrapper = mountWithIntl(
|
|
892
|
-
<NotificationContainer {...defaultProps} notificationTitle="" />
|
|
893
|
-
);
|
|
894
|
-
const header = wrapper.find(NotificationHeader);
|
|
895
|
-
expect(header.prop('notificationTitle')).toBe('');
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
it('should handle empty notificationBody', () => {
|
|
899
|
-
const wrapper = mountWithIntl(
|
|
900
|
-
<NotificationContainer {...defaultProps} notificationBody="" />
|
|
901
|
-
);
|
|
902
|
-
const header = wrapper.find(NotificationHeader);
|
|
903
|
-
expect(header.prop('notificationBody')).toBe('');
|
|
904
|
-
});
|
|
905
|
-
|
|
906
|
-
it('should handle undefined notificationTitle', () => {
|
|
907
|
-
const wrapper = mountWithIntl(
|
|
908
|
-
<NotificationContainer {...defaultProps} notificationTitle={undefined} />
|
|
909
|
-
);
|
|
910
|
-
const header = wrapper.find(NotificationHeader);
|
|
911
|
-
expect(header.prop('notificationTitle')).toBeUndefined();
|
|
912
|
-
});
|
|
913
|
-
|
|
914
|
-
it('should handle undefined notificationBody', () => {
|
|
915
|
-
const wrapper = mountWithIntl(
|
|
916
|
-
<NotificationContainer {...defaultProps} notificationBody={undefined} />
|
|
917
|
-
);
|
|
918
|
-
const header = wrapper.find(NotificationHeader);
|
|
919
|
-
expect(header.prop('notificationBody')).toBeUndefined();
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
it('should handle custom icon prop', () => {
|
|
923
|
-
const customIcon = 'custom-icon.png';
|
|
924
|
-
const wrapper = mountWithIntl(
|
|
925
|
-
<NotificationContainer {...defaultProps} icon={customIcon} />
|
|
926
|
-
);
|
|
927
|
-
const header = wrapper.find(NotificationHeader);
|
|
928
|
-
expect(header.prop('icon')).toBe(customIcon);
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
it('should handle empty string for selectedBrowser', () => {
|
|
932
|
-
const wrapper = mountWithIntl(
|
|
933
|
-
<NotificationContainer {...defaultProps} selectedBrowser="" />
|
|
934
|
-
);
|
|
935
|
-
// Should still render without crashing
|
|
936
|
-
expect(wrapper.find('.notification-container').exists()).toBe(true);
|
|
937
|
-
});
|
|
938
|
-
|
|
939
|
-
it('should handle unknown OS gracefully', () => {
|
|
940
|
-
const wrapper = mountWithIntl(
|
|
941
|
-
<NotificationContainer {...defaultProps} selectedOS="UnknownOS" />
|
|
942
|
-
);
|
|
943
|
-
// Should still render without crashing
|
|
944
|
-
expect(wrapper.find('.notification-container').exists()).toBe(true);
|
|
945
|
-
});
|
|
946
|
-
});
|
|
947
|
-
|
|
948
|
-
describe('Browser Display Names', () => {
|
|
949
|
-
it('should pass correct browser display name to WindowsChromeExpanded', () => {
|
|
950
|
-
const wrapper = mountWithIntl(
|
|
951
|
-
<NotificationContainer
|
|
952
|
-
{...defaultProps}
|
|
953
|
-
selectedOS={OS_WINDOWS}
|
|
954
|
-
selectedBrowser={BROWSER_CHROME}
|
|
955
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
956
|
-
/>
|
|
957
|
-
);
|
|
958
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
959
|
-
expect(windowsExpanded.prop('browserName')).toBe('Google Chrome');
|
|
960
|
-
});
|
|
961
|
-
|
|
962
|
-
it('should pass correct browser display name for Firefox', () => {
|
|
963
|
-
const wrapper = mountWithIntl(
|
|
964
|
-
<NotificationContainer
|
|
965
|
-
{...defaultProps}
|
|
966
|
-
selectedOS={OS_WINDOWS}
|
|
967
|
-
selectedBrowser={BROWSER_FIREFOX}
|
|
968
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
969
|
-
/>
|
|
970
|
-
);
|
|
971
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
972
|
-
expect(windowsExpanded.prop('browserName')).toBe('Mozilla Firefox');
|
|
973
|
-
});
|
|
974
|
-
|
|
975
|
-
it('should pass correct browser display name for Edge', () => {
|
|
976
|
-
const wrapper = mountWithIntl(
|
|
977
|
-
<NotificationContainer
|
|
978
|
-
{...defaultProps}
|
|
979
|
-
selectedOS={OS_WINDOWS}
|
|
980
|
-
selectedBrowser={BROWSER_EDGE}
|
|
981
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
982
|
-
/>
|
|
983
|
-
);
|
|
984
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
985
|
-
expect(windowsExpanded.prop('browserName')).toBe('Microsoft Edge');
|
|
986
|
-
});
|
|
987
|
-
|
|
988
|
-
it('should pass correct browser display name for Opera', () => {
|
|
989
|
-
const wrapper = mountWithIntl(
|
|
990
|
-
<NotificationContainer
|
|
991
|
-
{...defaultProps}
|
|
992
|
-
selectedOS={OS_WINDOWS}
|
|
993
|
-
selectedBrowser={BROWSER_OPERA}
|
|
994
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
995
|
-
/>
|
|
996
|
-
);
|
|
997
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
998
|
-
expect(windowsExpanded.prop('browserName')).toBe('Opera');
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
it('should fallback to browser name when display name is not available', () => {
|
|
1002
|
-
const wrapper = mountWithIntl(
|
|
1003
|
-
<NotificationContainer
|
|
1004
|
-
{...defaultProps}
|
|
1005
|
-
selectedOS={OS_WINDOWS}
|
|
1006
|
-
selectedBrowser="UnknownBrowser"
|
|
1007
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
1008
|
-
/>
|
|
1009
|
-
);
|
|
1010
|
-
const windowsExpanded = wrapper.find(WindowsChromeExpanded);
|
|
1011
|
-
expect(windowsExpanded.prop('browserName')).toBe('UnknownBrowser');
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
describe('Snapshot Tests', () => {
|
|
1016
|
-
it('should match snapshot for macOS Chrome collapsed', () => {
|
|
1017
|
-
const wrapper = shallowWithIntl(
|
|
1018
|
-
<NotificationContainer
|
|
1019
|
-
{...defaultProps}
|
|
1020
|
-
selectedOS={OS_MACOS}
|
|
1021
|
-
selectedBrowser={BROWSER_CHROME}
|
|
1022
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
1023
|
-
/>
|
|
1024
|
-
);
|
|
1025
|
-
expect(wrapper).toMatchSnapshot();
|
|
1026
|
-
});
|
|
1027
|
-
|
|
1028
|
-
it('should match snapshot for macOS Chrome expanded', () => {
|
|
1029
|
-
const wrapper = shallowWithIntl(
|
|
1030
|
-
<NotificationContainer
|
|
1031
|
-
{...defaultProps}
|
|
1032
|
-
selectedOS={OS_MACOS}
|
|
1033
|
-
selectedBrowser={BROWSER_CHROME}
|
|
1034
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
1035
|
-
/>
|
|
1036
|
-
);
|
|
1037
|
-
expect(wrapper).toMatchSnapshot();
|
|
1038
|
-
});
|
|
1039
|
-
|
|
1040
|
-
it('should match snapshot for Windows Chrome expanded', () => {
|
|
1041
|
-
const wrapper = shallowWithIntl(
|
|
1042
|
-
<NotificationContainer
|
|
1043
|
-
{...defaultProps}
|
|
1044
|
-
selectedOS={OS_WINDOWS}
|
|
1045
|
-
selectedBrowser={BROWSER_CHROME}
|
|
1046
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
1047
|
-
/>
|
|
1048
|
-
);
|
|
1049
|
-
expect(wrapper).toMatchSnapshot();
|
|
1050
|
-
});
|
|
1051
|
-
|
|
1052
|
-
it('should match snapshot for Android Mobile Chrome expanded', () => {
|
|
1053
|
-
const wrapper = shallowWithIntl(
|
|
1054
|
-
<NotificationContainer
|
|
1055
|
-
{...defaultProps}
|
|
1056
|
-
selectedOS={OS_ANDROID_MOBILE}
|
|
1057
|
-
selectedBrowser={BROWSER_CHROME}
|
|
1058
|
-
notificationState={NOTIFICATION_STATE_EXPANDED}
|
|
1059
|
-
/>
|
|
1060
|
-
);
|
|
1061
|
-
expect(wrapper).toMatchSnapshot();
|
|
1062
|
-
});
|
|
1063
|
-
|
|
1064
|
-
it('should match snapshot for iOS Safari collapsed', () => {
|
|
1065
|
-
const wrapper = shallowWithIntl(
|
|
1066
|
-
<NotificationContainer
|
|
1067
|
-
{...defaultProps}
|
|
1068
|
-
selectedOS={OS_IOS}
|
|
1069
|
-
selectedBrowser={BROWSER_SAFARI}
|
|
1070
|
-
notificationState={NOTIFICATION_STATE_COLLAPSED}
|
|
1071
|
-
/>
|
|
1072
|
-
);
|
|
1073
|
-
expect(wrapper).toMatchSnapshot();
|
|
1074
|
-
});
|
|
1075
|
-
});
|
|
1076
|
-
});
|
|
1077
|
-
|