@dile/ui 3.5.2 → 3.5.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.
@@ -310,6 +310,53 @@ describe('dile-select-ajax-overlay', () => {
310
310
  });
311
311
  });
312
312
 
313
+ describe('Icons', () => {
314
+ it('propagates iconProperty to data-icon on each generated <option>', async () => {
315
+ mockFetch([
316
+ { id: 1, name: 'Spain', iconName: 'lucide.house' },
317
+ { id: 2, name: 'France', iconName: 'material.star' },
318
+ ]);
319
+ const el = await renderSelectAjaxOverlay(`
320
+ <dile-select-ajax-overlay endpoint="/api/countries" idProperty="id" displayProperty="name" iconProperty="iconName" delay="10"></dile-select-ajax-overlay>
321
+ `);
322
+
323
+ await typeKeyword(el, 'sp');
324
+
325
+ const options = el.select.options;
326
+ expect(options[0].icon).toBe('lucide.house');
327
+ expect(options[1].icon).toBe('material.star');
328
+ });
329
+
330
+ it('propagates icon as the default data-icon on the generated <select>, overridable per option via iconProperty', async () => {
331
+ mockFetch([
332
+ { id: 1, name: 'Spain' },
333
+ { id: 2, name: 'France', iconName: 'material.star' },
334
+ ]);
335
+ const el = await renderSelectAjaxOverlay(`
336
+ <dile-select-ajax-overlay endpoint="/api/countries" idProperty="id" displayProperty="name" iconProperty="iconName" icon="lucide.globe" delay="10"></dile-select-ajax-overlay>
337
+ `);
338
+
339
+ await typeKeyword(el, 'sp');
340
+
341
+ const options = el.select.options;
342
+ // Spain has no iconName of its own, so it falls back to the select-level default.
343
+ expect(options[0].icon).toBe('lucide.globe');
344
+ // France declares its own icon via iconProperty, which takes precedence.
345
+ expect(options[1].icon).toBe('material.star');
346
+ });
347
+
348
+ it('does not set data-icon at all when neither icon nor iconProperty is used', async () => {
349
+ mockFetch([{ id: 1, name: 'Spain' }]);
350
+ const el = await renderSelectAjaxOverlay(`
351
+ <dile-select-ajax-overlay endpoint="/api/countries" idProperty="id" displayProperty="name" delay="10"></dile-select-ajax-overlay>
352
+ `);
353
+
354
+ await typeKeyword(el, 'sp');
355
+
356
+ expect(el.select.options[0].icon).toBeUndefined();
357
+ });
358
+ });
359
+
313
360
  describe('Form Association', () => {
314
361
  it('is form-associated and sets form value', async () => {
315
362
  const el = await renderSelectAjaxOverlay(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/ui",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "UI Core components from dile-components.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "352830a2d1bd846bd07ffc0084df32dc3f8bac83"
31
+ "gitHead": "e9fe84bbbcc552ccf6045190ee0f034dfdb06412"
32
32
  }