diff --git a/test/unit/Select.spec.js b/test/unit/Select.spec.js index 1733e16..430433f 100644 --- a/test/unit/Select.spec.js +++ b/test/unit/Select.spec.js @@ -43,6 +43,7 @@ describe('Select.vue', () => { }).$mount() expect( vm.$children[0].$get('value').value ).toEqual( 'foo' ) + expect( vm.$children[0].$get('value').label ).toEqual( 'This is Foo' ) }) it('can accept an array of objects and pre-selected values (multiple)', () => { @@ -56,9 +57,13 @@ describe('Select.vue', () => { }).$mount() var values = vm.$children[0].$get('value') + var labels = [] + + labels = values.map( value => value.label ) values = values.map( value => value.value ) expect( values ).toEqual( ['foo', 'bar'] ) + expect( labels ).toEqual( ['This is Foo', 'This is Bar'] ) }) it('can determine if the value prop is empty', () => { @@ -84,9 +89,9 @@ describe('Select.vue', () => { expect(select.isValueEmpty).toEqual(true) }) - it('resets the selected values when the options property changes', () => { + it('resets the selected values when the options property changes', (done) => { const vm = new Vue({ - template: '
', + template: '
', components: { vSelect }, data: { value: ['one'], @@ -95,7 +100,11 @@ describe('Select.vue', () => { }).$mount() vm.$children[0].options = ['four','five','six'] - expect(vm.$children[0].$get('value')).toEqual([]) + + Vue.nextTick(() => { + expect(vm.$children[0].$get('value')).toEqual([]) + done() + }) }) it('can retain values present in a new array of options', () => {