@icij/murmur-next 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -19
- package/dist/lib/components/AccordionStep.vue.d.ts +79 -0
- package/dist/lib/components/AccordionWrapper.vue.d.ts +33 -0
- package/dist/lib/components/ActiveTextTruncate.vue.d.ts +101 -0
- package/dist/lib/components/AdvancedLinkForm.vue.d.ts +168 -0
- package/dist/lib/components/Brand.vue.d.ts +55 -0
- package/dist/lib/components/BrandExpansion.vue.d.ts +105 -0
- package/dist/lib/components/ConfirmButton.vue.d.ts +158 -0
- package/dist/lib/components/ContentPlaceholder.vue.d.ts +44 -0
- package/dist/lib/components/CustomPagination.vue.d.ts +130 -0
- package/dist/lib/components/DigitsInput.vue.d.ts +66 -0
- package/dist/lib/components/DonateForm.vue.d.ts +46 -0
- package/dist/lib/components/EmbedForm.vue.d.ts +121 -0
- package/dist/lib/components/EmbeddableFooter.vue.d.ts +103 -0
- package/dist/lib/components/FollowUsPopover.vue.d.ts +16 -0
- package/dist/lib/components/GenericFooter.vue.d.ts +47 -0
- package/dist/lib/components/GenericHeader.vue.d.ts +928 -0
- package/dist/lib/components/HapticCopy.vue.d.ts +156 -0
- package/dist/lib/components/ImddbHeader.vue.d.ts +960 -0
- package/dist/lib/components/OrdinalLegend.vue.d.ts +87 -0
- package/dist/lib/components/RangePicker.vue.d.ts +196 -0
- package/dist/lib/components/ResponsiveIframe.vue.d.ts +45 -0
- package/dist/lib/components/ScaleLegend.vue.d.ts +101 -0
- package/dist/lib/components/SecretInput.vue.d.ts +99 -0
- package/dist/lib/components/SelectableDropdown.vue.d.ts +210 -0
- package/dist/lib/components/SharingOptions.vue.d.ts +153 -0
- package/dist/lib/components/SharingOptionsLink.vue.d.ts +200 -0
- package/dist/lib/components/SignUpForm.vue.d.ts +141 -0
- package/dist/lib/components/SlideUpDown.vue.d.ts +74 -0
- package/dist/lib/components/TexturedDeck.vue.d.ts +89 -0
- package/dist/lib/components/TinyPagination.vue.d.ts +188 -0
- package/dist/lib/composables/chart.d.ts +48 -0
- package/dist/lib/composables/resizeObserver.d.ts +22 -0
- package/dist/lib/composables/sendEmail.d.ts +6 -0
- package/dist/lib/config.d.ts +19 -0
- package/dist/lib/config.default.d.ts +34 -0
- package/dist/lib/datavisualisations/BarChart.vue.d.ts +234 -0
- package/dist/lib/datavisualisations/ColumnChart.vue.d.ts +404 -0
- package/dist/lib/datavisualisations/LineChart.vue.d.ts +200 -0
- package/dist/lib/datavisualisations/StackedBarChart.vue.d.ts +342 -0
- package/dist/lib/datavisualisations/StackedColumnChart.vue.d.ts +412 -0
- package/dist/lib/enums.d.ts +32 -0
- package/dist/lib/i18n.d.ts +4 -0
- package/dist/lib/keys.d.ts +2 -0
- package/dist/lib/main.d.ts +52 -0
- package/dist/lib/maps/ChoroplethMap.vue.d.ts +460 -0
- package/dist/lib/maps/ChoroplethMapAnnotation.vue.d.ts +188 -0
- package/dist/lib/maps/SymbolMap.vue.d.ts +276 -0
- package/dist/lib/murmur.css +1 -0
- package/dist/lib/murmur.js +44661 -0
- package/dist/lib/murmur.js.map +1 -0
- package/dist/lib/murmur.umd.cjs +837 -0
- package/dist/lib/murmur.umd.cjs.map +1 -0
- package/dist/lib/types.d.ts +44 -0
- package/dist/lib/utils/animation.d.ts +8 -0
- package/dist/lib/utils/assets.d.ts +2 -0
- package/dist/lib/utils/clipboard.d.ts +2 -0
- package/dist/lib/utils/iframe-resizer.d.ts +10 -0
- package/dist/lib/utils/placeholder.d.ts +12 -0
- package/dist/lib/utils/placeholderTypes.d.ts +18 -0
- package/dist/lib/utils/strings.d.ts +1 -0
- package/package.json +15 -1
- package/.github/workflows/deploy-github-pages.yaml +0 -50
- package/.storybook/app.scss +0 -14
- package/.storybook/doc_variables.scss +0 -20
- package/.storybook/main.ts +0 -35
- package/.storybook/preview-head.html +0 -2
- package/.storybook/preview.ts +0 -32
- package/deploy.js +0 -15
- package/docs/components/ApiTable.vue +0 -171
- package/docs/components/App.vue +0 -146
- package/docs/components/CollapsibleBlock.vue +0 -122
- package/docs/components/DocsHeader.vue +0 -68
- package/docs/components/DocsMenu.vue +0 -201
- package/docs/components/DocsMenuSection.vue +0 -109
- package/docs/components/EditLink.vue +0 -49
- package/docs/components/OutboundLink.vue +0 -13
- package/docs/components/PalettePresenter.vue +0 -96
- package/docs/components/RepositoryLink.vue +0 -28
- package/docs/components/SampleCard.vue +0 -119
- package/docs/main.js +0 -42
- package/docs/pages/components/accordion/doc.md +0 -96
- package/docs/pages/components/active-text-truncate/doc.md +0 -44
- package/docs/pages/components/advanced-link-form/doc.md +0 -105
- package/docs/pages/components/brand/doc.md +0 -30
- package/docs/pages/components/brand-expansion/doc.md +0 -70
- package/docs/pages/components/confirm-button/doc.md +0 -91
- package/docs/pages/components/content-placeholder/doc.md +0 -16
- package/docs/pages/components/custom-pagination/doc.md +0 -61
- package/docs/pages/components/digits-input/doc.md +0 -28
- package/docs/pages/components/donate-form/doc.md +0 -20
- package/docs/pages/components/embed-form/doc.md +0 -22
- package/docs/pages/components/embeddable-footer/doc.md +0 -60
- package/docs/pages/components/follow-us-popover/doc.md +0 -5
- package/docs/pages/components/generic-footer/doc.md +0 -21
- package/docs/pages/components/generic-header/doc.md +0 -24
- package/docs/pages/components/haptic-copy/doc.md +0 -27
- package/docs/pages/components/imddb-header/doc.md +0 -23
- package/docs/pages/components/ordinal-legend/doc.md +0 -44
- package/docs/pages/components/range-picker/doc.md +0 -86
- package/docs/pages/components/responsive-iframe/doc.md +0 -13
- package/docs/pages/components/scale-legend/doc.md +0 -65
- package/docs/pages/components/secret-input/doc.md +0 -12
- package/docs/pages/components/selectable-dropdown/doc.md +0 -156
- package/docs/pages/components/sharing-options/doc.md +0 -13
- package/docs/pages/components/sharing-options-link/doc.md +0 -36
- package/docs/pages/components/sign-up-form/doc.md +0 -13
- package/docs/pages/components/slide-up-down/doc.md +0 -28
- package/docs/pages/components/textured-deck/doc.md +0 -78
- package/docs/pages/components/tiny-pagination/doc.md +0 -92
- package/docs/pages/datavisualisation/bars/doc.md +0 -110
- package/docs/pages/datavisualisation/columns/doc.md +0 -165
- package/docs/pages/datavisualisation/lines/doc.md +0 -139
- package/docs/pages/datavisualisation/stacked-bar/doc.md +0 -160
- package/docs/pages/datavisualisation/stacked-column/doc.md +0 -191
- package/docs/pages/getting-started/about-icij/doc.md +0 -13
- package/docs/pages/getting-started/custom-bootstrap/doc.md +0 -36
- package/docs/pages/getting-started/installation-guide/doc.md +0 -59
- package/docs/pages/getting-started/internationalization/doc.md +0 -74
- package/docs/pages/maps/choropleth-map/doc.md +0 -420
- package/docs/pages/maps/choropleth-map-annotation/doc.md +0 -373
- package/docs/pages/maps/symbol-map/doc.md +0 -203
- package/docs/pages/structure/breakpoints/doc.md +0 -3
- package/docs/pages/structure/grid/doc.md +0 -3
- package/docs/pages/utilities/assets/doc.md +0 -138
- package/docs/pages/utilities/config/doc.md +0 -52
- package/docs/pages/utilities/iframes/doc.md +0 -3
- package/docs/pages/visual/colors/doc.md +0 -31
- package/docs/pages/visual/iconography/doc.md +0 -56
- package/docs/pages/visual/states/doc.md +0 -77
- package/docs/pages/visual/themes/doc.md +0 -3
- package/docs/pages/visual/typography/doc.md +0 -71
- package/docs/routes.js +0 -25
- package/docs/store/index.js +0 -21
- package/docs/styles/app.scss +0 -36
- package/docs/styles/variables.scss +0 -20
- package/loaders/highlight-loader.js +0 -13
- package/loaders/markdown-loader.js +0 -91
- package/loaders/metadata-loader.js +0 -18
- package/loaders/sass-extract-loader.js +0 -14
- package/loaders/vue-docgen-loader.js +0 -14
- package/plugins/MdPluginTypes.ts +0 -10
- package/plugins/docs.ts +0 -50
- package/plugins/front-matter.ts +0 -36
- package/plugins/highlight.ts +0 -27
- package/plugins/markdown-it/api-table.ts +0 -25
- package/plugins/markdown-it/sample-card.ts +0 -31
- package/plugins/plugin-delete.ts +0 -47
- package/plugins/plugin-docgen.ts +0 -23
- package/plugins/sass-vars.ts +0 -25
- package/plugins/vue-docgen.ts +0 -29
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/img/arrow-bottom.svg +0 -3
- package/public/assets/img/texture-brick-black.jpg +0 -0
- package/public/assets/img/texture-brick.jpg +0 -0
- package/public/assets/img/texture-carbon-black.jpg +0 -0
- package/public/assets/img/texture-carbon.jpg +0 -0
- package/public/assets/img/texture-crack-black.jpg +0 -0
- package/public/assets/img/texture-crack.jpg +0 -0
- package/public/assets/img/texture-rock-black.jpg +0 -0
- package/public/assets/img/texture-rock.jpg +0 -0
- package/public/assets/img/texture-sand-black.jpg +0 -0
- package/public/assets/img/texture-sand.jpg +0 -0
- package/public/assets/img/texture-silk-black.jpg +0 -0
- package/public/assets/img/texture-silk.jpg +0 -0
- package/public/assets/topojson/france-departments.json +0 -1
- package/public/assets/topojson/paris-arrondissements.json +0 -1
- package/public/assets/topojson/world-countries-sans-antarctica.json +0 -1
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/site.webmanifest +0 -1
- package/stories/assets/code-brackets.svg +0 -1
- package/stories/assets/colors.svg +0 -1
- package/stories/assets/comments.svg +0 -1
- package/stories/assets/direction.svg +0 -1
- package/stories/assets/flow.svg +0 -1
- package/stories/assets/plugin.svg +0 -1
- package/stories/assets/repo.svg +0 -1
- package/stories/assets/stackalt.svg +0 -1
- package/stories/getting-started/about-icij.mdx +0 -14
- package/stories/getting-started/custom-bootstrap.mdx +0 -23
- package/stories/getting-started/installation-guide.mdx +0 -62
- package/stories/getting-started/internationalization.mdx +0 -63
- package/stories/murmur/components/AccordionStep.stories.ts +0 -33
- package/stories/murmur/components/AccordionWrapper.stories.ts +0 -69
- package/stories/murmur/components/ActiveTextTruncate.stories.ts +0 -32
- package/stories/murmur/components/AdvancedLinkForm.stories.ts +0 -77
- package/stories/murmur/components/Brand.stories.ts +0 -30
- package/stories/murmur/components/BrandExpansion.stories.ts +0 -41
- package/stories/murmur/components/ConfirmButton.stories.ts +0 -40
- package/stories/murmur/components/ContentPlaceholder.stories.ts +0 -41
- package/stories/murmur/components/CustomPagination.stories.ts +0 -42
- package/stories/murmur/components/DigitsInput.stories.ts +0 -29
- package/stories/murmur/components/DonateForm.stories.ts +0 -29
- package/stories/murmur/components/EmbedForm.stories.ts +0 -35
- package/stories/murmur/components/EmbeddableFooter.stories.ts +0 -59
- package/stories/murmur/components/FollowUsPopover.stories.ts +0 -24
- package/stories/murmur/components/GenericFooter.stories.ts +0 -27
- package/stories/murmur/components/GenericHeader.stories.ts +0 -27
- package/stories/murmur/components/HapticCopy.stories.ts +0 -40
- package/stories/murmur/components/ImddbHeader.stories.ts +0 -27
- package/stories/murmur/components/OrdinalLegend.stories.ts +0 -49
- package/stories/murmur/components/RangePicker.stories.ts +0 -98
- package/stories/murmur/components/ResponsiveIframe.stories.ts +0 -24
- package/stories/murmur/components/ScaleLegend.stories.ts +0 -65
- package/stories/murmur/components/SecretInput.stories.ts +0 -60
- package/stories/murmur/components/SelectableDropdown.stories.ts +0 -143
- package/stories/murmur/components/SharingOptions.stories.ts +0 -32
- package/stories/murmur/components/SharingOptionsLink.stories.ts +0 -53
- package/stories/murmur/components/SignUpForm.stories.ts +0 -51
- package/stories/murmur/components/SlideUpDown.stories.ts +0 -32
- package/stories/murmur/components/TexturedDeck.stories.ts +0 -83
- package/stories/murmur/components/TinyPagination.stories.ts +0 -65
- package/stories/murmur/datavisualisations/BarChart.stories.ts +0 -54
- package/stories/murmur/datavisualisations/ColumnChart.stories.ts +0 -88
- package/stories/murmur/datavisualisations/LineChart.stories.ts +0 -139
- package/stories/murmur/datavisualisations/StackedBarChart.stories.ts +0 -199
- package/stories/murmur/datavisualisations/StackedColumnChart.stories.ts +0 -136
- package/stories/murmur/decorators.ts +0 -108
- package/stories/murmur/maps/ChoroplethMap.stories.ts +0 -440
- package/stories/murmur/maps/ChoroplethMapAnnotation.stories.ts +0 -26
- package/stories/murmur/maps/SymbolMap.stories.ts +0 -24
- package/stories/murmur/utils.ts +0 -7
- package/tests/unit/components/AccordionStep.spec.ts +0 -157
- package/tests/unit/components/AccordionWrapper.spec.ts +0 -57
- package/tests/unit/components/ActiveTextTruncate.spec.js +0 -30
- package/tests/unit/components/AdvancedLinkForm.spec.js +0 -124
- package/tests/unit/components/Brand.spec.js +0 -50
- package/tests/unit/components/ContentPlaceholder.spec.js +0 -29
- package/tests/unit/components/CustomPagination.spec.js +0 -72
- package/tests/unit/components/DigitsInput.spec.ts +0 -157
- package/tests/unit/components/DonateForm.spec.js +0 -149
- package/tests/unit/components/EmbedForm.spec.js +0 -108
- package/tests/unit/components/EmbeddableFooter.spec.js +0 -11
- package/tests/unit/components/Fa.spec.js +0 -18
- package/tests/unit/components/FollowUsPopover.spec.js +0 -29
- package/tests/unit/components/GenericFooter.spec.js +0 -29
- package/tests/unit/components/GenericHeader.spec.js +0 -104
- package/tests/unit/components/HapticCopy.spec.js +0 -123
- package/tests/unit/components/ImddbHeader.spec.js +0 -96
- package/tests/unit/components/OrdinalLegend.spec.js +0 -120
- package/tests/unit/components/RangePicker.spec.ts +0 -87
- package/tests/unit/components/ResponsiveIframe.spec.js +0 -20
- package/tests/unit/components/ScaleLegend.spec.js +0 -139
- package/tests/unit/components/SecretInput.spec.js +0 -81
- package/tests/unit/components/SelectableDropdown.spec.js +0 -160
- package/tests/unit/components/SharingOptions.spec.js +0 -125
- package/tests/unit/components/SharingOptionsLink.spec.js +0 -184
- package/tests/unit/components/SignUpForm.spec.js +0 -145
- package/tests/unit/components/SlideUpDown.spec.js +0 -59
- package/tests/unit/components/TinyPagination.spec.js +0 -46
- package/tests/unit/config.spec.js +0 -136
- package/tests/unit/datavisualisations/BarChart.spec.js +0 -63
- package/tests/unit/datavisualisations/ColumnChart.spec.js +0 -344
- package/tests/unit/datavisualisations/LineChart.spec.js +0 -155
- package/tests/unit/datavisualisations/StackedBarChart.spec.js +0 -294
- package/tests/unit/datavisualisations/StackedColumnChart.spec.js +0 -443
- package/tests/unit/i18n.spec.ts +0 -19
- package/tests/unit/main.spec.js +0 -82
- package/tests/unit/maps/ChoroplethMap.spec.js +0 -214
- package/tests/unit/maps/ChoroplethMapAnnotation.spec.ts +0 -186
- package/tests/unit/maps/SymbolMap.spec.js +0 -92
- package/tests/unit/require.spec.js +0 -22
- package/tests/unit/setup.js +0 -13
- package/tests/unit/utils/assets.spec.js +0 -61
- package/tests/unit/utils/clipboard.spec.js +0 -18
- package/tests/unit/utils/iframe-resizer.spec.js +0 -71
- package/tsconfig.json +0 -35
- package/vite.config.ts +0 -79
- package/vitest.config.ts +0 -19
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {shallowMount, VueWrapper} from "@vue/test-utils"
|
|
2
|
-
import DigitsInput from "@/components/DigitsInput.vue"
|
|
3
|
-
|
|
4
|
-
const createContainer = (tag = 'div') => {
|
|
5
|
-
const container = document.createElement(tag)
|
|
6
|
-
document.body.appendChild(container)
|
|
7
|
-
return container
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
describe('DigitsInput', () => {
|
|
11
|
-
|
|
12
|
-
describe('an instance of 4 digits without initial value', () => {
|
|
13
|
-
|
|
14
|
-
let wrapper: VueWrapper
|
|
15
|
-
const UPDATE_MODEL_VALUE = 'update:modelValue'
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
const propsData = { length: 4, name: 'inputName' }
|
|
19
|
-
const attachTo = createContainer()
|
|
20
|
-
wrapper = shallowMount(DigitsInput as any, { propsData, attachTo })
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('should have 4 visible inputs and a hidden one', () => {
|
|
24
|
-
const inputs = wrapper.findAll('input');
|
|
25
|
-
expect(inputs).toHaveLength(5)
|
|
26
|
-
expect(
|
|
27
|
-
inputs.filter((input:any) => input.attributes().type === 'hidden')
|
|
28
|
-
).toHaveLength(1)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('should not trigger input event yet', () => {
|
|
32
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeFalsy()
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it('should trigger modelValue event when changing the first input', async () => {
|
|
36
|
-
await wrapper.findAll('input').at(0)?.setValue('2')
|
|
37
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
38
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
39
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['2'])
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('should trigger input event when changing the second input', async () => {
|
|
43
|
-
await wrapper.findAll('input').at(1)?.setValue('0')
|
|
44
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
45
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
46
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['0'])
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('should trigger input event when changing the third input', async () => {
|
|
50
|
-
await wrapper.findAll('input').at(2)?.setValue('4')
|
|
51
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
52
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
53
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['4'])
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
it('should trigger input event when changing the fourth input', async () => {
|
|
57
|
-
await wrapper.findAll('input').at(3)?.setValue('8')
|
|
58
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
59
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
60
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['8'])
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('should trigger input even with multiple digits on the first input', async () => {
|
|
64
|
-
await wrapper.findAll('input').at(0)?.setValue('2048')
|
|
65
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
66
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
67
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['2048'])
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('should trigger input even with multiple digits on the first input and truncate to length', async () => {
|
|
71
|
-
await wrapper.findAll('input').at(0)?.setValue('20489')
|
|
72
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
73
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
74
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['2048'])
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('should trigger input even with multiple digits on the first input and ignore spaces', async () => {
|
|
78
|
-
await wrapper.findAll('input').at(0)?.setValue(' 204 8 ')
|
|
79
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeTruthy()
|
|
80
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toHaveLength(1)
|
|
81
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)?.shift()).toEqual(['2048'])
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('should not trigger input when the first input has no numbers', async () => {
|
|
85
|
-
await wrapper.findAll('input').at(0)?.setValue('foo')
|
|
86
|
-
expect(wrapper.emitted(UPDATE_MODEL_VALUE)).toBeFalsy()
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('should spread multiple values in the first input to the next inputs', async () => {
|
|
90
|
-
await wrapper.findAll('input').at(0)?.setValue('2048')
|
|
91
|
-
expect((wrapper.findAll('input').at(0)?.element as HTMLInputElement).value).toBe('2')
|
|
92
|
-
expect((wrapper.findAll('input').at(1)?.element as HTMLInputElement).value).toBe('0')
|
|
93
|
-
expect((wrapper.findAll('input').at(2)?.element as HTMLInputElement).value).toBe('4')
|
|
94
|
-
expect((wrapper.findAll('input').at(3)?.element as HTMLInputElement).value).toBe('8')
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('should spread multiple values in the first input to the next inputs and ignore minuses', async () => {
|
|
98
|
-
await wrapper.findAll('input').at(0)?.setValue('2-0-4-8')
|
|
99
|
-
expect((wrapper.findAll('input').at(0)?.element as HTMLInputElement).value).toBe('2')
|
|
100
|
-
expect((wrapper.findAll('input').at(1)?.element as HTMLInputElement).value).toBe('0')
|
|
101
|
-
expect((wrapper.findAll('input').at(2)?.element as HTMLInputElement).value).toBe('4')
|
|
102
|
-
expect((wrapper.findAll('input').at(3)?.element as HTMLInputElement).value).toBe('8')
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('should spread multiple values in the first input to the next inputs and ignore spaces', async () => {
|
|
106
|
-
await wrapper.findAll('input').at(0)?.setValue('2 0 4 8')
|
|
107
|
-
expect((wrapper.findAll('input').at(0)?.element as HTMLInputElement).value).toBe('2')
|
|
108
|
-
expect((wrapper.findAll('input').at(1)?.element as HTMLInputElement).value).toBe('0')
|
|
109
|
-
expect((wrapper.findAll('input').at(2)?.element as HTMLInputElement).value).toBe('4')
|
|
110
|
-
expect((wrapper.findAll('input').at(3)?.element as HTMLInputElement).value).toBe('8')
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('should spread multiple values in the second input to the next inputs', async () => {
|
|
114
|
-
await wrapper.findAll('input').at(1)?.setValue('204')
|
|
115
|
-
expect((wrapper.findAll('input').at(0)?.element as HTMLInputElement).value).toBe('')
|
|
116
|
-
expect((wrapper.findAll('input').at(1)?.element as HTMLInputElement).value).toBe('2')
|
|
117
|
-
expect((wrapper.findAll('input').at(2)?.element as HTMLInputElement).value).toBe('0')
|
|
118
|
-
expect((wrapper.findAll('input').at(3)?.element as HTMLInputElement).value).toBe('4')
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('should focus to the second input when completing the first with 1 digit', async () => {
|
|
122
|
-
await wrapper.findAll('input').at(1)?.setValue('2')
|
|
123
|
-
const secondInput = wrapper.findAll('input').at(1)?.element as HTMLInputElement
|
|
124
|
-
expect(secondInput).toBe(document.activeElement)
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('should focus to the third input when completing the first with 2 digits', async () => {
|
|
128
|
-
await wrapper.findAll('input').at(1)?.setValue('20')
|
|
129
|
-
const thirdInput = wrapper.findAll('input').at(2)?.element as HTMLInputElement
|
|
130
|
-
expect(thirdInput).toBe(document.activeElement)
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
it('should focus to the fourth input when completing the first with 10 digits', async () => {
|
|
134
|
-
await wrapper.findAll('input').at(1)?.setValue('1234567890')
|
|
135
|
-
const fourthInput = wrapper.findAll('input').at(3)?.element as HTMLInputElement
|
|
136
|
-
expect(fourthInput).toBe(document.activeElement)
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
it('should focus to the previous input when hitting "delete" on the last', async () => {
|
|
140
|
-
await wrapper.findAll('input').at(0)?.setValue('2048')
|
|
141
|
-
await wrapper.findAll('input').at(3)?.setValue('')
|
|
142
|
-
await wrapper.findAll('input').at(3)?.trigger('keyup.delete')
|
|
143
|
-
const thirdInput = wrapper.findAll('input').at(2)?.element as HTMLInputElement
|
|
144
|
-
expect(thirdInput).toBe(document.activeElement)
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
it('should set the name passed in prop to the last input', () => {
|
|
148
|
-
const input = wrapper.findAll('input').at(4);
|
|
149
|
-
expect(input?.attributes().name).toBe('inputName')
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
it('should set the concatenated digits as a value to the last input', async () => {
|
|
153
|
-
await wrapper.findAll('input').at(0)?.setValue('2 0 4 8')
|
|
154
|
-
expect((wrapper.findAll('input').at(4)?.element as HTMLInputElement).value).toBe('2048')
|
|
155
|
-
})
|
|
156
|
-
})
|
|
157
|
-
})
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils'
|
|
2
|
-
import DonateForm from '@/components/DonateForm.vue'
|
|
3
|
-
|
|
4
|
-
describe('DonateForm.vue', () => {
|
|
5
|
-
|
|
6
|
-
const updateAmount= async (wrapper, amount)=> {
|
|
7
|
-
const inputAmount = wrapper.find(".donate-form__payment__input")
|
|
8
|
-
inputAmount.element.value = amount
|
|
9
|
-
await inputAmount.trigger("input")
|
|
10
|
-
}
|
|
11
|
-
it('is a Vue instance', () => {
|
|
12
|
-
const wrapper = shallowMount(DonateForm)
|
|
13
|
-
expect(wrapper.vm).toBeTruthy()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('shows title when props.noTitle isn\'t passed', () => {
|
|
17
|
-
const wrapper = shallowMount(DonateForm)
|
|
18
|
-
expect(wrapper.find('.donate-form__title').exists()).toBeTruthy()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('hides title when props.noTitle is passed', () => {
|
|
22
|
-
const noTitle = true
|
|
23
|
-
const wrapper = shallowMount(DonateForm, {
|
|
24
|
-
propsData: { noTitle }
|
|
25
|
-
})
|
|
26
|
-
expect(wrapper.find('.donate-form__title').exists()).toBeFalsy()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it("updates the amount",async ()=>{
|
|
30
|
-
const wrapper = shallowMount(DonateForm)
|
|
31
|
-
expect(wrapper.vm.amount).toBe(10) //default value
|
|
32
|
-
await updateAmount(wrapper,2)
|
|
33
|
-
expect(wrapper.vm.amount).toBe(2)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('shows a specific message for monthly amount higher or equal than 3', async () => {
|
|
37
|
-
const wrapper = shallowMount(DonateForm)
|
|
38
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
39
|
-
const amount = 3
|
|
40
|
-
await updateAmount(wrapper,amount)
|
|
41
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.conversation'))
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('shows a specific message for monthly amount higher or equal than 15', async () => {
|
|
45
|
-
const wrapper = shallowMount(DonateForm)
|
|
46
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
47
|
-
const amount = 15
|
|
48
|
-
await updateAmount(wrapper,amount)
|
|
49
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.rules'))
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('shows a specific message for monthly amount higher or equal than 50', async () => {
|
|
53
|
-
const wrapper = shallowMount(DonateForm)
|
|
54
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
55
|
-
const amount = 50
|
|
56
|
-
await updateAmount(wrapper,amount)
|
|
57
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.world'))
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('shows the same specific message for monthly amount higher or equal than 150', async () => {
|
|
61
|
-
const wrapper = shallowMount(DonateForm)
|
|
62
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
63
|
-
const amount = 150
|
|
64
|
-
await updateAmount(wrapper,amount)
|
|
65
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.world'))
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('shows a specific message for yearly amount higher or equal than 35', async () => {
|
|
69
|
-
const wrapper = shallowMount(DonateForm)
|
|
70
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
71
|
-
const amount = 35
|
|
72
|
-
await updateAmount(wrapper,amount)
|
|
73
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.conversation'))
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('shows a specific message for yearly amount higher or equal than 180', async () => {
|
|
77
|
-
const wrapper = shallowMount(DonateForm)
|
|
78
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
79
|
-
const amount = 180
|
|
80
|
-
await updateAmount(wrapper,amount)
|
|
81
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.rules'))
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('shows the same specific message for yearly amount higher or equal than 600', async () => {
|
|
85
|
-
const wrapper = shallowMount(DonateForm)
|
|
86
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
87
|
-
const amount = 600
|
|
88
|
-
await updateAmount(wrapper,amount)
|
|
89
|
-
expect(wrapper.vm.changeThe).toBe(wrapper.vm.t('donate-form.result.world'))
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('changes the amount for conversation level when changing the period', async () => {
|
|
93
|
-
const wrapper = shallowMount(DonateForm)
|
|
94
|
-
|
|
95
|
-
await wrapper.find(".frequency-onetime").trigger("click")
|
|
96
|
-
expect(wrapper.vm.amount).toBe(50)
|
|
97
|
-
|
|
98
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
99
|
-
expect(wrapper.vm.amount).toBe(10)
|
|
100
|
-
|
|
101
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
102
|
-
expect(wrapper.vm.amount).toBe(25)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('changes the amount for rules level when changing the period', async () => {
|
|
106
|
-
const wrapper = shallowMount(DonateForm)
|
|
107
|
-
await wrapper.find(".frequency-onetime").trigger("click")
|
|
108
|
-
|
|
109
|
-
wrapper.vm.selectLevel( 'rules')
|
|
110
|
-
|
|
111
|
-
expect(wrapper.vm.amount).toBe(200)
|
|
112
|
-
|
|
113
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
114
|
-
wrapper.vm.selectLevel( 'rules')
|
|
115
|
-
expect(wrapper.vm.amount).toBe(25)
|
|
116
|
-
|
|
117
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
118
|
-
wrapper.vm.selectLevel( 'rules')
|
|
119
|
-
expect(wrapper.vm.amount).toBe(180)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it('changes the amount for world level when changing the period', async () => {
|
|
123
|
-
const wrapper = shallowMount(DonateForm)
|
|
124
|
-
await wrapper.find(".frequency-onetime").trigger("click")
|
|
125
|
-
wrapper.vm.selectLevel( 'world')
|
|
126
|
-
|
|
127
|
-
expect(wrapper.vm.amount).toBe(600)
|
|
128
|
-
|
|
129
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
130
|
-
wrapper.vm.selectLevel( 'world')
|
|
131
|
-
|
|
132
|
-
expect(wrapper.vm.amount).toBe(100)
|
|
133
|
-
|
|
134
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
135
|
-
wrapper.vm.selectLevel( 'world')
|
|
136
|
-
|
|
137
|
-
expect(wrapper.vm.amount).toBe(600)
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
it('doesn\'t change the amount when changing the period if the form isn\'t pristine', async () => {
|
|
141
|
-
const wrapper = shallowMount(DonateForm)
|
|
142
|
-
await wrapper.find(".frequency-yearly").trigger("click")
|
|
143
|
-
expect(wrapper.vm.amount).toBe(25)
|
|
144
|
-
const inputAmount = wrapper.find(".donate-form__payment__input")
|
|
145
|
-
inputAmount.element.dispatchEvent(new Event('change', { 'bubbles': true }))
|
|
146
|
-
await wrapper.find(".frequency-monthly").trigger("click")
|
|
147
|
-
expect(wrapper.vm.amount).toBe(25)
|
|
148
|
-
})
|
|
149
|
-
})
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import startsWith from 'lodash/startsWith'
|
|
2
|
-
import { shallowMount, mount } from '@vue/test-utils'
|
|
3
|
-
import EmbedForm from '@/components/EmbedForm.vue'
|
|
4
|
-
|
|
5
|
-
describe('EmbedForm.vue', () => {
|
|
6
|
-
const global = {stubs:{HapticCopy:true}}
|
|
7
|
-
const propsData = {
|
|
8
|
-
url: 'https://projects.icij.org/the-implant-files/graphics/'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
it('is a Vue instance', () => {
|
|
12
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
13
|
-
expect(wrapper.vm).toBeTruthy()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('shows title when props.noTitle isn\'t passed', () => {
|
|
17
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
18
|
-
expect(wrapper.find('.embed-form__heading').exists()).toBeTruthy()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('hides show title when props.noTitle is passed', () => {
|
|
22
|
-
const noTitle = true
|
|
23
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
24
|
-
propsData: { noTitle, ...propsData }
|
|
25
|
-
})
|
|
26
|
-
expect(wrapper.find('.embed-form__heading').exists()).toBeFalsy()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('shows a preview panel when props.noPreview isn\'t passed', () => {
|
|
30
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
31
|
-
expect(wrapper.find('.embed-form__preview').exists()).toBeTruthy()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('hides a show preview panel when props.noPreview is passed', () => {
|
|
35
|
-
const noPreview = true
|
|
36
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
37
|
-
propsData: { noPreview, ...propsData }, global
|
|
38
|
-
})
|
|
39
|
-
expect(wrapper.find('.embed-form__preview').exists()).toBeFalsy()
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('shows a preview panel with an iframe targeting the passed props.url', () => {
|
|
43
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
44
|
-
const src =wrapper.element.querySelector('.embed-form__preview iframe').src
|
|
45
|
-
expect(src).toBe(propsData.url)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('shows a preview panel with an iframe targeting the passed props.url without pym params', () => {
|
|
49
|
-
const url = 'https://projects.icij.org/the-implant-files/graphics/?initialWidth=720&childId=example-graphic'
|
|
50
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
51
|
-
propsData: { url }, global
|
|
52
|
-
})
|
|
53
|
-
const src =wrapper.element.querySelector('.embed-form__preview iframe').src
|
|
54
|
-
expect(src).toBe('https://projects.icij.org/the-implant-files/graphics/')
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('renders iframe height to 150 according to the passed props.height', () => {
|
|
58
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
59
|
-
propsData: { height: 150, ...propsData }, global
|
|
60
|
-
})
|
|
61
|
-
const height = wrapper.element.querySelector('.embed-form__preview iframe').height
|
|
62
|
-
expect(height).toBe("150")
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('renders iframe height to 250 according to the passed props.height', () => {
|
|
66
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
67
|
-
propsData: { height: 250, ...propsData }, global
|
|
68
|
-
})
|
|
69
|
-
const height = wrapper.element.querySelector('.embed-form__preview iframe').height
|
|
70
|
-
expect(height).toBe("250")
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('renders iframe width to 100% when no value is passed to props.width', () => {
|
|
74
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
75
|
-
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
|
|
76
|
-
expect(width).toBe("100%")
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('renders iframe width to 150 according to the passed props.width', () => {
|
|
80
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
81
|
-
propsData: { width: 150, ...propsData }, global
|
|
82
|
-
})
|
|
83
|
-
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
|
|
84
|
-
expect(width).toBe("150")
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('renders iframe width to 250 according to the passed props.width', () => {
|
|
88
|
-
const wrapper = shallowMount(EmbedForm, {
|
|
89
|
-
propsData: { width: 250, ...propsData }, global
|
|
90
|
-
})
|
|
91
|
-
const width = wrapper.element.querySelector('.embed-form__preview iframe').width
|
|
92
|
-
expect(width).toBe("250")
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it('renders a responsive iframe when `responsiveCheck` is true', () => {
|
|
96
|
-
const wrapper = shallowMount(EmbedForm, { propsData, global })
|
|
97
|
-
expect(startsWith(wrapper.vm.embedCode(), '<iframe ')).toBeTruthy()
|
|
98
|
-
wrapper.vm.responsiveCheck = true
|
|
99
|
-
expect(startsWith(wrapper.vm.embedCode(), '<script ')).toBeTruthy()
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('mount', () => {
|
|
103
|
-
const wrapper = mount(EmbedForm, { propsData, global })
|
|
104
|
-
expect(startsWith(wrapper.vm.embedCode(), '<iframe ')).toBeTruthy()
|
|
105
|
-
wrapper.vm.responsiveCheck = true
|
|
106
|
-
expect(startsWith(wrapper.vm.embedCode(), '<script ')).toBeTruthy()
|
|
107
|
-
})
|
|
108
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils'
|
|
2
|
-
import EmbeddableFooter from '@/components/EmbeddableFooter.vue'
|
|
3
|
-
|
|
4
|
-
describe('EmbeddableFooter.vue', () => {
|
|
5
|
-
|
|
6
|
-
it('is a Vue instance', () => {
|
|
7
|
-
const wrapper = shallowMount(EmbeddableFooter)
|
|
8
|
-
expect(wrapper.vm).toBeTruthy()
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes'
|
|
2
|
-
import { library, default as Fa } from '@/components/Fa'
|
|
3
|
-
|
|
4
|
-
describe('Fa', () => {
|
|
5
|
-
|
|
6
|
-
it('is a FontAwesomeIcon component', () => {
|
|
7
|
-
expect(Fa.name).toBe('FontAwesomeIcon')
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('has a library that define a `add` method', () => {
|
|
11
|
-
expect(library.add).toBeDefined()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('has a library that `add` method', () => {
|
|
15
|
-
library.add(faTimes)
|
|
16
|
-
expect(library.definitions.fas.times).toBeDefined()
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { mount, shallowMount } from '@vue/test-utils'
|
|
2
|
-
import FollowUsPopover from '@/components/FollowUsPopover.vue'
|
|
3
|
-
|
|
4
|
-
describe('FollowUsPopover.vue', () => {
|
|
5
|
-
|
|
6
|
-
it('is a Vue instance', () => {
|
|
7
|
-
const wrapper = mount(FollowUsPopover)
|
|
8
|
-
expect(wrapper.vm).toBeTruthy()
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('has a sign-up form', () => {
|
|
12
|
-
const wrapper = shallowMount(FollowUsPopover)
|
|
13
|
-
expect(wrapper.find('sign-up-form-stub').exists()).toBeTruthy()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('has a close button', () => {
|
|
17
|
-
const wrapper = shallowMount(FollowUsPopover)
|
|
18
|
-
expect(wrapper.find('.follow-us__close').exists()).toBeTruthy()
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('emits an event when clicking on close button', async () => {
|
|
22
|
-
const wrapper = shallowMount(FollowUsPopover)
|
|
23
|
-
const btn = wrapper.find('.follow-us__close')
|
|
24
|
-
expect(wrapper.emitted('update:close')).toBeFalsy()
|
|
25
|
-
await btn.trigger('click')
|
|
26
|
-
expect(wrapper.emitted('update:close')).toBeTruthy()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import GenericFooter from '@/components/GenericFooter.vue'
|
|
3
|
-
|
|
4
|
-
describe('GenericFooter.vue', () => {
|
|
5
|
-
|
|
6
|
-
const propsData = { version: '1.0.0' }
|
|
7
|
-
|
|
8
|
-
it('is a Vue instance', () => {
|
|
9
|
-
const wrapper = mount(GenericFooter)
|
|
10
|
-
expect(wrapper.vm).toBeTruthy()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('renders the passed props.version', () => {
|
|
14
|
-
const wrapper = mount(GenericFooter, { propsData })
|
|
15
|
-
expect(wrapper.find('.generic-footer__version').text()).toBe('Version 1.0.0')
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('doesn\'t render the version', () => {
|
|
19
|
-
const wrapper = mount(GenericFooter)
|
|
20
|
-
expect(wrapper.find('.generic-footer__version').exists()).toBeFalsy()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('renders the current year', () => {
|
|
24
|
-
const wrapper = mount(GenericFooter)
|
|
25
|
-
const currentYear = (new Date()).getFullYear()
|
|
26
|
-
expect(wrapper.find('.generic-footer__year').text()).toBe(String(currentYear))
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
})
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { shallowMount, mount} from '@vue/test-utils'
|
|
2
|
-
import GenericHeader from '@/components/GenericHeader.vue'
|
|
3
|
-
|
|
4
|
-
describe('GenericHeader.vue', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
it('is a Vue instance', () => {
|
|
8
|
-
const wrapper = shallowMount(GenericHeader)
|
|
9
|
-
expect(wrapper.vm).toBeTruthy()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
it('renders the header as a `headroom` component', () => {
|
|
13
|
-
const wrapper = shallowMount(GenericHeader)
|
|
14
|
-
expect(wrapper.find('#generic-header').element.tagName).toBe('HEADROOM-STUB')
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('renders the header as a div', () => {
|
|
18
|
-
const noHeadroom = true
|
|
19
|
-
const wrapper = shallowMount(GenericHeader, {
|
|
20
|
-
propsData: { noHeadroom }
|
|
21
|
-
})
|
|
22
|
-
expect(wrapper.find('#generic-header').element.tagName).toBe('DIV')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('sets the header position to `fixed` by default', () => {
|
|
26
|
-
const wrapper = shallowMount(GenericHeader)
|
|
27
|
-
expect(wrapper.find('#generic-header').element.style.position).toBe('fixed')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('sets the header position to `relative`', () => {
|
|
31
|
-
const position = 'relative'
|
|
32
|
-
const wrapper = shallowMount(GenericHeader, {
|
|
33
|
-
propsData: { position }
|
|
34
|
-
})
|
|
35
|
-
expect(wrapper.find('#generic-header').element.style.position).toBe(position)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('sets the header position to `absolute`', () => {
|
|
39
|
-
const position = 'absolute'
|
|
40
|
-
const wrapper = shallowMount(GenericHeader, {
|
|
41
|
-
propsData: { position }
|
|
42
|
-
})
|
|
43
|
-
expect(wrapper.find('#generic-header').element.style.position).toBe(position)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('renders home link to the default value', () => {
|
|
47
|
-
const homeUrl = "http://localhost:3000/"
|
|
48
|
-
const wrapper = shallowMount(GenericHeader,{global:{renderStubDefaultSlot:true}})
|
|
49
|
-
expect(wrapper.find('.generic-header__brand').element.href).toBe(homeUrl)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('renders home link to https://icij.org/', () => {
|
|
53
|
-
const homeUrl = 'https://icij.org/'
|
|
54
|
-
const wrapper = shallowMount(GenericHeader, {
|
|
55
|
-
propsData: { homeUrl }, global:{renderStubDefaultSlot:true}
|
|
56
|
-
})
|
|
57
|
-
expect(wrapper.find('.generic-header__brand').element.href).toBe(homeUrl)
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('renders home link to https://pirhoo.com/', () => {
|
|
61
|
-
const homeUrl = 'https://pirhoo.com/'
|
|
62
|
-
const wrapper = shallowMount(GenericHeader, {
|
|
63
|
-
propsData: { homeUrl }, global:{renderStubDefaultSlot:true}
|
|
64
|
-
})
|
|
65
|
-
expect(wrapper.find('.generic-header__brand').element.href).toBe(homeUrl)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('renders the navbar as `collapse` by default', () => {
|
|
69
|
-
const wrapper = shallowMount(GenericHeader, {global:{renderStubDefaultSlot:true}})
|
|
70
|
-
expect(wrapper.find('.navbar-collapse').classes('collapse')).toBeTruthy()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('toggles the navbar on navbarToggler click', async () => {
|
|
74
|
-
const wrapper = shallowMount(GenericHeader, {global:{renderStubDefaultSlot:true}})
|
|
75
|
-
expect(wrapper.find('.navbar-collapse').classes('collapse')).toBeTruthy()
|
|
76
|
-
const navbarToggler = wrapper.find(".navbar-toggler");
|
|
77
|
-
await navbarToggler.trigger("click")
|
|
78
|
-
expect(wrapper.find('.navbar-collapse').classes('collapse')).toBeFalsy()
|
|
79
|
-
expect(wrapper.vm.showFollowUsPopover).toBe(false)
|
|
80
|
-
await navbarToggler.trigger("click")
|
|
81
|
-
expect(wrapper.find('.navbar-collapse').classes('collapse')).toBeTruthy()
|
|
82
|
-
})
|
|
83
|
-
it('hides popover if shown when navbar is collapsed', async () => {
|
|
84
|
-
const wrapper = mount(GenericHeader, {global:{renderStubDefaultSlot:true, stubs: { teleport: true, BPopover:true , FollowUsPopover:true}}})
|
|
85
|
-
const popovertoggler = wrapper.find("#follow-us-toggler")
|
|
86
|
-
await popovertoggler.trigger("mouseenter")
|
|
87
|
-
//given popover shown
|
|
88
|
-
expect(wrapper.vm.showFollowUsPopover).toBe(true)
|
|
89
|
-
const navbarToggler = wrapper.find(".navbar-toggler");
|
|
90
|
-
//when show navbar
|
|
91
|
-
await navbarToggler.trigger("click")
|
|
92
|
-
// popover should be hidden
|
|
93
|
-
expect(wrapper.vm.showFollowUsPopover).toBe(false)
|
|
94
|
-
})
|
|
95
|
-
it('should show on mouseenter then hide popover', async () => {
|
|
96
|
-
const wrapper = mount(GenericHeader, {global:{renderStubDefaultSlot:true, stubs: { teleport: true, BPopover:true , FollowUsPopover:true}}})
|
|
97
|
-
const popovertoggler = wrapper.find("#follow-us-toggler")
|
|
98
|
-
await popovertoggler.trigger("mouseenter")
|
|
99
|
-
expect(wrapper.vm.showFollowUsPopover).toBe(true)
|
|
100
|
-
|
|
101
|
-
wrapper.vm.closeFollowUsPopover()
|
|
102
|
-
expect(wrapper.vm.showFollowUsPopover).toBe(false)
|
|
103
|
-
})
|
|
104
|
-
})
|