',
@@ -137,80 +170,18 @@ describe('Select.vue', () => {
vm.$children[0].$set('options', ['one', 'five', 'six'])
expect(vm.$children[0].value).toEqual(['one'])
})
- })
- describe('Removing values', () => {
- it('removes the given tag when its close icon is clicked', (done) => {
+ it('can determine if an object is already selected', () => {
const vm = new Vue({
- template: '
',
+ template: '
',
components: {vSelect},
data: {
- value: ['one'],
- options: ['one', 'two', 'three']
+ value: [{label: 'one'}],
+ options: [{label: 'one'}]
}
}).$mount()
- vm.$children[0].$els.toggle.querySelector('.close').click()
- Vue.nextTick(() => {
- expect(vm.$children[0].$get('value')).toEqual([])
- done()
- })
- })
- it('removes the last item in the value array on delete keypress when multiple is true', () => {
-
- const vm = new Vue({
- template: '
',
- components: {vSelect},
- data: {
- value: ['one', 'two'],
- options: ['one', 'two', 'three']
- }
- }).$mount()
- vm.$children[0].maybeDeleteValue()
- Vue.nextTick(() => {
- expect(vm.$children[0].$get('value')).toEqual(['one'])
- })
- })
-
- it('sets the value to null on delete keypress when multiple is false', () => {
- const vm = new Vue({
- template: '