mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-16 09:10:33 +03:00
fix preselected tests
This commit is contained in:
Vendored
+22204
-4
File diff suppressed because one or more lines are too long
+28
-17
@@ -32,23 +32,34 @@ describe('Select.vue', () => {
|
|||||||
expect(vm.$children[0].value).toEqual(['one'])
|
expect(vm.$children[0].value).toEqual(['one'])
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
it('can accept an array of objects and pre-selected value (single)', () => {
|
||||||
* TODO: Right now this only works for arrays of strings.. But the same method
|
const vm = new Vue({
|
||||||
* should apply to arrays of objects.
|
template: '<div><v-select :value.sync="value"></v-select></div>',
|
||||||
*/
|
components: { vSelect },
|
||||||
// it('can accept an array of objects and pre-selected values', () => {
|
data: {
|
||||||
// const vm = new Vue({
|
value: {label: 'This is Foo', value: 'foo'},
|
||||||
// template: '<div><v-select :value.sync="value"></v-select></div>',
|
options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
|
||||||
// components: { vSelect },
|
}
|
||||||
// data: {
|
}).$mount()
|
||||||
// value: [{label: 'This is Foo', value: 'foo'}],
|
|
||||||
// options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
|
expect( vm.$children[0].$get('value').value ).toEqual( 'foo' )
|
||||||
// }
|
})
|
||||||
// }).$mount()
|
|
||||||
//
|
it('can accept an array of objects and pre-selected values (multiple)', () => {
|
||||||
// expect(vm.$children[0].$get('value')).toEqual({label: 'This is Foo', value: 'foo'})
|
const vm = new Vue({
|
||||||
// })
|
template: '<div><v-select :value.sync="value" :multiple="true"></v-select></div>',
|
||||||
//
|
components: { vSelect },
|
||||||
|
data: {
|
||||||
|
value: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}],
|
||||||
|
options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
|
||||||
|
}
|
||||||
|
}).$mount()
|
||||||
|
|
||||||
|
var values = vm.$children[0].$get('value')
|
||||||
|
values = values.map( value => value.value )
|
||||||
|
|
||||||
|
expect( values ).toEqual( ['foo', 'bar'] )
|
||||||
|
})
|
||||||
|
|
||||||
it('can determine if the value prop is empty', () => {
|
it('can determine if the value prop is empty', () => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
|
|||||||
Reference in New Issue
Block a user