Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Commit 387fb3d

Browse files
committed
Use specialized method to select an <option> in test
The setSelected() method was added in vuejs/vue-test-utils#557, but apparently never documented. It seems stable and intended for end-user use nonetheless, so it is probably just an oversight documentation wise.
1 parent 10db270 commit 387fb3d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tests/unit/components/ValueTypeDropDown.spec.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@ describe( 'ValueTypeDropDown.vue', () => {
88
const optionItems = PropertyValueRelation;
99
const wrapper = shallowMount( ValueTypeDropDown );
1010

11-
wrapper.setData( {
12-
selected: optionItems.Matching,
13-
optionItems: optionItems,
14-
} );
15-
16-
wrapper.findComponent( ValueTypeDropDown ).vm.$emit( 'input', optionItems.Matching );
11+
wrapper.find(`option[value="${optionItems.Regardless}"]`).setSelected();
1712

1813
await Vue.nextTick();
1914

20-
expect( wrapper.emitted( 'input' )![ 0 ][ 0 ] ).toEqual( optionItems.Matching );
15+
expect( wrapper.emitted( 'input' )![ 0 ][ 0 ] ).toEqual( optionItems.Regardless );
2116
} );
2217
} );

0 commit comments

Comments
 (0)