@pequity/squirrel 5.2.2 → 5.3.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/chunks/component.js +4 -0
- package/dist/cjs/chunks/p-dropdown-select.js +1 -1
- package/dist/cjs/chunks/p-icon.js +2180 -0
- package/dist/cjs/chunks/string.js +13 -0
- package/dist/cjs/component.js +28 -0
- package/dist/cjs/index.js +32 -2188
- package/dist/cjs/p-input-search.js +3 -2
- package/dist/cjs/p-loading.js +4 -7
- package/dist/cjs/p-modal.js +5 -2
- package/dist/cjs/string.js +32 -11
- package/dist/cjs/useSelectList.js +1 -1
- package/dist/es/chunks/component.js +5 -0
- package/dist/es/chunks/p-dropdown-select.js +1 -1
- package/dist/es/chunks/p-icon.js +2181 -0
- package/dist/es/chunks/string.js +14 -0
- package/dist/es/component.js +27 -0
- package/dist/es/index.js +31 -2187
- package/dist/es/p-input-search.js +3 -2
- package/dist/es/p-loading.js +4 -7
- package/dist/es/p-modal.js +5 -2
- package/dist/es/string.js +32 -12
- package/dist/es/useSelectList.js +1 -1
- package/dist/squirrel/components/p-action-bar/p-action-bar.types.d.ts +3 -2
- package/dist/squirrel/utils/component.d.ts +2 -0
- package/dist/squirrel/utils/component.spec.d.ts +1 -0
- package/dist/squirrel/utils/string.d.ts +1 -0
- package/dist/squirrel/utils/string.spec.d.ts +1 -0
- package/dist/style.css +33 -33
- package/package.json +22 -27
- package/squirrel/components/p-action-bar/p-action-bar.spec.js +47 -15
- package/squirrel/components/p-action-bar/p-action-bar.stories.js +6 -0
- package/squirrel/components/p-action-bar/p-action-bar.types.ts +4 -2
- package/squirrel/components/p-action-bar/p-action-bar.vue +9 -3
- package/squirrel/components/p-alert/p-alert.spec.js +1 -1
- package/squirrel/components/p-avatar/p-avatar.spec.js +16 -1
- package/squirrel/components/p-btn/p-btn.spec.js +3 -7
- package/squirrel/components/p-card/p-card.spec.js +1 -1
- package/squirrel/components/p-checkbox/p-checkbox.spec.js +1 -1
- package/squirrel/components/p-chips/p-chips.spec.js +1 -1
- package/squirrel/components/p-close-btn/p-close-btn.spec.js +1 -1
- package/squirrel/components/p-dropdown/p-dropdown.spec.js +5 -9
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +4 -5
- package/squirrel/components/p-file-upload/p-file-upload.spec.js +1 -1
- package/squirrel/components/p-icon/p-icon.spec.js +15 -29
- package/squirrel/components/p-info-icon/p-info-icon.spec.js +1 -1
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +4 -4
- package/squirrel/components/p-input/p-input.spec.js +1 -1
- package/squirrel/components/p-input-number/p-input-number.spec.js +1 -1
- package/squirrel/components/p-input-percent/p-input-percent.spec.js +1 -1
- package/squirrel/components/p-input-search/p-input-search.spec.js +1 -1
- package/squirrel/components/p-input-search/p-input-search.vue +1 -1
- package/squirrel/components/p-link/p-link.spec.js +3 -7
- package/squirrel/components/p-loading/p-loading.spec.js +23 -23
- package/squirrel/components/p-loading/p-loading.vue +2 -7
- package/squirrel/components/p-modal/p-modal-basic.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal-events.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal-features.spec.js +1 -1
- package/squirrel/components/p-modal/p-modal.vue +4 -0
- package/squirrel/components/p-pagination/p-pagination.spec.js +1 -1
- package/squirrel/components/p-pagination-info/p-pagination-info.spec.js +1 -1
- package/squirrel/components/p-progress-bar/p-progess-bar.spec.js +1 -1
- package/squirrel/components/p-ring-loader/p-ring-loader.spec.js +1 -1
- package/squirrel/components/p-select/p-select.spec.js +1 -1
- package/squirrel/components/p-select-btn/p-select-btn.spec.js +1 -1
- package/squirrel/components/p-select-list/p-select-list.spec.js +4 -5
- package/squirrel/components/p-select-pill/p-select-pill.spec.js +1 -1
- package/squirrel/components/p-skeleton-loader/p-skeleton-loader.spec.js +1 -1
- package/squirrel/components/p-table/p-table.spec.js +1 -1
- package/squirrel/components/p-table-header-cell/p-filter-icon.spec.js +1 -1
- package/squirrel/components/p-table-header-cell/p-table-header-cell.spec.js +1 -1
- package/squirrel/components/p-table-loader/p-table-loader.spec.js +1 -1
- package/squirrel/components/p-table-sort/p-table-sort.spec.js +1 -1
- package/squirrel/components/p-table-td/p-table-td.spec.js +35 -1
- package/squirrel/components/p-tabs/p-tabs.spec.js +1 -1
- package/squirrel/components/p-textarea/p-textarea.spec.js +1 -1
- package/squirrel/components/p-toggle/p-toggle.spec.js +1 -1
- package/squirrel/composables/useInputClasses.spec.js +41 -0
- package/squirrel/index.spec.js +21 -0
- package/squirrel/utils/component.spec.ts +29 -0
- package/squirrel/utils/component.ts +5 -0
- package/squirrel/utils/dom.spec.js +2 -3
- package/squirrel/utils/listKeyboardNavigation.spec.js +5 -9
- package/squirrel/utils/sanitization.spec.js +1 -1
- package/squirrel/utils/{string.spec.js → string.spec.ts} +19 -1
- package/squirrel/utils/string.ts +2 -0
- package/squirrel/utils/tailwind.spec.js +27 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import PSelectList from '@squirrel/components/p-select-list/p-select-list.vue';
|
|
2
2
|
import filterListItems from '@squirrel/components/p-dropdown-select/p-dropdown-select.mock.json';
|
|
3
3
|
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import { createWrapperFor, sleep } from '@tests/
|
|
4
|
+
import { createWrapperFor, sleep } from '@tests/vitest.helpers';
|
|
5
5
|
import { ref } from 'vue';
|
|
6
6
|
import { useVirtualizer } from '@tanstack/vue-virtual';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
useVirtualizer:
|
|
8
|
+
vi.mock('@tanstack/vue-virtual', () => ({
|
|
9
|
+
useVirtualizer: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
const createMockedVirtualizer = (count) => {
|
|
@@ -67,13 +67,12 @@ const cleanup = async (wrapper) => {
|
|
|
67
67
|
|
|
68
68
|
describe('PSelectList.vue', () => {
|
|
69
69
|
beforeEach(() => {
|
|
70
|
-
|
|
70
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
// When using `attachTo: document.body` we have to cleanup the DOM and call `wrapper.destroy()` after each test
|
|
74
74
|
afterEach(() => {
|
|
75
75
|
document.body.innerHTML = '';
|
|
76
|
-
jest.clearAllMocks();
|
|
77
76
|
});
|
|
78
77
|
|
|
79
78
|
it('renders correctly', async () => {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isFirstColFixedInjectionKey,
|
|
6
6
|
isLastColFixedInjectionKey,
|
|
7
7
|
} from '@squirrel/components/p-table/p-table.types';
|
|
8
|
-
import { createWrapperFor } from '@tests/
|
|
8
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
9
9
|
import { defineComponent, h, inject } from 'vue';
|
|
10
10
|
|
|
11
11
|
const columns = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PFilterIcon from '@squirrel/components/p-table-header-cell/p-table-filter-icon.vue';
|
|
2
|
-
import { createWrapperFor } from '@tests/
|
|
2
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
3
3
|
|
|
4
4
|
describe('PFilterIcon.vue', () => {
|
|
5
5
|
it('renders a filter icon', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PFilterIcon from '@squirrel/components/p-table-header-cell/p-table-filter-icon.vue';
|
|
2
2
|
import PTableHeaderCell from '@squirrel/components/p-table-header-cell/p-table-header-cell.vue';
|
|
3
|
-
import { createWrapperFor } from '@tests/
|
|
3
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
4
4
|
|
|
5
5
|
describe('PTableHeaderCell.vue', () => {
|
|
6
6
|
it('renders correctly', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PTable from '@squirrel/components/p-table/p-table.vue';
|
|
2
2
|
import PTableLoader from '@squirrel/components/p-table-loader/p-table-loader.vue';
|
|
3
|
-
import { createWrapperFor } from '@tests/
|
|
3
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
4
4
|
|
|
5
5
|
describe('PTableLoader.vue', () => {
|
|
6
6
|
it('matches the PTable classes', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PTableSort from '@squirrel/components/p-table-sort/p-table-sort.vue';
|
|
2
2
|
import { SORTING_TYPES } from '@squirrel/components/p-table-sort/p-table-sort.config';
|
|
3
|
-
import { createWrapperFor } from '@tests/
|
|
3
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
4
4
|
|
|
5
5
|
describe('PTableSort.vue', () => {
|
|
6
6
|
it('renders correctly', async () => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import PTableTd from '@squirrel/components/p-table-td/p-table-td.vue';
|
|
2
2
|
import {
|
|
3
3
|
colsInjectionKey,
|
|
4
|
+
isColsResizableInjectionKey,
|
|
4
5
|
isFirstColFixedInjectionKey,
|
|
5
6
|
isLastColFixedInjectionKey,
|
|
6
7
|
} from '@squirrel/components/p-table/p-table.types';
|
|
7
|
-
import { createWrapperFor } from '@tests/
|
|
8
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
8
9
|
import { ref } from 'vue';
|
|
9
10
|
|
|
10
11
|
const DEFAULT_TD_CLASSES = [
|
|
@@ -23,6 +24,16 @@ const DEFAULT_TD_CLASSES = [
|
|
|
23
24
|
|
|
24
25
|
const DEFAULT_INNER_DIV_CLASSES = ['w-max', 'px-2'];
|
|
25
26
|
|
|
27
|
+
const GRADIENT_TD_CLASSES = [
|
|
28
|
+
'min-w-[80px]',
|
|
29
|
+
'border-l',
|
|
30
|
+
'border-p-gray-30',
|
|
31
|
+
'bg-gradient-to-r',
|
|
32
|
+
'from-white',
|
|
33
|
+
'via-p-gray-10',
|
|
34
|
+
'to-p-gray-10',
|
|
35
|
+
];
|
|
36
|
+
|
|
26
37
|
describe('PTableTd.vue', () => {
|
|
27
38
|
it('renders a td', async () => {
|
|
28
39
|
const wrapper = createWrapperFor(PTableTd, {
|
|
@@ -145,4 +156,27 @@ describe('PTableTd.vue', () => {
|
|
|
145
156
|
|
|
146
157
|
expect([...innerDiv.classes()].sort()).toEqual(['w-max', 'pl-2', 'pr-4'].sort());
|
|
147
158
|
});
|
|
159
|
+
|
|
160
|
+
it(`renders a td with a gradient when it's the last sticky column`, async () => {
|
|
161
|
+
const wrapper = createWrapperFor(PTableTd, {
|
|
162
|
+
props: { colIndex: 2, isEditable: true },
|
|
163
|
+
slots: { default: `Cell content` },
|
|
164
|
+
global: {
|
|
165
|
+
provide: {
|
|
166
|
+
[colsInjectionKey]: ref([{ id: 1 }, { id: 2 }, { id: 3 }]),
|
|
167
|
+
[isColsResizableInjectionKey]: ref(true),
|
|
168
|
+
[isLastColFixedInjectionKey]: ref(false),
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const tds = wrapper.findAll('td');
|
|
174
|
+
|
|
175
|
+
expect(tds.length).toBe(2);
|
|
176
|
+
|
|
177
|
+
const gradientTd = tds[1];
|
|
178
|
+
|
|
179
|
+
expect(gradientTd.exists()).toBe(true);
|
|
180
|
+
expect(gradientTd.classes()).toEqual(GRADIENT_TD_CLASSES);
|
|
181
|
+
});
|
|
148
182
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PTabs from '@squirrel/components/p-tabs/p-tabs.vue';
|
|
2
|
-
import { createWrapperFor } from '@tests/
|
|
2
|
+
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
3
3
|
import { markRaw } from 'vue';
|
|
4
4
|
|
|
5
5
|
const Tab1Icon = markRaw({ template: `<i data-icon="icon-tab1"></i>` });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SPACING_LEFT, SPACING_PREFIX, SPACING_RIGHT, SPACING_SUFFIX } from '@squirrel/utils/inputClassesShared';
|
|
1
2
|
import { reactive } from 'vue';
|
|
2
3
|
import { useInputClasses } from '@squirrel/composables/useInputClasses';
|
|
3
4
|
|
|
@@ -164,4 +165,44 @@ describe('useInputClasses', () => {
|
|
|
164
165
|
);
|
|
165
166
|
expect(errorMsgClasses.value).toBe('text-xs text-on-error mt-1');
|
|
166
167
|
});
|
|
168
|
+
|
|
169
|
+
it('should apply the SPACING_PREFIX when prefix is true', () => {
|
|
170
|
+
const props = reactive({
|
|
171
|
+
size: 'md',
|
|
172
|
+
prefix: true,
|
|
173
|
+
});
|
|
174
|
+
const { inputClasses } = useInputClasses(props);
|
|
175
|
+
|
|
176
|
+
expect(inputClasses.value).toContain(SPACING_PREFIX.md);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('should apply the SPACING_SUFFIX when suffix is true', () => {
|
|
180
|
+
const props = reactive({
|
|
181
|
+
size: 'md',
|
|
182
|
+
suffix: true,
|
|
183
|
+
});
|
|
184
|
+
const { inputClasses } = useInputClasses(props);
|
|
185
|
+
|
|
186
|
+
expect(inputClasses.value).toContain(SPACING_SUFFIX.md);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('should apply SPACING_LEFT when prefix is false', () => {
|
|
190
|
+
const props = reactive({
|
|
191
|
+
size: 'md',
|
|
192
|
+
prefix: false,
|
|
193
|
+
});
|
|
194
|
+
const { inputClasses } = useInputClasses(props);
|
|
195
|
+
|
|
196
|
+
expect(inputClasses.value).toContain(SPACING_LEFT.md);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should apply SPACING_RIGHT when suffix is false', () => {
|
|
200
|
+
const props = reactive({
|
|
201
|
+
size: 'md',
|
|
202
|
+
suffix: false,
|
|
203
|
+
});
|
|
204
|
+
const { inputClasses } = useInputClasses(props);
|
|
205
|
+
|
|
206
|
+
expect(inputClasses.value).toContain(SPACING_RIGHT.md);
|
|
207
|
+
});
|
|
167
208
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
describe('index.ts module exports', () => {
|
|
2
|
+
it('should export from @squirrel/tailwind/config', async () => {
|
|
3
|
+
const config = await import('@squirrel/tailwind/config');
|
|
4
|
+
expect(config).toBeDefined();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
it('should export from @squirrel/components', async () => {
|
|
8
|
+
const components = await import('@squirrel/components');
|
|
9
|
+
expect(components).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should export from @squirrel/composables', async () => {
|
|
13
|
+
const composables = await import('@squirrel/composables');
|
|
14
|
+
expect(composables).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should export from @squirrel/utils', async () => {
|
|
18
|
+
const utils = await import('@squirrel/utils');
|
|
19
|
+
expect(utils).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import PIcon from '@squirrel/components/p-icon/p-icon.vue';
|
|
2
|
+
import { isComponent } from '@squirrel/utils/component';
|
|
3
|
+
|
|
4
|
+
describe('isComponent', () => {
|
|
5
|
+
it('should return true for a valid component object', () => {
|
|
6
|
+
expect(isComponent(PIcon)).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should return false for null', () => {
|
|
10
|
+
expect(isComponent(null)).toBe(false);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it.each([
|
|
14
|
+
['string', 'string'],
|
|
15
|
+
['number', 123],
|
|
16
|
+
['boolean', true],
|
|
17
|
+
['undefined', undefined],
|
|
18
|
+
['symbol', Symbol('symbol')],
|
|
19
|
+
['function', () => {}],
|
|
20
|
+
['array', []],
|
|
21
|
+
['date', new Date()],
|
|
22
|
+
['regexp', /regex/],
|
|
23
|
+
['error', new Error('error')],
|
|
24
|
+
['map', new Map()],
|
|
25
|
+
['set', new Set()],
|
|
26
|
+
])('should return false for a non-component object: %s', (_, value) => {
|
|
27
|
+
expect(isComponent(value)).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Component } from 'vue';
|
|
2
|
+
import { isPlainObject } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
// Vue produces a different type of object in dev and prod mode, so we cannot check for e.g `typeof val.render === 'function`
|
|
5
|
+
export const isComponent = (val: unknown): val is Component => isPlainObject(val);
|
|
@@ -6,13 +6,12 @@ describe('isVisible', () => {
|
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
element = document.createElement('div');
|
|
8
8
|
// Simulate element dimensions since jsdom doesn't support layout
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
vi.spyOn(element, 'offsetWidth', 'get').mockImplementation(() => 100);
|
|
10
|
+
vi.spyOn(element, 'offsetHeight', 'get').mockImplementation(() => 100);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
afterEach(() => {
|
|
14
14
|
element = null;
|
|
15
|
-
jest.clearAllMocks();
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
it('throws an error when no element is provided', () => {
|
|
@@ -53,20 +53,16 @@ describe('listKeyboardNavigation', () => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
it('initializes correctly', () => {
|
|
56
|
-
document.addEventListener =
|
|
56
|
+
document.addEventListener = vi.fn().mockImplementationOnce();
|
|
57
57
|
|
|
58
58
|
const navigationSvc = createTestSvc();
|
|
59
59
|
|
|
60
60
|
navigationSvc.init();
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'setFocusedItem',
|
|
67
|
-
'listKeydown',
|
|
68
|
-
'init',
|
|
69
|
-
'destroy'
|
|
62
|
+
['getItems', 'getFocusedItem', 'clearFocusedState', 'setFocusedItem', 'listKeydown', 'init', 'destroy'].forEach(
|
|
63
|
+
(method) => {
|
|
64
|
+
expect(navigationSvc).toHaveProperty(method);
|
|
65
|
+
}
|
|
70
66
|
);
|
|
71
67
|
|
|
72
68
|
expect(document.addEventListener).toBeCalledWith('keydown', navigationSvc.listKeydown);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
2
2
|
|
|
3
3
|
describe('sanitizeUrl', () => {
|
|
4
|
-
const consoleMock =
|
|
4
|
+
const consoleMock = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
5
5
|
|
|
6
6
|
afterAll(() => {
|
|
7
7
|
consoleMock.mockReset();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toString } from '@squirrel/utils/string';
|
|
1
|
+
import { isString, toString } from '@squirrel/utils/string';
|
|
2
2
|
|
|
3
3
|
describe('toString', () => {
|
|
4
4
|
it.each(['', new Date(), NaN, Infinity, {}, [], true, false, null, undefined])(
|
|
@@ -16,3 +16,21 @@ describe('toString', () => {
|
|
|
16
16
|
expect(toString(2903498.22)).toBe('2903498.22');
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
|
+
|
|
20
|
+
describe('isString', () => {
|
|
21
|
+
it('should return true for a string', () => {
|
|
22
|
+
expect(isString('hello')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it.each([
|
|
26
|
+
[123, false],
|
|
27
|
+
[{}, false],
|
|
28
|
+
[[], false],
|
|
29
|
+
[null, false],
|
|
30
|
+
[undefined, false],
|
|
31
|
+
[true, false],
|
|
32
|
+
[() => {}, false],
|
|
33
|
+
])('should return %s for %p', (input, expected) => {
|
|
34
|
+
expect(isString(input)).toBe(expected);
|
|
35
|
+
});
|
|
36
|
+
});
|
package/squirrel/utils/string.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash-es';
|
|
2
|
+
import { getScreen } from './tailwind';
|
|
3
|
+
|
|
4
|
+
const screens = { sm: '640px', md: '768px' };
|
|
5
|
+
|
|
6
|
+
describe('tailwind', () => {
|
|
7
|
+
it('should return the correct screen size for a valid key', () => {
|
|
8
|
+
// Mock the theme.screens object
|
|
9
|
+
const originalScreens = global.screens;
|
|
10
|
+
global.screens = cloneDeep(screens);
|
|
11
|
+
|
|
12
|
+
expect(getScreen('sm')).toBe('640px');
|
|
13
|
+
expect(getScreen('md')).toBe('768px');
|
|
14
|
+
|
|
15
|
+
// Restore the original screens object
|
|
16
|
+
global.screens = originalScreens;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should return undefined for an invalid key', () => {
|
|
20
|
+
const originalScreens = global.screens;
|
|
21
|
+
global.screens = cloneDeep(screens);
|
|
22
|
+
|
|
23
|
+
expect(getScreen('xxl')).toBeUndefined();
|
|
24
|
+
|
|
25
|
+
global.screens = originalScreens;
|
|
26
|
+
});
|
|
27
|
+
});
|