File tree Expand file tree Collapse file tree
src/tests/components/Request Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( {
You can’t perform that action at this time.
0 commit comments