@pequity/squirrel 5.2.1 → 5.2.3

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 (60) hide show
  1. package/README.md +22 -0
  2. package/dist/cjs/p-info-icon.js +3 -3
  3. package/dist/cjs/p-input-search.js +3 -2
  4. package/dist/cjs/p-modal.js +5 -2
  5. package/dist/es/p-info-icon.js +3 -3
  6. package/dist/es/p-input-search.js +3 -2
  7. package/dist/es/p-modal.js +5 -2
  8. package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +1 -1
  9. package/dist/style.css +28 -28
  10. package/package.json +25 -30
  11. package/squirrel/components/p-action-bar/p-action-bar.spec.js +1 -1
  12. package/squirrel/components/p-alert/p-alert.spec.js +1 -1
  13. package/squirrel/components/p-avatar/p-avatar.spec.js +1 -1
  14. package/squirrel/components/p-btn/p-btn.spec.js +3 -7
  15. package/squirrel/components/p-card/p-card.spec.js +1 -1
  16. package/squirrel/components/p-checkbox/p-checkbox.spec.js +1 -1
  17. package/squirrel/components/p-chips/p-chips.spec.js +1 -1
  18. package/squirrel/components/p-close-btn/p-close-btn.spec.js +1 -1
  19. package/squirrel/components/p-dropdown/p-dropdown.spec.js +5 -9
  20. package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +4 -5
  21. package/squirrel/components/p-file-upload/p-file-upload.spec.js +1 -1
  22. package/squirrel/components/p-icon/p-icon.spec.js +16 -29
  23. package/squirrel/components/p-info-icon/p-info-icon.spec.js +2 -1
  24. package/squirrel/components/p-info-icon/p-info-icon.vue +2 -2
  25. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +4 -4
  26. package/squirrel/components/p-input/p-input.spec.js +1 -1
  27. package/squirrel/components/p-input-number/p-input-number.spec.js +1 -1
  28. package/squirrel/components/p-input-percent/p-input-percent.spec.js +1 -1
  29. package/squirrel/components/p-input-search/p-input-search.spec.js +1 -1
  30. package/squirrel/components/p-input-search/p-input-search.vue +1 -1
  31. package/squirrel/components/p-link/p-link.spec.js +3 -7
  32. package/squirrel/components/p-loading/p-loading.spec.js +23 -23
  33. package/squirrel/components/p-modal/p-modal-basic.spec.js +1 -1
  34. package/squirrel/components/p-modal/p-modal-events.spec.js +1 -1
  35. package/squirrel/components/p-modal/p-modal-features.spec.js +1 -1
  36. package/squirrel/components/p-modal/p-modal.vue +4 -0
  37. package/squirrel/components/p-pagination/p-pagination.spec.js +1 -1
  38. package/squirrel/components/p-pagination-info/p-pagination-info.spec.js +1 -1
  39. package/squirrel/components/p-progress-bar/p-progess-bar.spec.js +1 -1
  40. package/squirrel/components/p-ring-loader/p-ring-loader.spec.js +1 -1
  41. package/squirrel/components/p-select/p-select.spec.js +1 -1
  42. package/squirrel/components/p-select-btn/p-select-btn.spec.js +1 -1
  43. package/squirrel/components/p-select-list/p-select-list.spec.js +4 -5
  44. package/squirrel/components/p-select-pill/p-select-pill.spec.js +1 -1
  45. package/squirrel/components/p-skeleton-loader/p-skeleton-loader.spec.js +1 -1
  46. package/squirrel/components/p-table/p-table.spec.js +1 -1
  47. package/squirrel/components/p-table-header-cell/p-filter-icon.spec.js +1 -1
  48. package/squirrel/components/p-table-header-cell/p-table-header-cell.spec.js +1 -1
  49. package/squirrel/components/p-table-loader/p-table-loader.spec.js +1 -1
  50. package/squirrel/components/p-table-sort/p-table-sort.spec.js +1 -1
  51. package/squirrel/components/p-table-td/p-table-td.spec.js +36 -1
  52. package/squirrel/components/p-tabs/p-tabs.spec.js +1 -1
  53. package/squirrel/components/p-textarea/p-textarea.spec.js +1 -1
  54. package/squirrel/components/p-toggle/p-toggle.spec.js +1 -1
  55. package/squirrel/composables/useInputClasses.spec.js +41 -0
  56. package/squirrel/index.spec.js +21 -0
  57. package/squirrel/utils/dom.spec.js +2 -3
  58. package/squirrel/utils/listKeyboardNavigation.spec.js +5 -9
  59. package/squirrel/utils/sanitization.spec.js +1 -1
  60. package/squirrel/utils/tailwind.spec.js +27 -0
@@ -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
+ });
@@ -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
- jest.spyOn(element, 'offsetWidth', 'get').mockImplementation(() => 100);
10
- jest.spyOn(element, 'offsetHeight', 'get').mockImplementation(() => 100);
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 = jest.fn().mockImplementationOnce();
56
+ document.addEventListener = vi.fn().mockImplementationOnce();
57
57
 
58
58
  const navigationSvc = createTestSvc();
59
59
 
60
60
  navigationSvc.init();
61
61
 
62
- expect(navigationSvc).toHaveProperty(
63
- 'getItems',
64
- 'getFocusedItem',
65
- 'clearFocusedState',
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 = jest.spyOn(console, 'warn').mockImplementation(() => undefined);
4
+ const consoleMock = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
5
5
 
6
6
  afterAll(() => {
7
7
  consoleMock.mockReset();
@@ -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
+ });