Skip to content

Commit 43d93c8

Browse files
test(request-picker): add tests for variant prop
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 7706303 commit 43d93c8

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/tests/components/Request/RequestPicker.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,39 @@ describe('RequestPicker component rules', () => {
173173
})
174174
})
175175

176+
describe('variant prop', () => {
177+
const mountWithVariantStub = (props = {}) => mount(RequestPicker, {
178+
props,
179+
global: {
180+
stubs: {
181+
NcActions: {
182+
name: 'NcActions',
183+
props: ['variant'],
184+
template: '<div class="nc-actions-stub" :data-variant="variant"><slot /></div>',
185+
},
186+
NcActionButton: true,
187+
NcButton: true,
188+
NcDialog: true,
189+
NcTextField: true,
190+
NcLoadingIcon: true,
191+
NcNoteCard: true,
192+
UploadProgress: true,
193+
},
194+
mocks: { t: tSimple },
195+
},
196+
})
197+
198+
it('defaults variant to tertiary', () => {
199+
const w = mountWithVariantStub()
200+
expect(w.find('.nc-actions-stub').attributes('data-variant')).toBe('tertiary')
201+
})
202+
203+
it('passes custom variant to NcActions', () => {
204+
const w = mountWithVariantStub({ variant: 'primary' })
205+
expect(w.find('.nc-actions-stub').attributes('data-variant')).toBe('primary')
206+
})
207+
})
208+
176209
describe('envelope support', () => {
177210
it('enables envelope mode when capabilities indicate is-available true', () => {
178211
getCapabilitiesMock.mockReturnValue({

0 commit comments

Comments
 (0)