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

Commit

Permalink
test that checks if button triggers action removeCondition in QueryCo…
Browse files Browse the repository at this point in the history
…ndition
  • Loading branch information
guergana committed Jan 4, 2021
1 parent 3512fc4 commit 5b9759c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unit/components/QueryCondition.spec.ts
Expand Up @@ -100,6 +100,28 @@ describe( 'QueryCondition.vue', () => {
expect( store.dispatch ).toHaveBeenCalledWith( 'updateValue', { value: userInput, conditionIndex } );
} );

it( 'removes current row when the removeCondition button is clicked', async () => {
const store = newStore();
const conditionIndex = 0;
store.dispatch = jest.fn();
const wrapper = shallowMount( QueryCondition, {
store,
localVue,
propsData: {
'condition-index': conditionIndex,
},
computed: {
canDelete: () => true,
},
} );

wrapper.find( '.query-condition__remove' ).trigger( 'click' );

await Vue.nextTick();

expect( store.dispatch ).toHaveBeenCalledWith( 'removeCondition', conditionIndex );
} );

it( 'shows field errors', () => {
const wrapper = shallowMount( QueryCondition, {
store: newStore( {
Expand Down

0 comments on commit 5b9759c

Please sign in to comment.