@swisspost/design-system-components 1.3.9 → 1.4.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.
- package/dist/cjs/check-non-empty-35b4d0b5.js +14 -0
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +1 -0
- package/dist/cjs/{package-c661bf2f.js → check-type-f24cf91d.js} +1 -4
- package/dist/cjs/{package-c661bf2f.js.map → check-type-f24cf91d.js.map} +1 -1
- package/dist/cjs/{index-272283b3.js → index-50d7d035.js} +15 -1
- package/dist/cjs/index-50d7d035.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/package-e8a6597e.js +7 -0
- package/dist/cjs/package-e8a6597e.js.map +1 -0
- package/dist/cjs/post-collapsible.cjs.entry.js +6 -5
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-icon.cjs.entry.js +9 -15
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +35 -0
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +29 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +141 -0
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -0
- package/dist/collection/animations/fade.js +6 -0
- package/dist/collection/animations/fade.js.map +1 -0
- package/dist/collection/animations/index.js +2 -0
- package/dist/collection/animations/index.js.map +1 -0
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/post-collapsible/post-collapsible.css +165 -15688
- package/dist/collection/components/post-tab-header/post-tab-header.css +337 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js +68 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.css +3 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +55 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -0
- package/dist/collection/components/post-tabs/post-tabs.css +148 -0
- package/dist/collection/components/post-tabs/post-tabs.js +208 -0
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -0
- package/dist/components/check-non-empty.js +11 -0
- package/dist/components/check-non-empty.js.map +1 -0
- package/dist/{esm/package-adf815bd.js → components/check-type.js} +2 -4
- package/dist/components/check-type.js.map +1 -0
- package/dist/components/package.js +2 -20
- package/dist/components/package.js.map +1 -1
- package/dist/components/post-collapsible.js +3 -2
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +3 -9
- package/dist/components/post-icon.js.map +1 -1
- package/dist/components/post-tab-header.d.ts +11 -0
- package/dist/components/post-tab-header.js +52 -0
- package/dist/components/post-tab-header.js.map +1 -0
- package/dist/components/post-tab-panel.d.ts +11 -0
- package/dist/components/post-tab-panel.js +46 -0
- package/dist/components/post-tab-panel.js.map +1 -0
- package/dist/components/post-tabs.d.ts +11 -0
- package/dist/components/post-tabs.js +158 -0
- package/dist/components/post-tabs.js.map +1 -0
- package/dist/docs.json +131 -1
- package/dist/esm/check-non-empty-554bdf88.js +11 -0
- package/dist/esm/check-non-empty-554bdf88.js.map +1 -0
- package/dist/esm/check-type-67411ed3.js +21 -0
- package/dist/esm/check-type-67411ed3.js.map +1 -0
- package/dist/esm/{index-60a84798.js → index-cc0e53f0.js} +15 -2
- package/dist/esm/index-cc0e53f0.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-b514d0f6.js +5 -0
- package/dist/esm/package-b514d0f6.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +4 -3
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-icon.entry.js +4 -10
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header.entry.js +31 -0
- package/dist/esm/post-tab-header.entry.js.map +1 -0
- package/dist/esm/post-tab-panel.entry.js +25 -0
- package/dist/esm/post-tab-panel.entry.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +137 -0
- package/dist/esm/post-tabs.entry.js.map +1 -0
- package/dist/post-components/p-1388585d.entry.js +2 -0
- package/dist/post-components/p-1388585d.entry.js.map +1 -0
- package/dist/post-components/p-58916755.js +2 -0
- package/dist/post-components/p-58916755.js.map +1 -0
- package/dist/post-components/p-5b3445dc.entry.js +2 -0
- package/dist/post-components/p-5b3445dc.entry.js.map +1 -0
- package/dist/post-components/p-6341b9b4.js +3 -0
- package/dist/post-components/p-6341b9b4.js.map +1 -0
- package/dist/post-components/p-6dad6a8a.entry.js +2 -0
- package/dist/post-components/p-6dad6a8a.entry.js.map +1 -0
- package/dist/post-components/p-b95ec099.entry.js +2 -0
- package/dist/post-components/p-b95ec099.entry.js.map +1 -0
- package/dist/post-components/p-c8efe0ae.js +2 -0
- package/dist/post-components/p-c8efe0ae.js.map +1 -0
- package/dist/post-components/p-cc92afb7.entry.js +2 -0
- package/dist/post-components/p-cc92afb7.entry.js.map +1 -0
- package/dist/post-components/p-f549b3fc.js +2 -0
- package/dist/post-components/{p-05d38c8e.js.map → p-f549b3fc.js.map} +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/fade.d.ts +2 -0
- package/dist/types/animations/index.d.ts +1 -0
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +11 -0
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +10 -0
- package/dist/types/components/post-tabs/post-tabs.d.ts +34 -0
- package/dist/types/components.d.ts +75 -0
- package/package.json +7 -8
- package/dist/cjs/index-272283b3.js.map +0 -1
- package/dist/collection/utils/property-checkers/tests/check-non-empty.spec.js +0 -36
- package/dist/collection/utils/property-checkers/tests/check-non-empty.spec.js.map +0 -1
- package/dist/collection/utils/property-checkers/tests/check-one-of.spec.js +0 -13
- package/dist/collection/utils/property-checkers/tests/check-one-of.spec.js.map +0 -1
- package/dist/collection/utils/property-checkers/tests/check-type.spec.js +0 -103
- package/dist/collection/utils/property-checkers/tests/check-type.spec.js.map +0 -1
- package/dist/collection/utils/property-checkers/tests/empty-or.spec.js +0 -23
- package/dist/collection/utils/property-checkers/tests/empty-or.spec.js.map +0 -1
- package/dist/collection/utils/tests/should-reduce-motion.spec.js +0 -16
- package/dist/collection/utils/tests/should-reduce-motion.spec.js.map +0 -1
- package/dist/esm/index-60a84798.js.map +0 -1
- package/dist/esm/package-adf815bd.js.map +0 -1
- package/dist/post-components/p-0096c140.js +0 -3
- package/dist/post-components/p-0096c140.js.map +0 -1
- package/dist/post-components/p-05d38c8e.js +0 -2
- package/dist/post-components/p-4eaaf8eb.entry.js +0 -2
- package/dist/post-components/p-4eaaf8eb.entry.js.map +0 -1
- package/dist/post-components/p-5cd6cb3a.entry.js +0 -2
- package/dist/post-components/p-5cd6cb3a.entry.js.map +0 -1
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { checkType } from '../check-type';
|
|
2
|
-
describe('checkType', () => {
|
|
3
|
-
let type;
|
|
4
|
-
let error;
|
|
5
|
-
const runCheckForValue = value => () => checkType(value, type, error);
|
|
6
|
-
describe('boolean', () => {
|
|
7
|
-
beforeAll(() => {
|
|
8
|
-
type = 'boolean';
|
|
9
|
-
error = 'Not a boolean.';
|
|
10
|
-
});
|
|
11
|
-
it('should not throw an error if the value is a boolean', () => {
|
|
12
|
-
[true, false].forEach(boolean => {
|
|
13
|
-
expect(runCheckForValue(boolean)).not.toThrow();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
it('should throw an error if the value is not a boolean', () => {
|
|
17
|
-
[undefined, null, 42, NaN, 'string', [], {}, () => { }].forEach(nonBoolean => {
|
|
18
|
-
expect(runCheckForValue(nonBoolean)).toThrow(error);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
describe('number', () => {
|
|
23
|
-
beforeAll(() => {
|
|
24
|
-
type = 'number';
|
|
25
|
-
error = 'Not a number.';
|
|
26
|
-
});
|
|
27
|
-
it('should not throw an error if the value is a number', () => {
|
|
28
|
-
[42, 4.2, 4200, 2.4434634e9, NaN].forEach(number => {
|
|
29
|
-
expect(runCheckForValue(number)).not.toThrow();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it('should throw an error if the value is not a number', () => {
|
|
33
|
-
[undefined, null, true, 'string', [], {}, () => { }].forEach(nonNumber => {
|
|
34
|
-
expect(runCheckForValue(nonNumber)).toThrow(error);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('string', () => {
|
|
39
|
-
beforeAll(() => {
|
|
40
|
-
type = 'string';
|
|
41
|
-
error = 'Not a string.';
|
|
42
|
-
});
|
|
43
|
-
it('should not throw an error if the value is a string', () => {
|
|
44
|
-
['', 'string', '42', '¡¡Olé 🙌!!'].forEach(string => {
|
|
45
|
-
expect(runCheckForValue(string)).not.toThrow();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('should throw an error if the value is not string', () => {
|
|
49
|
-
[undefined, null, true, 42, NaN, [], {}, () => { }].forEach(nonString => {
|
|
50
|
-
expect(runCheckForValue(nonString)).toThrow(error);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('array', () => {
|
|
55
|
-
beforeAll(() => {
|
|
56
|
-
type = 'array';
|
|
57
|
-
error = 'Not an array.';
|
|
58
|
-
});
|
|
59
|
-
it('should not throw an error if the value is an array', () => {
|
|
60
|
-
[[], [1, 'a']].forEach(array => {
|
|
61
|
-
expect(runCheckForValue(array)).not.toThrow();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
it('should throw an error if the value is not an array', () => {
|
|
65
|
-
[undefined, null, true, 42, NaN, 'string', {}, () => { }].forEach(nonArray => {
|
|
66
|
-
expect(runCheckForValue(nonArray)).toThrow(error);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe('object', () => {
|
|
71
|
-
beforeAll(() => {
|
|
72
|
-
type = 'object';
|
|
73
|
-
error = 'Not an object.';
|
|
74
|
-
});
|
|
75
|
-
it('should not throw an error if the value is an object', () => {
|
|
76
|
-
[null, {}].forEach(object => {
|
|
77
|
-
expect(runCheckForValue(object)).not.toThrow();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
it('should throw an error if the value is not an object', () => {
|
|
81
|
-
[undefined, true, 42, NaN, 'string', () => { }].forEach(nonObject => {
|
|
82
|
-
expect(runCheckForValue(nonObject)).toThrow(error);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe('function', () => {
|
|
87
|
-
beforeAll(() => {
|
|
88
|
-
type = 'function';
|
|
89
|
-
error = 'Not a function.';
|
|
90
|
-
});
|
|
91
|
-
it('should not throw an error if the value is a function', () => {
|
|
92
|
-
[function () { }, () => { }].forEach(fn => {
|
|
93
|
-
expect(runCheckForValue(fn)).not.toThrow();
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
it('should throw an error if the value is not a function', () => {
|
|
97
|
-
[undefined, null, true, 42, NaN, 'string', [], {}].forEach(nonFn => {
|
|
98
|
-
expect(runCheckForValue(nonFn)).toThrow(error);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
//# sourceMappingURL=check-type.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-type.spec.js","sourceRoot":"","sources":["../../../../../src/utils/property-checkers/tests/check-type.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AAExD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;EACzB,IAAI,IAAkB,CAAC;EACvB,IAAI,KAAa,CAAC;EAClB,MAAM,gBAAgB,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAA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AE;MAC7D,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAa,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC5E,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;MACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,SAAS,CAAC,GAAG,EAAE;MACb,IAAI,GAAG,UAAU,CAAC;MAClB,KAAK,GAAG,iBAAiB,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;MAC9D,CAAC,cAAwB,CAAC,EAAE,GAAG,EAAE,GAAa,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAC5D,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;MAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;MAC9D,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjE,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;MACjD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { checkType, PropertyType } from '../check-type';\n\ndescribe('checkType', () => {\n let type: PropertyType;\n let error: string;\n const runCheckForValue = value => () => checkType(value, type, error);\n\n describe('boolean', () => {\n beforeAll(() => {\n type = 'boolean';\n error = 'Not a boolean.';\n });\n\n it('should not throw an error if the value is a boolean', () => {\n [true, false].forEach(boolean => {\n expect(runCheckForValue(boolean)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not a boolean', () => {\n [undefined, null, 42, NaN, 'string', [], {}, () => {/* empty */}].forEach(nonBoolean => {\n expect(runCheckForValue(nonBoolean)).toThrow(error);\n });\n });\n });\n\n describe('number', () => {\n beforeAll(() => {\n type = 'number';\n error = 'Not a number.';\n });\n\n it('should not throw an error if the value is a number', () => {\n [ 42, 4.2, 4_200, 2.4434634e9, NaN ].forEach(number => {\n expect(runCheckForValue(number)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not a number', () => {\n [undefined, null, true, 'string', [], {}, () => {/* empty */}].forEach(nonNumber => {\n expect(runCheckForValue(nonNumber)).toThrow(error);\n });\n });\n });\n\n describe('string', () => {\n beforeAll(() => {\n type = 'string';\n error = 'Not a string.';\n });\n\n it('should not throw an error if the value is a string', () => {\n ['', 'string', '42', '¡¡Olé 🙌!!'].forEach(string => {\n expect(runCheckForValue(string)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not string', () => {\n [undefined, null, true, 42, NaN, [], {}, () => {/* empty */}].forEach(nonString => {\n expect(runCheckForValue(nonString)).toThrow(error);\n });\n });\n });\n\n describe('array', () => {\n beforeAll(() => {\n type = 'array';\n error = 'Not an array.';\n });\n\n it('should not throw an error if the value is an array', () => {\n [[], [1, 'a']].forEach(array => {\n expect(runCheckForValue(array)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not an array', () => {\n [undefined, null, true, 42, NaN, 'string', {}, () => {/* empty */}].forEach(nonArray => {\n expect(runCheckForValue(nonArray)).toThrow(error);\n });\n });\n });\n\n describe('object', () => {\n beforeAll(() => {\n type = 'object';\n error = 'Not an object.';\n });\n\n it('should not throw an error if the value is an object', () => {\n [null, {}].forEach(object => {\n expect(runCheckForValue(object)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not an object', () => {\n [undefined, true, 42, NaN, 'string', () => {/* empty */}].forEach(nonObject => {\n expect(runCheckForValue(nonObject)).toThrow(error);\n });\n });\n });\n\n describe('function', () => {\n beforeAll(() => {\n type = 'function';\n error = 'Not a function.';\n });\n\n it('should not throw an error if the value is a function', () => {\n [function () {/* empty */}, () => {/* empty */}].forEach(fn => {\n expect(runCheckForValue(fn)).not.toThrow();\n });\n });\n\n it('should throw an error if the value is not a function', () => {\n [undefined, null, true, 42, NaN, 'string', [], {}].forEach(nonFn => {\n expect(runCheckForValue(nonFn)).toThrow(error);\n });\n });\n });\n});\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { emptyOr } from '../empty-or';
|
|
2
|
-
describe('emptyOr', () => {
|
|
3
|
-
const mockCheck = jest.fn();
|
|
4
|
-
const mockEmptyOrCheck = emptyOr(mockCheck);
|
|
5
|
-
it('should not run the check if the provided value is empty', () => {
|
|
6
|
-
[undefined, null, ''].forEach(emptyValue => {
|
|
7
|
-
mockEmptyOrCheck(emptyValue);
|
|
8
|
-
expect(mockCheck).not.toHaveBeenCalled();
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
it('should run the check if the provided value is not empty', () => {
|
|
12
|
-
[0, NaN, ' ', false, [], {}, () => { }].forEach((nonEmptyValue, index) => {
|
|
13
|
-
mockEmptyOrCheck(nonEmptyValue);
|
|
14
|
-
expect(mockCheck).toHaveBeenCalledTimes(index + 1);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
it('should pass all provided arguments to the nested check function', () => {
|
|
18
|
-
const args = ['non empty value', true, false, ['arg in an array'], { arg: 'in an object' }];
|
|
19
|
-
mockEmptyOrCheck(...args);
|
|
20
|
-
expect(mockCheck).toHaveBeenCalledWith(...args);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=empty-or.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"empty-or.spec.js","sourceRo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;EAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { emptyOr } from '../empty-or';\n\ndescribe('emptyOr', () => {\n const mockCheck = jest.fn();\n const mockEmptyOrCheck = emptyOr(mockCheck);\n\n it('should not run the check if the provided value is empty', () => {\n [undefined, null, ''].forEach(emptyValue => {\n mockEmptyOrCheck(emptyValue);\n expect(mockCheck).not.toHaveBeenCalled();\n });\n });\n\n it('should run the check if the provided value is not empty', () => {\n [0, NaN, ' ', false, [], {}, () => {/* empty */}].forEach((nonEmptyValue, index) => {\n mockEmptyOrCheck(nonEmptyValue);\n expect(mockCheck).toHaveBeenCalledTimes(index + 1);\n });\n });\n\n it('should pass all provided arguments to the nested check function', () => {\n const args = ['non empty value', true, false, ['arg in an array'], {arg: 'in an object'}];\n mockEmptyOrCheck(...args);\n expect(mockCheck).toHaveBeenCalledWith(...args);\n });\n});\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { shouldReduceMotion } from '../should-reduce-motion';
|
|
2
|
-
describe('shouldReduceMotion', () => {
|
|
3
|
-
let matchMedia;
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
matchMedia = window.matchMedia = jest.fn();
|
|
6
|
-
});
|
|
7
|
-
it('should return true if reduced motion is requested', () => {
|
|
8
|
-
matchMedia.mockReturnValue({ matches: true });
|
|
9
|
-
expect(shouldReduceMotion()).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
it('should return false if reduced motion is not requested', () => {
|
|
12
|
-
matchMedia.mockReturnValue({ matches: false });
|
|
13
|
-
expect(shouldReduceMotion()).toBe(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=should-reduce-motion.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"should-reduce-motion.spec.js","sourceRoot":"","sources":["../../../../src/utils/tests/should-reduce-motion.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;EAClC,IAAI,UAAU,CAAC;EAEf,UAAU,CAAC,GAAG,EAAE;IACd,UAAU,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;EAC7C,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC3D,UAAU,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC1C,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;IAChE,UAAU,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { shouldReduceMotion } from '../should-reduce-motion';\n\ndescribe('shouldReduceMotion', () => {\n let matchMedia;\n\n beforeEach(() => {\n matchMedia = window.matchMedia = jest.fn();\n });\n\n it('should return true if reduced motion is requested', () => {\n matchMedia.mockReturnValue({ matches: true });\n expect(shouldReduceMotion()).toBe(true);\n });\n\n it('should return false if reduced motion is not requested', () => {\n matchMedia.mockReturnValue({ matches: false });\n expect(shouldReduceMotion()).toBe(false);\n });\n});\n"]}
|