Skip to content

Commit 0059451

Browse files
feat(combobox-with-popover, combobox-multi-select): DLT-3395 forward dialogClass to popover dialog (#1254)
1 parent 8a852e8 commit 0059451

8 files changed

Lines changed: 78 additions & 0 deletions

packages/dialtone-vue/components/combobox_multi_select/combobox_multi_select.stories.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ export const argTypesData = {
136136
disable: true,
137137
},
138138
},
139+
dialogClass: {
140+
description: 'Additional class for the popover dialog element.',
141+
control: {
142+
type: 'text',
143+
},
144+
},
139145
};
140146

141147
// Story Collection

packages/dialtone-vue/components/combobox_multi_select/combobox_multi_select.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,4 +363,27 @@ describe('DtComboboxMultiSelect Tests', () => {
363363
});
364364
});
365365
});
366+
367+
describe('When dialogClass is provided', () => {
368+
// Popover teleports to body, so query body directly via data-qa
369+
// (same pattern as tooltip/split_button/hovercard tests).
370+
let dialog;
371+
372+
beforeEach(async () => {
373+
props = { ...baseProps, dialogClass: 'custom-dialog-class' };
374+
wrapper?.unmount();
375+
_setWrappers();
376+
await input.trigger('focus');
377+
await flushPromises();
378+
dialog = document.body.querySelector('[data-qa="dt-popover"]');
379+
});
380+
381+
it('should render the popover dialog element', () => {
382+
expect(dialog).not.toBeNull();
383+
});
384+
385+
it('should apply the class to the popover dialog element', () => {
386+
expect(dialog.classList.contains('custom-dialog-class')).toBe(true);
387+
});
388+
});
366389
});

packages/dialtone-vue/components/combobox_multi_select/combobox_multi_select.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:has-suggestion-list="hasSuggestionList"
1111
content-width="anchor"
1212
:append-to="appendTo"
13+
:dialog-class="dialogClass"
1314
:transition="transition"
1415
v-bind="extractNonListeners($attrs)"
1516
@select="onComboboxSelect"
@@ -373,6 +374,14 @@ export default {
373374
type: Boolean,
374375
default: false,
375376
},
377+
378+
/**
379+
* Additional class for the popover dialog element.
380+
*/
381+
dialogClass: {
382+
type: [String, Object, Array],
383+
default: '',
384+
},
376385
},
377386
378387
emits: [

packages/dialtone-vue/components/combobox_multi_select/combobox_multi_select_default.story.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
:max-selected-message="$attrs.maxSelectedMessage"
2424
:has-suggestion-list="$attrs.hasSuggestionList"
2525
:append-to="$attrs.appendTo"
26+
:dialog-class="$attrs.dialogClass"
2627
:transition="$attrs.transition"
2728
:reserved-right-space="$attrs.reservedRightSpace"
2829
@input="onComboboxInput"

packages/dialtone-vue/components/combobox_with_popover/combobox_with_popover.stories.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ export const argTypesData = {
150150
},
151151
},
152152

153+
dialogClass: {
154+
description: 'Additional class for the popover dialog element.',
155+
control: {
156+
type: 'text',
157+
},
158+
},
159+
153160
// Action Event Handlers
154161
onEscape: {
155162
table: {

packages/dialtone-vue/components/combobox_with_popover/combobox_with_popover.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,4 +549,26 @@ describe('DtComboboxWithPopover Tests', () => {
549549
);
550550
});
551551
});
552+
553+
describe('When dialogClass is provided', () => {
554+
// Popover teleports to body, so query body directly via data-qa
555+
// (same pattern as tooltip/split_button/hovercard tests).
556+
let dialog;
557+
558+
beforeEach(async () => {
559+
props = { ...baseProps, dialogClass: 'custom-dialog-class' };
560+
wrapper?.unmount();
561+
_mountWrapper();
562+
await _openComboboxPopover();
563+
dialog = document.body.querySelector('[data-qa="dt-popover"]');
564+
});
565+
566+
it('should render the popover dialog element', () => {
567+
expect(dialog).not.toBeNull();
568+
});
569+
570+
it('should apply the class to the popover dialog element', () => {
571+
expect(dialog.classList.contains('custom-dialog-class')).toBe(true);
572+
});
573+
});
552574
});

packages/dialtone-vue/components/combobox_with_popover/combobox_with_popover.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
:modal="false"
5555
:auto-focus="false"
5656
:append-to="appendTo"
57+
:dialog-class="dialogClass"
5758
:transition="transition"
5859
@opened="opened"
5960
>
@@ -195,6 +196,14 @@ export default {
195196
default: '',
196197
},
197198
199+
/**
200+
* Additional class for the popover dialog element.
201+
*/
202+
dialogClass: {
203+
type: [String, Array, Object],
204+
default: '',
205+
},
206+
198207
/**
199208
* A method that will be called when the selection goes past the beginning of the list.
200209
*/

packages/dialtone-vue/components/combobox_with_popover/combobox_with_popover_default.story.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:padding="$attrs.padding"
1515
:list-id="$attrs.listId"
1616
:list-class="$attrs.listClass"
17+
:dialog-class="$attrs.dialogClass"
1718
:open-with-arrow-keys="$attrs.openWithArrowKeys"
1819
:empty-list="$attrs.emptyList"
1920
:empty-state-message="$attrs.emptyStateMessage"

0 commit comments

Comments
 (0)