@fmidev/smartmet-alert-client 4.4.19 → 4.7.0-beta.0

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.
Files changed (123) hide show
  1. package/.eslintignore +2 -14
  2. package/.github/workflows/test.yaml +26 -0
  3. package/.nvmrc +1 -0
  4. package/AGENTS.md +26 -0
  5. package/index.html +1 -1
  6. package/package.json +80 -22
  7. package/src/AlertClientVue.vue +160 -0
  8. package/src/App.vue +154 -296
  9. package/src/assets/img/ui/arrow-down.svg +4 -11
  10. package/src/assets/img/ui/arrow-up.svg +4 -11
  11. package/src/assets/img/ui/clear.svg +7 -21
  12. package/src/assets/img/ui/close.svg +4 -15
  13. package/src/assets/img/ui/toggle-selected.svg +5 -6
  14. package/src/assets/img/ui/toggle-unselected.svg +5 -6
  15. package/src/assets/img/warning/cold-weather.svg +3 -6
  16. package/src/assets/img/warning/flood-level-3.svg +4 -7
  17. package/src/assets/img/warning/forest-fire-weather.svg +2 -6
  18. package/src/assets/img/warning/grass-fire-weather.svg +2 -6
  19. package/src/assets/img/warning/hot-weather.svg +3 -6
  20. package/src/assets/img/warning/pedestrian-safety.svg +3 -7
  21. package/src/assets/img/warning/rain.svg +2 -7
  22. package/src/assets/img/warning/sea-icing.svg +2 -6
  23. package/src/assets/img/warning/sea-thunder-storm.svg +2 -5
  24. package/src/assets/img/warning/sea-water-height-high-water.svg +3 -8
  25. package/src/assets/img/warning/sea-water-height-shallow-water.svg +3 -7
  26. package/src/assets/img/warning/sea-wave-height.svg +4 -7
  27. package/src/assets/img/warning/sea-wind-legend.svg +2 -5
  28. package/src/assets/img/warning/sea-wind.svg +2 -5
  29. package/src/assets/img/warning/several.svg +2 -5
  30. package/src/assets/img/warning/thunder-storm.svg +2 -5
  31. package/src/assets/img/warning/traffic-weather.svg +2 -6
  32. package/src/assets/img/warning/uv-note.svg +2 -6
  33. package/src/assets/img/warning/wind.svg +2 -5
  34. package/src/components/AlertClient.vue +330 -251
  35. package/src/components/CollapsiblePanel.vue +281 -0
  36. package/src/components/DayLarge.vue +146 -110
  37. package/src/components/DaySmall.vue +97 -81
  38. package/src/components/Days.vue +229 -159
  39. package/src/components/DescriptionWarning.vue +63 -38
  40. package/src/components/GrayScaleToggle.vue +58 -54
  41. package/src/components/Legend.vue +102 -325
  42. package/src/components/MapLarge.vue +574 -351
  43. package/src/components/MapSmall.vue +137 -122
  44. package/src/components/PopupRow.vue +24 -12
  45. package/src/components/Region.vue +168 -118
  46. package/src/components/RegionWarning.vue +40 -33
  47. package/src/components/Regions.vue +189 -105
  48. package/src/components/Warning.vue +70 -45
  49. package/src/components/Warnings.vue +136 -72
  50. package/src/composables/useAlertClient.ts +360 -0
  51. package/src/composables/useConfig.ts +573 -0
  52. package/src/composables/useFields.ts +66 -0
  53. package/src/composables/useI18n.ts +62 -0
  54. package/src/composables/useKeyCodes.ts +16 -0
  55. package/src/composables/useMapPaths.ts +477 -0
  56. package/src/composables/useUtils.ts +683 -0
  57. package/src/composables/useWarningsProcessor.ts +1007 -0
  58. package/src/data/geometries.json +993 -0
  59. package/src/{main.js → main.ts} +1 -0
  60. package/src/mixins/geojsonsvg.d.ts +57 -0
  61. package/src/mixins/geojsonsvg.js +5 -3
  62. package/src/plugins/index.ts +5 -0
  63. package/src/scss/_utilities.scss +193 -0
  64. package/src/scss/constants.scss +2 -1
  65. package/src/scss/warningImages.scss +8 -3
  66. package/src/types/index.ts +509 -0
  67. package/src/vite-env.d.ts +23 -0
  68. package/src/vue.ts +41 -0
  69. package/svgo.config.js +45 -0
  70. package/tests/README.md +430 -0
  71. package/tests/fixtures/mockWarningData.ts +152 -0
  72. package/tests/integration/warning-flow.spec.ts +445 -0
  73. package/tests/setup.ts +41 -0
  74. package/tests/unit/components/AlertClient.spec.ts +701 -0
  75. package/tests/unit/components/DayLarge.spec.ts +348 -0
  76. package/tests/unit/components/DaySmall.spec.ts +352 -0
  77. package/tests/unit/components/Days.spec.ts +548 -0
  78. package/tests/unit/components/DescriptionWarning.spec.ts +385 -0
  79. package/tests/unit/components/GrayScaleToggle.spec.ts +318 -0
  80. package/tests/unit/components/Legend.spec.ts +295 -0
  81. package/tests/unit/components/MapLarge.spec.ts +448 -0
  82. package/tests/unit/components/MapSmall.spec.ts +367 -0
  83. package/tests/unit/components/PopupRow.spec.ts +270 -0
  84. package/tests/unit/components/Region.spec.ts +373 -0
  85. package/tests/unit/components/RegionWarning.snapshot.spec.ts +361 -0
  86. package/tests/unit/components/RegionWarning.spec.ts +381 -0
  87. package/tests/unit/components/Regions.spec.ts +503 -0
  88. package/tests/unit/components/Warning.snapshot.spec.ts +483 -0
  89. package/tests/unit/components/Warning.spec.ts +489 -0
  90. package/tests/unit/components/Warnings.spec.ts +343 -0
  91. package/tests/unit/components/__snapshots__/RegionWarning.snapshot.spec.ts.snap +41 -0
  92. package/tests/unit/components/__snapshots__/Warning.snapshot.spec.ts.snap +433 -0
  93. package/tests/unit/composables/useConfig.spec.ts +279 -0
  94. package/tests/unit/composables/useI18n.spec.ts +116 -0
  95. package/tests/unit/composables/useKeyCodes.spec.ts +27 -0
  96. package/tests/unit/composables/useUtils.spec.ts +213 -0
  97. package/tsconfig.json +43 -0
  98. package/tsconfig.node.json +11 -0
  99. package/vite.config.js +96 -26
  100. package/vitest.config.js +40 -0
  101. package/dist/favicon.ico +0 -0
  102. package/dist/index.dark.html +0 -20
  103. package/dist/index.en.html +0 -15
  104. package/dist/index.fi.html +0 -15
  105. package/dist/index.html +0 -15
  106. package/dist/index.js +0 -281
  107. package/dist/index.mjs +0 -281
  108. package/dist/index.mjs.map +0 -1
  109. package/dist/index.relative.html +0 -19
  110. package/dist/index.start.html +0 -20
  111. package/dist/index.sv.html +0 -15
  112. package/playwright.config.ts +0 -18
  113. package/public/index.relative.html +0 -19
  114. package/public/index.start.html +0 -20
  115. package/src/mixins/config.js +0 -1378
  116. package/src/mixins/fields.js +0 -26
  117. package/src/mixins/i18n.js +0 -25
  118. package/src/mixins/keycodes.js +0 -10
  119. package/src/mixins/panzoom.js +0 -900
  120. package/src/mixins/utils.js +0 -900
  121. package/src/plugins/index.js +0 -3
  122. package/test/snapshot.test.ts +0 -126
  123. package/vitest.config.ts +0 -6
@@ -0,0 +1,373 @@
1
+ import { describe, it, expect, afterEach } from 'vitest'
2
+ import { mount, VueWrapper } from '@vue/test-utils'
3
+ import Region from '@/components/Region.vue'
4
+ import type {
5
+ RegionWarningItem,
6
+ WarningsMap,
7
+ Warning,
8
+ Theme,
9
+ Language,
10
+ } from '@/types'
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ type ComponentInstance = any
14
+
15
+ const mockWarning: Warning = {
16
+ type: 'wind',
17
+ id: 'test-warning-1',
18
+ regions: { 'county.1': true },
19
+ covRegions: new Map(),
20
+ coveragesLarge: [],
21
+ coveragesSmall: [],
22
+ effectiveFrom: '2025-10-31T12:00:00Z',
23
+ effectiveUntil: '2025-11-01T12:00:00Z',
24
+ effectiveDays: [true, true, false, false, false],
25
+ validInterval: '31.10.2025 14:00 – 1.11.2025 14:00',
26
+ severity: 3,
27
+ direction: 270,
28
+ value: 25,
29
+ text: '25',
30
+ info: {
31
+ fi: 'Kovaa tuulta',
32
+ sv: 'Hårt blåsväder',
33
+ en: 'Strong wind',
34
+ },
35
+ link: '',
36
+ linkText: '',
37
+ }
38
+
39
+ const mockRegionWarnings: RegionWarningItem[] = [
40
+ {
41
+ type: 'wind',
42
+ identifiers: ['test-warning-1'],
43
+ coverage: 100,
44
+ },
45
+ ]
46
+
47
+ const mockWarnings: WarningsMap = {
48
+ 'test-warning-1': mockWarning,
49
+ }
50
+
51
+ describe('Region.vue', () => {
52
+ let wrapper: VueWrapper | null = null
53
+
54
+ afterEach(() => {
55
+ if (wrapper) {
56
+ wrapper.unmount()
57
+ wrapper = null
58
+ }
59
+ })
60
+
61
+ describe('Component mounting', () => {
62
+ it('should mount with required props', () => {
63
+ wrapper = mount(Region, {
64
+ props: {
65
+ type: 'land',
66
+ code: 'county.1',
67
+ name: 'Uusimaa',
68
+ input: mockRegionWarnings,
69
+ warnings: mockWarnings,
70
+ theme: 'light-theme' as Theme,
71
+ language: 'fi' as Language,
72
+ },
73
+ })
74
+
75
+ expect(wrapper.exists()).toBe(true)
76
+ })
77
+
78
+ it('should mount with minimal props', () => {
79
+ wrapper = mount(Region, {
80
+ props: {},
81
+ })
82
+
83
+ expect(wrapper.exists()).toBe(true)
84
+ })
85
+ })
86
+
87
+ describe('Computed properties', () => {
88
+ it('should compute identifier from code', () => {
89
+ wrapper = mount(Region, {
90
+ props: {
91
+ code: 'county.1',
92
+ },
93
+ })
94
+
95
+ expect((wrapper.vm as ComponentInstance).identifier).toBe(
96
+ 'accordion-item-county.1'
97
+ )
98
+ })
99
+
100
+ it('should compute regionName from translations', () => {
101
+ wrapper = mount(Region, {
102
+ props: {
103
+ name: 'Uusimaa',
104
+ language: 'fi' as Language,
105
+ },
106
+ })
107
+
108
+ expect(typeof (wrapper.vm as ComponentInstance).regionName).toBe('string')
109
+ })
110
+
111
+ it('should compute warningsSummary from input and warnings', () => {
112
+ wrapper = mount(Region, {
113
+ props: {
114
+ input: mockRegionWarnings,
115
+ warnings: mockWarnings,
116
+ },
117
+ })
118
+
119
+ const summary = (wrapper.vm as ComponentInstance).warningsSummary
120
+ expect(Array.isArray(summary)).toBe(true)
121
+ expect(summary.length).toBe(1)
122
+ })
123
+
124
+ it('should return empty warningsSummary when no warnings match', () => {
125
+ wrapper = mount(Region, {
126
+ props: {
127
+ input: mockRegionWarnings,
128
+ warnings: {},
129
+ },
130
+ })
131
+
132
+ expect((wrapper.vm as ComponentInstance).warningsSummary).toEqual([])
133
+ })
134
+
135
+ it('should compute reducedWarnings from input and warnings', () => {
136
+ wrapper = mount(Region, {
137
+ props: {
138
+ input: mockRegionWarnings,
139
+ warnings: mockWarnings,
140
+ },
141
+ })
142
+
143
+ const reduced = (wrapper.vm as ComponentInstance).reducedWarnings
144
+ expect(Array.isArray(reduced)).toBe(true)
145
+ })
146
+
147
+ it('should compute ariaButton from translations', () => {
148
+ wrapper = mount(Region, {
149
+ props: {
150
+ name: 'Uusimaa',
151
+ language: 'fi' as Language,
152
+ },
153
+ })
154
+
155
+ expect(typeof (wrapper.vm as ComponentInstance).ariaButton).toBe('string')
156
+ })
157
+
158
+ it('should compute ariaInfo from warnings', () => {
159
+ wrapper = mount(Region, {
160
+ props: {
161
+ input: mockRegionWarnings,
162
+ warnings: mockWarnings,
163
+ language: 'fi' as Language,
164
+ },
165
+ })
166
+
167
+ expect(Array.isArray((wrapper.vm as ComponentInstance).ariaInfo)).toBe(
168
+ true
169
+ )
170
+ })
171
+ })
172
+
173
+ describe('State management', () => {
174
+ it('should start with open state as false', () => {
175
+ wrapper = mount(Region, {
176
+ props: {},
177
+ })
178
+
179
+ expect((wrapper.vm as ComponentInstance).open).toBe(false)
180
+ })
181
+
182
+ it('should toggle open state on onRegionToggle', () => {
183
+ wrapper = mount(Region, {
184
+ props: {},
185
+ })
186
+
187
+ expect((wrapper.vm as ComponentInstance).open).toBe(false)
188
+ ;(wrapper.vm as ComponentInstance).onRegionToggle()
189
+
190
+ expect((wrapper.vm as ComponentInstance).open).toBe(true)
191
+ ;(wrapper.vm as ComponentInstance).onRegionToggle()
192
+
193
+ expect((wrapper.vm as ComponentInstance).open).toBe(false)
194
+ })
195
+ })
196
+
197
+ describe('Props handling', () => {
198
+ it('should accept type prop', () => {
199
+ wrapper = mount(Region, {
200
+ props: {
201
+ type: 'sea',
202
+ },
203
+ })
204
+
205
+ expect((wrapper.vm as ComponentInstance).type).toBe('sea')
206
+ })
207
+
208
+ it('should accept code prop', () => {
209
+ wrapper = mount(Region, {
210
+ props: {
211
+ code: 'county.2',
212
+ },
213
+ })
214
+
215
+ expect((wrapper.vm as ComponentInstance).code).toBe('county.2')
216
+ })
217
+
218
+ it('should accept name prop', () => {
219
+ wrapper = mount(Region, {
220
+ props: {
221
+ name: 'Varsinais-Suomi',
222
+ },
223
+ })
224
+
225
+ expect((wrapper.vm as ComponentInstance).name).toBe('Varsinais-Suomi')
226
+ })
227
+
228
+ it('should accept input prop', () => {
229
+ wrapper = mount(Region, {
230
+ props: {
231
+ input: mockRegionWarnings,
232
+ },
233
+ })
234
+
235
+ expect((wrapper.vm as ComponentInstance).input).toEqual(
236
+ mockRegionWarnings
237
+ )
238
+ })
239
+
240
+ it('should accept warnings prop', () => {
241
+ wrapper = mount(Region, {
242
+ props: {
243
+ warnings: mockWarnings,
244
+ },
245
+ })
246
+
247
+ expect(wrapper.exists()).toBe(true)
248
+ })
249
+ })
250
+
251
+ describe('Theme support', () => {
252
+ it('should accept theme prop', () => {
253
+ wrapper = mount(Region, {
254
+ props: {
255
+ theme: 'dark-theme' as Theme,
256
+ },
257
+ })
258
+
259
+ expect((wrapper.vm as ComponentInstance).theme).toBe('dark-theme')
260
+ })
261
+
262
+ it('should default to light-theme', () => {
263
+ wrapper = mount(Region, {
264
+ props: {},
265
+ })
266
+
267
+ expect((wrapper.vm as ComponentInstance).theme).toBe('light-theme')
268
+ })
269
+ })
270
+
271
+ describe('Language support', () => {
272
+ it('should support Finnish language', () => {
273
+ wrapper = mount(Region, {
274
+ props: {
275
+ language: 'fi' as Language,
276
+ },
277
+ })
278
+
279
+ expect(wrapper.exists()).toBe(true)
280
+ })
281
+
282
+ it('should support Swedish language', () => {
283
+ wrapper = mount(Region, {
284
+ props: {
285
+ language: 'sv' as Language,
286
+ },
287
+ })
288
+
289
+ expect(wrapper.exists()).toBe(true)
290
+ })
291
+
292
+ it('should support English language', () => {
293
+ wrapper = mount(Region, {
294
+ props: {
295
+ language: 'en' as Language,
296
+ },
297
+ })
298
+
299
+ expect(wrapper.exists()).toBe(true)
300
+ })
301
+ })
302
+
303
+ describe('Accessibility', () => {
304
+ it('should have accordion button with correct aria attributes', () => {
305
+ wrapper = mount(Region, {
306
+ props: {
307
+ code: 'county.1',
308
+ },
309
+ })
310
+
311
+ const button = wrapper.find('.accordion-trigger')
312
+ expect(button.attributes('aria-expanded')).toBe('false')
313
+ expect(button.attributes('aria-controls')).toBe(
314
+ 'accordion-section-county.1'
315
+ )
316
+ })
317
+
318
+ it('should update aria-expanded when toggled', async () => {
319
+ wrapper = mount(Region, {
320
+ props: {
321
+ code: 'county.1',
322
+ },
323
+ })
324
+ ;(wrapper.vm as ComponentInstance).onRegionToggle()
325
+ await wrapper.vm.$nextTick()
326
+
327
+ const button = wrapper.find('.accordion-trigger')
328
+ expect(button.attributes('aria-expanded')).toBe('true')
329
+ })
330
+
331
+ it('should have accordion panel with role region', () => {
332
+ wrapper = mount(Region, {
333
+ props: {
334
+ code: 'county.1',
335
+ },
336
+ })
337
+
338
+ const panel = wrapper.find('.accordion-panel')
339
+ expect(panel.attributes('role')).toBe('region')
340
+ })
341
+ })
342
+
343
+ describe('CSS classes', () => {
344
+ it('should apply collapsed class when closed', () => {
345
+ wrapper = mount(Region, {
346
+ props: {},
347
+ })
348
+
349
+ const button = wrapper.find('.accordion-trigger')
350
+ expect(button.classes()).toContain('collapsed')
351
+ })
352
+
353
+ it('should remove collapsed class when open', async () => {
354
+ wrapper = mount(Region, {
355
+ props: {},
356
+ })
357
+ ;(wrapper.vm as ComponentInstance).onRegionToggle()
358
+ await wrapper.vm.$nextTick()
359
+
360
+ const button = wrapper.find('.accordion-trigger')
361
+ expect(button.classes()).not.toContain('collapsed')
362
+ })
363
+
364
+ it('should apply collapsed class to toggle icon when closed', () => {
365
+ wrapper = mount(Region, {
366
+ props: {},
367
+ })
368
+
369
+ const toggle = wrapper.find('.current-warning-toggle')
370
+ expect(toggle.classes()).toContain('collapsed')
371
+ })
372
+ })
373
+ })
@@ -0,0 +1,361 @@
1
+ import { describe, it, expect, afterEach } from 'vitest'
2
+ import { mount, VueWrapper } from '@vue/test-utils'
3
+ import RegionWarning from '@/components/RegionWarning.vue'
4
+ import type { WarningIconInput, Language } from '@/types'
5
+
6
+ describe('RegionWarning.vue Snapshots', () => {
7
+ let wrapper: VueWrapper | null = null
8
+
9
+ afterEach(() => {
10
+ if (wrapper) {
11
+ wrapper.unmount()
12
+ wrapper = null
13
+ }
14
+ })
15
+
16
+ describe('Warning type snapshots', () => {
17
+ it('should render wind warning correctly', () => {
18
+ const warning: WarningIconInput = {
19
+ type: 'wind',
20
+ severity: 3,
21
+ direction: 270,
22
+ text: '25',
23
+ }
24
+
25
+ wrapper = mount(RegionWarning, {
26
+ props: {
27
+ input: warning,
28
+ language: 'fi' as Language,
29
+ },
30
+ })
31
+
32
+ expect(wrapper.html()).toMatchSnapshot()
33
+ })
34
+
35
+ it('should render thunderstorm warning correctly', () => {
36
+ const warning: WarningIconInput = {
37
+ type: 'thunderStorm',
38
+ severity: 4,
39
+ }
40
+
41
+ wrapper = mount(RegionWarning, {
42
+ props: {
43
+ input: warning,
44
+ language: 'fi' as Language,
45
+ },
46
+ })
47
+
48
+ expect(wrapper.html()).toMatchSnapshot()
49
+ })
50
+
51
+ it('should render rain warning correctly', () => {
52
+ const warning: WarningIconInput = {
53
+ type: 'rain',
54
+ severity: 2,
55
+ }
56
+
57
+ wrapper = mount(RegionWarning, {
58
+ props: {
59
+ input: warning,
60
+ language: 'fi' as Language,
61
+ },
62
+ })
63
+
64
+ expect(wrapper.html()).toMatchSnapshot()
65
+ })
66
+
67
+ it('should render sea wind warning correctly', () => {
68
+ const warning: WarningIconInput = {
69
+ type: 'seaWind',
70
+ severity: 3,
71
+ direction: 180,
72
+ text: '15',
73
+ }
74
+
75
+ wrapper = mount(RegionWarning, {
76
+ props: {
77
+ input: warning,
78
+ language: 'fi' as Language,
79
+ },
80
+ })
81
+
82
+ expect(wrapper.html()).toMatchSnapshot()
83
+ })
84
+
85
+ it('should render traffic weather warning correctly', () => {
86
+ const warning: WarningIconInput = {
87
+ type: 'trafficWeather',
88
+ severity: 2,
89
+ }
90
+
91
+ wrapper = mount(RegionWarning, {
92
+ props: {
93
+ input: warning,
94
+ language: 'fi' as Language,
95
+ },
96
+ })
97
+
98
+ expect(wrapper.html()).toMatchSnapshot()
99
+ })
100
+
101
+ it('should render pedestrian safety warning correctly', () => {
102
+ const warning: WarningIconInput = {
103
+ type: 'pedestrianSafety',
104
+ severity: 2,
105
+ }
106
+
107
+ wrapper = mount(RegionWarning, {
108
+ props: {
109
+ input: warning,
110
+ language: 'fi' as Language,
111
+ },
112
+ })
113
+
114
+ expect(wrapper.html()).toMatchSnapshot()
115
+ })
116
+
117
+ it('should render forest fire weather warning correctly', () => {
118
+ const warning: WarningIconInput = {
119
+ type: 'forestFireWeather',
120
+ severity: 3,
121
+ }
122
+
123
+ wrapper = mount(RegionWarning, {
124
+ props: {
125
+ input: warning,
126
+ language: 'fi' as Language,
127
+ },
128
+ })
129
+
130
+ expect(wrapper.html()).toMatchSnapshot()
131
+ })
132
+
133
+ it('should render hot weather warning correctly', () => {
134
+ const warning: WarningIconInput = {
135
+ type: 'hotWeather',
136
+ severity: 2,
137
+ }
138
+
139
+ wrapper = mount(RegionWarning, {
140
+ props: {
141
+ input: warning,
142
+ language: 'fi' as Language,
143
+ },
144
+ })
145
+
146
+ expect(wrapper.html()).toMatchSnapshot()
147
+ })
148
+
149
+ it('should render cold weather warning correctly', () => {
150
+ const warning: WarningIconInput = {
151
+ type: 'coldWeather',
152
+ severity: 3,
153
+ }
154
+
155
+ wrapper = mount(RegionWarning, {
156
+ props: {
157
+ input: warning,
158
+ language: 'fi' as Language,
159
+ },
160
+ })
161
+
162
+ expect(wrapper.html()).toMatchSnapshot()
163
+ })
164
+
165
+ it('should render flood level warning correctly', () => {
166
+ const warning: WarningIconInput = {
167
+ type: 'floodLevel',
168
+ severity: 3,
169
+ }
170
+
171
+ wrapper = mount(RegionWarning, {
172
+ props: {
173
+ input: warning,
174
+ language: 'fi' as Language,
175
+ },
176
+ })
177
+
178
+ expect(wrapper.html()).toMatchSnapshot()
179
+ })
180
+ })
181
+
182
+ describe('Severity level snapshots', () => {
183
+ it('should render severity level 2 correctly', () => {
184
+ const warning: WarningIconInput = {
185
+ type: 'wind',
186
+ severity: 2,
187
+ }
188
+
189
+ wrapper = mount(RegionWarning, {
190
+ props: {
191
+ input: warning,
192
+ language: 'fi' as Language,
193
+ },
194
+ })
195
+
196
+ expect(wrapper.html()).toMatchSnapshot()
197
+ })
198
+
199
+ it('should render severity level 3 correctly', () => {
200
+ const warning: WarningIconInput = {
201
+ type: 'wind',
202
+ severity: 3,
203
+ }
204
+
205
+ wrapper = mount(RegionWarning, {
206
+ props: {
207
+ input: warning,
208
+ language: 'fi' as Language,
209
+ },
210
+ })
211
+
212
+ expect(wrapper.html()).toMatchSnapshot()
213
+ })
214
+
215
+ it('should render severity level 4 correctly', () => {
216
+ const warning: WarningIconInput = {
217
+ type: 'wind',
218
+ severity: 4,
219
+ }
220
+
221
+ wrapper = mount(RegionWarning, {
222
+ props: {
223
+ input: warning,
224
+ language: 'fi' as Language,
225
+ },
226
+ })
227
+
228
+ expect(wrapper.html()).toMatchSnapshot()
229
+ })
230
+ })
231
+
232
+ describe('Language snapshots', () => {
233
+ it('should render in Finnish correctly', () => {
234
+ const warning: WarningIconInput = {
235
+ type: 'wind',
236
+ severity: 3,
237
+ direction: 270,
238
+ text: '25',
239
+ }
240
+
241
+ wrapper = mount(RegionWarning, {
242
+ props: {
243
+ input: warning,
244
+ language: 'fi' as Language,
245
+ },
246
+ })
247
+
248
+ expect(wrapper.html()).toMatchSnapshot()
249
+ })
250
+
251
+ it('should render in Swedish correctly', () => {
252
+ const warning: WarningIconInput = {
253
+ type: 'wind',
254
+ severity: 3,
255
+ direction: 270,
256
+ text: '25',
257
+ }
258
+
259
+ wrapper = mount(RegionWarning, {
260
+ props: {
261
+ input: warning,
262
+ language: 'sv' as Language,
263
+ },
264
+ })
265
+
266
+ expect(wrapper.html()).toMatchSnapshot()
267
+ })
268
+
269
+ it('should render in English correctly', () => {
270
+ const warning: WarningIconInput = {
271
+ type: 'wind',
272
+ severity: 3,
273
+ direction: 270,
274
+ text: '25',
275
+ }
276
+
277
+ wrapper = mount(RegionWarning, {
278
+ props: {
279
+ input: warning,
280
+ language: 'en' as Language,
281
+ },
282
+ })
283
+
284
+ expect(wrapper.html()).toMatchSnapshot()
285
+ })
286
+ })
287
+
288
+ describe('Rotation snapshots', () => {
289
+ it('should render with north direction correctly', () => {
290
+ const warning: WarningIconInput = {
291
+ type: 'wind',
292
+ severity: 3,
293
+ direction: 0,
294
+ text: '20',
295
+ }
296
+
297
+ wrapper = mount(RegionWarning, {
298
+ props: {
299
+ input: warning,
300
+ language: 'fi' as Language,
301
+ },
302
+ })
303
+
304
+ expect(wrapper.html()).toMatchSnapshot()
305
+ })
306
+
307
+ it('should render with east direction correctly', () => {
308
+ const warning: WarningIconInput = {
309
+ type: 'wind',
310
+ severity: 3,
311
+ direction: 90,
312
+ text: '20',
313
+ }
314
+
315
+ wrapper = mount(RegionWarning, {
316
+ props: {
317
+ input: warning,
318
+ language: 'fi' as Language,
319
+ },
320
+ })
321
+
322
+ expect(wrapper.html()).toMatchSnapshot()
323
+ })
324
+
325
+ it('should render with south direction correctly', () => {
326
+ const warning: WarningIconInput = {
327
+ type: 'wind',
328
+ severity: 3,
329
+ direction: 180,
330
+ text: '20',
331
+ }
332
+
333
+ wrapper = mount(RegionWarning, {
334
+ props: {
335
+ input: warning,
336
+ language: 'fi' as Language,
337
+ },
338
+ })
339
+
340
+ expect(wrapper.html()).toMatchSnapshot()
341
+ })
342
+
343
+ it('should render with west direction correctly', () => {
344
+ const warning: WarningIconInput = {
345
+ type: 'wind',
346
+ severity: 3,
347
+ direction: 270,
348
+ text: '20',
349
+ }
350
+
351
+ wrapper = mount(RegionWarning, {
352
+ props: {
353
+ input: warning,
354
+ language: 'fi' as Language,
355
+ },
356
+ })
357
+
358
+ expect(wrapper.html()).toMatchSnapshot()
359
+ })
360
+ })
361
+ })