@pequity/squirrel 11.0.2 → 11.0.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.
package/dist/es/index.js CHANGED
@@ -1055,8 +1055,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1055
1055
  };
1056
1056
  }
1057
1057
  });
1058
- const squirrel$1 = { "close": "Close", "action_bar_clear_all": "Clear All", "select_list_items": "{count} item | {count} items", "select_list_select_all": "Select all", "select_list_select_all_filtered": "Select all filtered", "select_list_clear_all": "Clear all", "select_list_no_items_found": "No items found", "dropdown_select_aria_label": "Dropdown select", "dropdown_select_remove_item": "Remove item", "dropdown_select_clear_selection": "Clear selection", "dropdown_select_all_options_selected": "All options selected", "dropdown_select_options": "option | options", "dropdown_select_selected": "selected", "dropdown_select_items": "@:squirrel.select_list_items", "dropdown_select_select_all": "@:squirrel.select_list_select_all", "dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered", "dropdown_select_clear_all": "@:squirrel.select_list_clear_all", "dropdown_select_add": "Add", "dropdown_select_no_items_found_type_to_add": "No items found. Type to add", "dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found", "file_upload_dropzone": "dropzone", "file_upload_drag_or_select": "Drag or {select}", "file_upload_drop": "Drop {fileWord}", "file_upload_max": "Max {count}", "file_upload_one": "One", "file_upload_files": "file | files", "file_upload_select": "select {fileWord}", "file_upload_with_size_less_than": "with size less than {maxSize} | with size less than {maxSize} each", "file_upload_max_files_exceeded": "You can only upload a maximum of {count} {fileWord}.", "file_upload_files_not_allowed": "{extension} files are not allowed.", "file_upload_file_size_exceeded": "File size of {fileName} exceeds {maxSize}.", "input_search_press_enter_to_search": "Press enter to search", "input_search_clear_search_input": "Clear search input", "pagination_go_to_previous_page": "go to the previous page", "pagination_go_to_page": "go to page {page}", "pagination_go_to_next_page": "go to the next page", "pagination_info_showing_results": "Showing {from} to {to} of {count} results", "pagination_info_no_results_found": "No results found", "table_sort_sort": "SORT", "table_sort_clear": "Clear", "table_sort_sort_ascending": "Sort ascending", "table_sort_sort_descending": "Sort descending", "tabs_pills_aria_label": "Tabs Pills" };
1058
+ const squirrel$3 = { "close": "Schließen", "action_bar_clear_all": "Alle löschen", "select_list_items": "{count} Element | {count} Elemente", "select_list_select_all": "Alle auswählen", "select_list_select_all_filtered": "Alle gefilterten auswählen", "select_list_clear_all": "Alle löschen", "select_list_no_items_found": "Keine Elemente gefunden", "dropdown_select_aria_label": "Dropdown-Auswahl", "dropdown_select_remove_item": "Element entfernen", "dropdown_select_clear_selection": "Auswahl löschen", "dropdown_select_all_options_selected": "Alle Optionen ausgewählt", "dropdown_select_options": "Option | Optionen", "dropdown_select_selected": "ausgewählt", "dropdown_select_items": "@:squirrel.select_list_items", "dropdown_select_select_all": "@:squirrel.select_list_select_all", "dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered", "dropdown_select_clear_all": "@:squirrel.select_list_clear_all", "dropdown_select_add": "Hinzufügen", "dropdown_select_no_items_found_type_to_add": "Keine Elemente gefunden. Tippen Sie zum Hinzufügen", "dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found", "file_upload_dropzone": "Ablagebereich", "file_upload_drag_or_select": "Ziehen oder {select}", "file_upload_drop": "{fileWord} ablegen", "file_upload_max": "Max. {count}", "file_upload_one": "Eine", "file_upload_files": "Datei | Dateien", "file_upload_select": "{fileWord} auswählen", "file_upload_with_size_less_than": "mit einer Größe unter {maxSize} | mit einer Größe unter {maxSize} jeweils", "file_upload_max_files_exceeded": "Sie können maximal {count} {fileWord} hochladen.", "file_upload_files_not_allowed": "{extension}-Dateien sind nicht erlaubt.", "file_upload_file_size_exceeded": "Die Dateigröße von {fileName} überschreitet {maxSize}.", "input_search_press_enter_to_search": "Drücken Sie die Eingabetaste zum Suchen", "input_search_clear_search_input": "Sucheingabe löschen", "pagination_go_to_previous_page": "zur vorherigen Seite gehen", "pagination_go_to_page": "zu Seite {page} gehen", "pagination_go_to_next_page": "zur nächsten Seite gehen", "pagination_info_showing_results": "Zeige {from} bis {to} von {count} Ergebnissen", "pagination_info_no_results_found": "Keine Ergebnisse gefunden", "table_sort_sort": "SORTIEREN", "table_sort_clear": "Löschen", "table_sort_sort_ascending": "Aufsteigend sortieren", "table_sort_sort_descending": "Absteigend sortieren", "tabs_pills_aria_label": "Tab-Pillen" };
1059
+ const deDE = {
1060
+ squirrel: squirrel$3
1061
+ };
1062
+ const squirrel$2 = { "close": "Close", "action_bar_clear_all": "Clear All", "select_list_items": "{count} item | {count} items", "select_list_select_all": "Select all", "select_list_select_all_filtered": "Select all filtered", "select_list_clear_all": "Clear all", "select_list_no_items_found": "No items found", "dropdown_select_aria_label": "Dropdown select", "dropdown_select_remove_item": "Remove item", "dropdown_select_clear_selection": "Clear selection", "dropdown_select_all_options_selected": "All options selected", "dropdown_select_options": "option | options", "dropdown_select_selected": "selected", "dropdown_select_items": "@:squirrel.select_list_items", "dropdown_select_select_all": "@:squirrel.select_list_select_all", "dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered", "dropdown_select_clear_all": "@:squirrel.select_list_clear_all", "dropdown_select_add": "Add", "dropdown_select_no_items_found_type_to_add": "No items found. Type to add", "dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found", "file_upload_dropzone": "dropzone", "file_upload_drag_or_select": "Drag or {select}", "file_upload_drop": "Drop {fileWord}", "file_upload_max": "Max {count}", "file_upload_one": "One", "file_upload_files": "file | files", "file_upload_select": "select {fileWord}", "file_upload_with_size_less_than": "with size less than {maxSize} | with size less than {maxSize} each", "file_upload_max_files_exceeded": "You can only upload a maximum of {count} {fileWord}.", "file_upload_files_not_allowed": "{extension} files are not allowed.", "file_upload_file_size_exceeded": "File size of {fileName} exceeds {maxSize}.", "input_search_press_enter_to_search": "Press enter to search", "input_search_clear_search_input": "Clear search input", "pagination_go_to_previous_page": "go to the previous page", "pagination_go_to_page": "go to page {page}", "pagination_go_to_next_page": "go to the next page", "pagination_info_showing_results": "Showing {from} to {to} of {count} results", "pagination_info_no_results_found": "No results found", "table_sort_sort": "SORT", "table_sort_clear": "Clear", "table_sort_sort_ascending": "Sort ascending", "table_sort_sort_descending": "Sort descending", "tabs_pills_aria_label": "Tabs Pills" };
1059
1063
  const enUS = {
1064
+ squirrel: squirrel$2
1065
+ };
1066
+ const squirrel$1 = { "close": "Cerrar", "action_bar_clear_all": "Borrar todo", "select_list_items": "{count} elemento | {count} elementos", "select_list_select_all": "Seleccionar todo", "select_list_select_all_filtered": "Seleccionar todo (filtrado)", "select_list_clear_all": "Borrar todo", "select_list_no_items_found": "No se encontraron elementos", "dropdown_select_aria_label": "Selección desplegable", "dropdown_select_remove_item": "Eliminar elemento", "dropdown_select_clear_selection": "Borrar selección", "dropdown_select_all_options_selected": "Todas las opciones seleccionadas", "dropdown_select_options": "opción | opciones", "dropdown_select_selected": "seleccionado", "dropdown_select_items": "@:squirrel.select_list_items", "dropdown_select_select_all": "@:squirrel.select_list_select_all", "dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered", "dropdown_select_clear_all": "@:squirrel.select_list_clear_all", "dropdown_select_add": "Agregar", "dropdown_select_no_items_found_type_to_add": "No se encontraron elementos. Escriba para agregar", "dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found", "file_upload_dropzone": "zona de carga", "file_upload_drag_or_select": "Arrastre o {select}", "file_upload_drop": "Soltar {fileWord}", "file_upload_max": "Máx. {count}", "file_upload_one": "Uno", "file_upload_files": "archivo | archivos", "file_upload_select": "seleccionar {fileWord}", "file_upload_with_size_less_than": "con tamaño menor que {maxSize} | con tamaño menor que {maxSize} cada uno", "file_upload_max_files_exceeded": "Solo puede cargar un máximo de {count} {fileWord}.", "file_upload_files_not_allowed": "Los archivos {extension} no están permitidos.", "file_upload_file_size_exceeded": "El tamaño del archivo {fileName} excede {maxSize}.", "input_search_press_enter_to_search": "Presione Enter para buscar", "input_search_clear_search_input": "Borrar entrada de búsqueda", "pagination_go_to_previous_page": "ir a la página anterior", "pagination_go_to_page": "ir a la página {page}", "pagination_go_to_next_page": "ir a la página siguiente", "pagination_info_showing_results": "Mostrando {from} a {to} de {count} resultados", "pagination_info_no_results_found": "No se encontraron resultados", "table_sort_sort": "ORDENAR", "table_sort_clear": "Borrar", "table_sort_sort_ascending": "Ordenar ascendente", "table_sort_sort_descending": "Ordenar descendente", "tabs_pills_aria_label": "Pestañas de píldoras" };
1067
+ const esES = {
1060
1068
  squirrel: squirrel$1
1061
1069
  };
1062
1070
  const squirrel = { "close": "Fermer", "action_bar_clear_all": "Effacer tout", "select_list_items": "{count} élément | {count} éléments", "select_list_select_all": "Tout sélectionner", "select_list_select_all_filtered": "Sélectionner tout (filtré)", "select_list_clear_all": "Effacer tout", "select_list_no_items_found": "Aucun élément trouvé", "dropdown_select_aria_label": "Liste déroulante", "dropdown_select_remove_item": "Supprimer l'élément", "dropdown_select_clear_selection": "Effacer la sélection", "dropdown_select_all_options_selected": "Toutes les options sélectionnées", "dropdown_select_options": "option | options", "dropdown_select_selected": "sélectionné", "dropdown_select_items": "@:squirrel.select_list_items", "dropdown_select_select_all": "@:squirrel.select_list_select_all", "dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered", "dropdown_select_clear_all": "@:squirrel.select_list_clear_all", "dropdown_select_add": "Ajouter", "dropdown_select_no_items_found_type_to_add": "Aucun élément trouvé. Tapez pour ajouter", "dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found", "file_upload_dropzone": "zone de dépôt", "file_upload_drag_or_select": "Glisser ou {select}", "file_upload_drop": "Déposer {fileWord}", "file_upload_max": "Max {count}", "file_upload_one": "Un", "file_upload_files": "fichier | fichiers", "file_upload_select": "sélectionner {fileWord}", "file_upload_with_size_less_than": "avec une taille inférieure à {maxSize} | avec une taille inférieure à {maxSize} chacun", "file_upload_max_files_exceeded": "Vous ne pouvez télécharger qu'un maximum de {count} {fileWord}.", "file_upload_files_not_allowed": "Les fichiers {extension} ne sont pas autorisés.", "file_upload_file_size_exceeded": "La taille du fichier {fileName} dépasse {maxSize}.", "input_search_press_enter_to_search": "Appuyez sur Entrée pour rechercher", "input_search_clear_search_input": "Effacer la saisie de recherche", "pagination_go_to_previous_page": "aller à la page précédente", "pagination_go_to_page": "aller à la page {page}", "pagination_go_to_next_page": "aller à la page suivante", "pagination_info_showing_results": "Affichage de {from} à {to} sur {count} résultats", "pagination_info_no_results_found": "Aucun résultat trouvé", "table_sort_sort": "TRIER", "table_sort_clear": "Effacer", "table_sort_sort_ascending": "Trier par ordre croissant", "table_sort_sort_descending": "Trier par ordre décroissant", "tabs_pills_aria_label": "Onglets pilules" };
@@ -1064,7 +1072,9 @@ const frFR = {
1064
1072
  squirrel
1065
1073
  };
1066
1074
  const squirrelMessages = {
1075
+ "de-DE": deDE,
1067
1076
  "en-US": enUS,
1077
+ "es-ES": esES,
1068
1078
  "fr-FR": frFR
1069
1079
  };
1070
1080
  const isSquirrelLocale = (locale) => {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "11.0.2",
5
- "packageManager": "pnpm@10.23.0",
4
+ "version": "11.0.3",
5
+ "packageManager": "pnpm@10.24.0",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "preinstall": "npx only-allow pnpm",
@@ -50,31 +50,31 @@
50
50
  "vue-toastification": "^2.0.0-rc.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@commitlint/cli": "^20.1.0",
54
- "@commitlint/config-conventional": "^20.0.0",
53
+ "@commitlint/cli": "^20.2.0",
54
+ "@commitlint/config-conventional": "^20.2.0",
55
55
  "@pequity/eslint-config": "^2.0.5",
56
- "@playwright/test": "^1.56.1",
56
+ "@playwright/test": "^1.57.0",
57
57
  "@semantic-release/changelog": "^6.0.3",
58
58
  "@semantic-release/git": "^10.0.1",
59
- "@storybook/addon-a11y": "^10.0.8",
60
- "@storybook/addon-docs": "^10.0.8",
61
- "@storybook/addon-links": "^10.0.8",
62
- "@storybook/addon-vitest": "^10.0.8",
63
- "@storybook/vue3-vite": "^10.0.8",
59
+ "@storybook/addon-a11y": "^10.1.4",
60
+ "@storybook/addon-docs": "^10.1.4",
61
+ "@storybook/addon-links": "^10.1.4",
62
+ "@storybook/addon-vitest": "^10.1.4",
63
+ "@storybook/vue3-vite": "^10.1.4",
64
64
  "@tanstack/vue-virtual": "3.13.12",
65
65
  "@types/jsdom": "^27.0.0",
66
66
  "@types/lodash-es": "^4.17.12",
67
67
  "@types/node": "^24.10.1",
68
68
  "@vitejs/plugin-vue": "^6.0.2",
69
- "@vitest/browser": "4.0.13",
70
- "@vitest/browser-playwright": "^4.0.13",
71
- "@vitest/coverage-v8": "^4.0.13",
69
+ "@vitest/browser": "4.0.15",
70
+ "@vitest/browser-playwright": "^4.0.15",
71
+ "@vitest/coverage-v8": "^4.0.15",
72
72
  "@vue/compiler-sfc": "3.5.25",
73
73
  "@vue/test-utils": "^2.4.6",
74
74
  "@vuepic/vue-datepicker": "12.0.5",
75
75
  "autoprefixer": "^10.4.22",
76
76
  "eslint": "^9.39.1",
77
- "eslint-plugin-storybook": "^10.0.8",
77
+ "eslint-plugin-storybook": "^10.1.4",
78
78
  "floating-vue": "5.2.2",
79
79
  "glob": "^13.0.0",
80
80
  "husky": "^9.1.7",
@@ -83,23 +83,23 @@
83
83
  "lint-staged": "^16.2.7",
84
84
  "lodash-es": "4.17.21",
85
85
  "make-coverage-badge": "^1.2.0",
86
- "playwright": "^1.56.1",
86
+ "playwright": "^1.57.0",
87
87
  "postcss": "^8.5.6",
88
- "prettier": "^3.6.2",
89
- "prettier-plugin-tailwindcss": "^0.7.1",
88
+ "prettier": "^3.7.4",
89
+ "prettier-plugin-tailwindcss": "^0.7.2",
90
90
  "resolve-tspaths": "^0.8.23",
91
91
  "rimraf": "^6.1.2",
92
92
  "sass": "^1.94.2",
93
93
  "semantic-release": "^25.0.2",
94
- "storybook": "^10.0.8",
94
+ "storybook": "^10.1.4",
95
95
  "svgo": "^4.0.0",
96
96
  "tailwindcss": "^3.4.17",
97
97
  "typescript": "5.9.3",
98
- "vite": "^7.2.4",
99
- "vitest": "^4.0.13",
98
+ "vite": "^7.2.6",
99
+ "vitest": "^4.0.15",
100
100
  "vue": "3.5.25",
101
101
  "vue-currency-input": "3.2.1",
102
- "vue-i18n": "^11.2.1",
102
+ "vue-i18n": "^11.2.2",
103
103
  "vue-router": "4.6.3",
104
104
  "vue-toastification": "2.0.0-rc.5",
105
105
  "vue-tsc": "3.1.5"
@@ -97,14 +97,24 @@ describe('PBtn.vue', () => {
97
97
 
98
98
  const element = wrapper.find(el);
99
99
 
100
- if (el !== 'a') {
101
- const slotWrapper = wrapper.find('.slot-wrapper');
102
- expect(slotWrapper.classes()).toEqual(['slot-wrapper', 'empty:hidden']);
103
- }
104
-
105
100
  expect(classes.every((c) => element.classes().includes(c))).toBe(true);
106
101
  expect(DEFAULT_CLASSES_ARRAY.every((c) => element.classes().includes(c))).toBe(true);
107
102
  });
103
+
104
+ // Test slot-wrapper separately for non-anchor elements to avoid conditional expects
105
+ if (el !== 'a') {
106
+ it(`renders a ${el} with slot-wrapper having correct classes`, async () => {
107
+ const wrapper = createWrapperFor(PBtn, {
108
+ attrs: { to },
109
+ global: {
110
+ stubs: { RouterLink: { template: '<section class="router-link-stub"><slot /></section>' } },
111
+ },
112
+ });
113
+
114
+ const slotWrapper = wrapper.find('.slot-wrapper');
115
+ expect(slotWrapper.classes()).toEqual(['slot-wrapper', 'empty:hidden']);
116
+ });
117
+ }
108
118
  });
109
119
 
110
120
  it.each([
@@ -174,22 +174,27 @@ describe('PDrawer basic functionality', () => {
174
174
  wrapper.unmount();
175
175
  });
176
176
 
177
- it.each([
178
- [true, 'renders', true, 'bg-black/20'],
179
- [false, 'does not render', false, null],
180
- ])('%s backdrop when showBackdrop is %s', async (showBackdrop, description, shouldExist, expectedClass) => {
181
- const wrapper = createWrapperContainer({ showBackdrop });
177
+ it('renders backdrop when showBackdrop is true', async () => {
178
+ const wrapper = createWrapperContainer({ showBackdrop: true });
182
179
 
183
180
  await wrapper.setData({ showDrawer: true });
184
181
 
185
182
  const backdrop = wrapper.find('.fixed.bottom-0.left-0.right-0.top-0');
186
183
 
187
- if (shouldExist) {
188
- expect(backdrop.exists()).toBe(true);
189
- expect(backdrop.classes()).toContain(expectedClass);
190
- } else {
191
- expect(backdrop.isVisible()).toBe(false);
192
- }
184
+ expect(backdrop.exists()).toBe(true);
185
+ expect(backdrop.classes()).toContain('bg-black/20');
186
+
187
+ wrapper.unmount();
188
+ });
189
+
190
+ it('does not render backdrop when showBackdrop is false', async () => {
191
+ const wrapper = createWrapperContainer({ showBackdrop: false });
192
+
193
+ await wrapper.setData({ showDrawer: true });
194
+
195
+ const backdrop = wrapper.find('.fixed.bottom-0.left-0.right-0.top-0');
196
+
197
+ expect(backdrop.isVisible()).toBe(false);
193
198
 
194
199
  wrapper.unmount();
195
200
  });
@@ -149,23 +149,28 @@ describe('PDropdown.vue', () => {
149
149
  expect(destroyFn).toHaveBeenCalled();
150
150
  });
151
151
 
152
- it.each([
153
- [true, 'enables'],
154
- [false, 'disables'],
155
- ])('%s arrow navigation when enableArrowNavigation is %s', async (enableArrowNavigation, description) => {
152
+ it('enables arrow navigation when enableArrowNavigation is true', async () => {
156
153
  setupListKeyboardNavigation.mockImplementation(() => createMockedKbdNavigationSvc());
157
154
 
158
155
  createWrapper({
159
156
  props: {
160
- enableArrowNavigation,
157
+ enableArrowNavigation: true,
158
+ },
159
+ });
160
+
161
+ expect(setupListKeyboardNavigation).toHaveBeenCalledTimes(1);
162
+ });
163
+
164
+ it('disables arrow navigation when enableArrowNavigation is false', async () => {
165
+ setupListKeyboardNavigation.mockImplementation(() => createMockedKbdNavigationSvc());
166
+
167
+ createWrapper({
168
+ props: {
169
+ enableArrowNavigation: false,
161
170
  },
162
171
  });
163
172
 
164
- if (enableArrowNavigation) {
165
- expect(setupListKeyboardNavigation).toHaveBeenCalledTimes(1);
166
- } else {
167
- expect(setupListKeyboardNavigation).not.toHaveBeenCalled();
168
- }
173
+ expect(setupListKeyboardNavigation).not.toHaveBeenCalled();
169
174
  });
170
175
 
171
176
  it('handles escape key when enableCloseOnEsc is true', async () => {
@@ -595,11 +595,11 @@ describe('PDropdownSelect.vue', () => {
595
595
 
596
596
  const items = wrapper.findAll('[p-select-list-option-item]');
597
597
 
598
- items.forEach((item) => {
599
- if (item.text() !== '') {
600
- expect(item.text().includes('44')).toBe(true);
601
- expect(item.classes()).toContain('selected');
602
- }
598
+ // Filter out empty items and check them separately
599
+ const nonEmptyItems = items.filter((item) => item.text() !== '');
600
+ nonEmptyItems.forEach((item) => {
601
+ expect(item.text().includes('44')).toBe(true);
602
+ expect(item.classes()).toContain('selected');
603
603
  });
604
604
 
605
605
  await wrapper.findByText('ff-a57d-beba44884da2').trigger('click');
@@ -608,13 +608,22 @@ describe('PDropdownSelect.vue', () => {
608
608
 
609
609
  const newItems = wrapper.findAll('[p-select-list-option-item]');
610
610
 
611
- newItems.forEach((item) => {
611
+ // Split items into those with images and those without
612
+ const selectedItemTexts = ['4d68f93b-ec71-4f02-a1a2-ffb5d87be9f1', 'de5c4b8b-80e1-4475-aa8f-3e0fd0f9ddd7'];
613
+ const itemsWithImages = newItems.filter((item) => {
612
614
  const itemText = item.find('.truncate.text-p-purple-60').text();
613
- if (itemText === '4d68f93b-ec71-4f02-a1a2-ffb5d87be9f1' || itemText === 'de5c4b8b-80e1-4475-aa8f-3e0fd0f9ddd7') {
614
- expect(item.find('img').exists()).toBe(true);
615
- } else {
616
- expect(item.find('img').exists()).toBe(false);
617
- }
615
+ return selectedItemTexts.includes(itemText);
616
+ });
617
+ const itemsWithoutImages = newItems.filter((item) => {
618
+ const itemText = item.find('.truncate.text-p-purple-60').text();
619
+ return !selectedItemTexts.includes(itemText);
620
+ });
621
+
622
+ itemsWithImages.forEach((item) => {
623
+ expect(item.find('img').exists()).toBe(true);
624
+ });
625
+ itemsWithoutImages.forEach((item) => {
626
+ expect(item.find('img').exists()).toBe(false);
618
627
  });
619
628
 
620
629
  expect(wrapper.vm.$data.selected).toEqual([1, 3]);
@@ -636,14 +645,18 @@ describe('PDropdownSelect.vue', () => {
636
645
 
637
646
  const listItems = wrapper.findAll('[p-select-list-option-item]');
638
647
 
639
- listItems.forEach((item, i) => {
640
- if (i === 0 || i === 1) {
641
- expect(item.classes()).not.toContain('cursor-pointer');
642
- expect(item.classes()).toContain('cursor-default');
643
- } else {
644
- expect(item.classes()).toContain('cursor-pointer');
645
- expect(item.classes()).not.toContain('cursor-default');
646
- }
648
+ // Test disabled items (indices 0 and 1)
649
+ const disabledItems = [listItems[0], listItems[1]];
650
+ disabledItems.forEach((item) => {
651
+ expect(item.classes()).not.toContain('cursor-pointer');
652
+ expect(item.classes()).toContain('cursor-default');
653
+ });
654
+
655
+ // Test enabled items (rest of the items)
656
+ const enabledItems = listItems.slice(2);
657
+ enabledItems.forEach((item) => {
658
+ expect(item.classes()).toContain('cursor-pointer');
659
+ expect(item.classes()).not.toContain('cursor-default');
647
660
  });
648
661
 
649
662
  cleanup(wrapper);
@@ -664,14 +677,18 @@ describe('PDropdownSelect.vue', () => {
664
677
 
665
678
  const listItems = wrapper.findAll('[p-select-list-option-item]');
666
679
 
667
- listItems.forEach((item, i) => {
668
- if (i === 0 || i === 1) {
669
- expect(item.classes()).toContain('cursor-default');
670
- expect(item.classes()).not.toContain('cursor-pointer');
671
- } else {
672
- expect(item.classes()).toContain('cursor-pointer');
673
- expect(item.classes()).not.toContain('cursor-default');
674
- }
680
+ // Test disabled items (indices 0 and 1) based on disabledBy prop
681
+ const disabledItems = [listItems[0], listItems[1]];
682
+ disabledItems.forEach((item) => {
683
+ expect(item.classes()).toContain('cursor-default');
684
+ expect(item.classes()).not.toContain('cursor-pointer');
685
+ });
686
+
687
+ // Test enabled items (rest of the items)
688
+ const enabledItems = listItems.slice(2);
689
+ enabledItems.forEach((item) => {
690
+ expect(item.classes()).toContain('cursor-pointer');
691
+ expect(item.classes()).not.toContain('cursor-default');
675
692
  });
676
693
 
677
694
  cleanup(wrapper);
@@ -12,37 +12,29 @@ describe('PPagination.vue', () => {
12
12
 
13
13
  const controls = await wrapper.findAll('div.w-6.h-6');
14
14
 
15
- controls.forEach((control, i) => {
16
- if (i === 0) {
17
- expect(control.classes()).toContain('opacity-50');
18
- expect(control.attributes()['aria-label']).toBe('go to the previous page');
19
- }
20
- if (i === 1) {
21
- expect(control.text()).toBe('1');
22
- expect(control.attributes()['aria-label']).toBe('go to page 1');
23
- }
24
- if (i === 2) {
25
- expect(control.text()).toBe('2');
26
- expect(control.attributes()['aria-label']).toBe('go to page 2');
27
- }
28
- if (i === 3) {
29
- expect(control.text()).toBe('3');
30
- expect(control.attributes()['aria-label']).toBe('go to page 3');
31
- }
32
- if (i === 4) {
33
- expect(control.text()).toBe('...');
34
- expect(control.attributes()['aria-label']).toBe(undefined);
35
- }
36
- if (i === 5) {
37
- expect(control.text()).toBe('5');
38
- expect(control.attributes()['aria-label']).toBe('go to page 5');
39
- }
40
- if (i === 6) {
41
- expect(control.classes()).toContain('cursor-pointer');
42
- expect(control.attributes()['aria-label']).toBe('go to the next page');
43
- }
44
- });
45
15
  expect(controls.length).toBe(7);
16
+
17
+ // Test each control directly by index to avoid conditional expects
18
+ expect(controls[0].classes()).toContain('opacity-50');
19
+ expect(controls[0].attributes()['aria-label']).toBe('go to the previous page');
20
+
21
+ expect(controls[1].text()).toBe('1');
22
+ expect(controls[1].attributes()['aria-label']).toBe('go to page 1');
23
+
24
+ expect(controls[2].text()).toBe('2');
25
+ expect(controls[2].attributes()['aria-label']).toBe('go to page 2');
26
+
27
+ expect(controls[3].text()).toBe('3');
28
+ expect(controls[3].attributes()['aria-label']).toBe('go to page 3');
29
+
30
+ expect(controls[4].text()).toBe('...');
31
+ expect(controls[4].attributes()['aria-label']).toBe(undefined);
32
+
33
+ expect(controls[5].text()).toBe('5');
34
+ expect(controls[5].attributes()['aria-label']).toBe('go to page 5');
35
+
36
+ expect(controls[6].classes()).toContain('cursor-pointer');
37
+ expect(controls[6].attributes()['aria-label']).toBe('go to the next page');
46
38
  });
47
39
 
48
40
  it(`updates the value bound with v-model`, async () => {
@@ -153,26 +153,28 @@ describe('PSelectBtn.vue', () => {
153
153
 
154
154
  const buttons = await wrapper.findAll('button');
155
155
 
156
- buttons.forEach((button, i) => {
157
- if (i !== 0 && i !== items.length - 1) {
158
- expect(['rounded-none'].every((c) => button.classes().includes(c))).toBe(true);
159
- }
160
- if (i === 0) {
161
- expect(['rounded-br-none', 'rounded-tr-none'].every((c) => button.classes().includes(c))).toBe(true);
162
- }
163
- if (i === items.length - 1) {
164
- expect(['rounded-bl-none', 'rounded-tl-none'].every((c) => button.classes().includes(c))).toBe(true);
165
- }
166
- if (i !== items.length - 1) {
167
- expect(button.classes()).toContain('-mr-0.5');
168
- }
169
-
170
- // Check highlightSelected prop
171
- if (button.text() === 'Option 2') {
172
- expect(button.attributes()['aria-selected']).toBe('true');
173
- } else {
174
- expect(button.attributes()['aria-selected']).toBe('false');
175
- }
156
+ // Test first button (index 0)
157
+ expect(['rounded-br-none', 'rounded-tr-none'].every((c) => buttons[0].classes().includes(c))).toBe(true);
158
+ expect(buttons[0].classes()).toContain('-mr-0.5');
159
+
160
+ // Test middle buttons (not first, not last)
161
+ const middleButtons = buttons.slice(1, items.length - 1);
162
+ middleButtons.forEach((button) => {
163
+ expect(['rounded-none'].every((c) => button.classes().includes(c))).toBe(true);
164
+ expect(button.classes()).toContain('-mr-0.5');
165
+ });
166
+
167
+ // Test last button
168
+ const lastButton = buttons[items.length - 1];
169
+ expect(['rounded-bl-none', 'rounded-tl-none'].every((c) => lastButton.classes().includes(c))).toBe(true);
170
+
171
+ // Check highlightSelected prop - split into selected and non-selected buttons
172
+ const selectedButton = buttons.find((button) => button.text() === 'Option 2');
173
+ const nonSelectedButtons = buttons.filter((button) => button.text() !== 'Option 2');
174
+
175
+ expect(selectedButton.attributes()['aria-selected']).toBe('true');
176
+ nonSelectedButtons.forEach((button) => {
177
+ expect(button.attributes()['aria-selected']).toBe('false');
176
178
  });
177
179
  });
178
180
 
@@ -268,17 +270,23 @@ describe('PSelectBtn.vue', () => {
268
270
 
269
271
  const buttons = await wrapper.findAll('button');
270
272
 
273
+ // Test button text for all buttons
271
274
  buttons.forEach((button, i) => {
272
275
  const slotContent = button.text().split(' - ');
273
276
  const btnText = slotContent[0];
274
- const isSelected = slotContent[1];
275
-
276
277
  expect(btnText).toBe(items[i].textCustom);
277
- if (i === 1) {
278
- expect(isSelected).toBe('true');
279
- } else {
280
- expect(isSelected).toBe('false');
281
- }
278
+ });
279
+
280
+ // Test isSelected for the selected button (index 1)
281
+ const selectedButtonSlot = buttons[1].text().split(' - ');
282
+ expect(selectedButtonSlot[1]).toBe('true');
283
+
284
+ // Test isSelected for non-selected buttons
285
+ const nonSelectedButtons = buttons.filter((_, i) => i !== 1);
286
+ nonSelectedButtons.forEach((button) => {
287
+ const slotContent = button.text().split(' - ');
288
+ const isSelected = slotContent[1];
289
+ expect(isSelected).toBe('false');
282
290
  });
283
291
 
284
292
  expect(true).toBe(true);
@@ -476,11 +476,11 @@ describe('PSelectList.vue', () => {
476
476
 
477
477
  const items = wrapper.findAll('[p-select-list-option-item]');
478
478
 
479
- items.forEach((item) => {
480
- if (item.text() !== '') {
481
- expect(item.text().includes('44')).toBe(true);
482
- expect(item.classes()).toContain('selected');
483
- }
479
+ // Filter out empty items and check them separately
480
+ const nonEmptyItems = items.filter((item) => item.text() !== '');
481
+ nonEmptyItems.forEach((item) => {
482
+ expect(item.text().includes('44')).toBe(true);
483
+ expect(item.classes()).toContain('selected');
484
484
  });
485
485
 
486
486
  await wrapper.findByText('ff-a57d-beba44884da2').trigger('click');
@@ -489,13 +489,22 @@ describe('PSelectList.vue', () => {
489
489
 
490
490
  const newItems = wrapper.findAll('[p-select-list-option-item]');
491
491
 
492
- newItems.forEach((item) => {
492
+ // Split items into those with images and those without
493
+ const selectedItemTexts = ['4d68f93b-ec71-4f02-a1a2-ffb5d87be9f1', 'de5c4b8b-80e1-4475-aa8f-3e0fd0f9ddd7'];
494
+ const itemsWithImages = newItems.filter((item) => {
493
495
  const itemText = item.find('.truncate.text-p-purple-60').text();
494
- if (itemText === '4d68f93b-ec71-4f02-a1a2-ffb5d87be9f1' || itemText === 'de5c4b8b-80e1-4475-aa8f-3e0fd0f9ddd7') {
495
- expect(item.find('img').exists()).toBe(true);
496
- } else {
497
- expect(item.find('img').exists()).toBe(false);
498
- }
496
+ return selectedItemTexts.includes(itemText);
497
+ });
498
+ const itemsWithoutImages = newItems.filter((item) => {
499
+ const itemText = item.find('.truncate.text-p-purple-60').text();
500
+ return !selectedItemTexts.includes(itemText);
501
+ });
502
+
503
+ itemsWithImages.forEach((item) => {
504
+ expect(item.find('img').exists()).toBe(true);
505
+ });
506
+ itemsWithoutImages.forEach((item) => {
507
+ expect(item.find('img').exists()).toBe(false);
499
508
  });
500
509
 
501
510
  expect(wrapper.vm.$data.selected).toEqual([1, 3]);
@@ -543,14 +552,18 @@ describe('PSelectList.vue', () => {
543
552
 
544
553
  const listItems = wrapper.findAll('[p-select-list-option-item]');
545
554
 
546
- listItems.forEach((item, i) => {
547
- if (i === 0 || i === 1) {
548
- expect(item.classes()).toContain('cursor-default');
549
- expect(item.classes()).not.toContain('cursor-pointer');
550
- } else {
551
- expect(item.classes()).toContain('cursor-pointer');
552
- expect(item.classes()).not.toContain('cursor-default');
553
- }
555
+ // Test disabled items (indices 0 and 1)
556
+ const disabledItems = [listItems[0], listItems[1]];
557
+ disabledItems.forEach((item) => {
558
+ expect(item.classes()).toContain('cursor-default');
559
+ expect(item.classes()).not.toContain('cursor-pointer');
560
+ });
561
+
562
+ // Test enabled items (rest of the items)
563
+ const enabledItems = listItems.slice(2);
564
+ enabledItems.forEach((item) => {
565
+ expect(item.classes()).toContain('cursor-pointer');
566
+ expect(item.classes()).not.toContain('cursor-default');
554
567
  });
555
568
 
556
569
  cleanup(wrapper);
@@ -567,14 +580,18 @@ describe('PSelectList.vue', () => {
567
580
 
568
581
  const listItems = wrapper.findAll('[p-select-list-option-item]');
569
582
 
570
- listItems.forEach((item, i) => {
571
- if (i === 0 || i === 1) {
572
- expect(item.classes()).toContain('cursor-default');
573
- expect(item.classes()).not.toContain('cursor-pointer');
574
- } else {
575
- expect(item.classes()).toContain('cursor-pointer');
576
- expect(item.classes()).not.toContain('cursor-default');
577
- }
583
+ // Test disabled items (indices 0 and 1) based on disabledBy prop
584
+ const disabledItems = [listItems[0], listItems[1]];
585
+ disabledItems.forEach((item) => {
586
+ expect(item.classes()).toContain('cursor-default');
587
+ expect(item.classes()).not.toContain('cursor-pointer');
588
+ });
589
+
590
+ // Test enabled items (rest of the items)
591
+ const enabledItems = listItems.slice(2);
592
+ enabledItems.forEach((item) => {
593
+ expect(item.classes()).toContain('cursor-pointer');
594
+ expect(item.classes()).not.toContain('cursor-default');
578
595
  });
579
596
 
580
597
  cleanup(wrapper);
@@ -219,12 +219,13 @@ describe('PSelectPill.vue', () => {
219
219
  // Test mounted lifecycle
220
220
  expect(wrapper.vm.$refs.pill).toBeDefined();
221
221
 
222
- // Test that pill ref exists and style can be set
223
- if (wrapper.vm.$refs.pill instanceof HTMLElement) {
224
- wrapper.vm.setPillStyle();
225
- expect(wrapper.vm.$refs.pill.style.left).toBeDefined();
226
- expect(wrapper.vm.$refs.pill.style.width).toBeDefined();
227
- }
222
+ // Test that pill ref exists and is an HTMLElement
223
+ expect(wrapper.vm.$refs.pill instanceof HTMLElement).toBe(true);
224
+
225
+ // Test that style can be set
226
+ wrapper.vm.setPillStyle();
227
+ expect(wrapper.vm.$refs.pill.style.left).toBeDefined();
228
+ expect(wrapper.vm.$refs.pill.style.width).toBeDefined();
228
229
 
229
230
  wrapper.unmount();
230
231
  });