@@ -249,6 +249,45 @@ describe('Select.vue', () => {
249
249
expect ( vm . $children [ 0 ] . isOptionSelected ( 'foo' ) ) . toEqual ( true )
250
250
} ) ,
251
251
252
+ fit ( 'can select an object from a set of options containing objects' , ( done ) => {
253
+ const vm = new Vue ( {
254
+ template : `<div><v-select :options="[{label: 'foo', value: 'bar'}]"></v-select></div>` ,
255
+ } ) . $mount ( )
256
+ vm . $children [ 0 ] . select ( { label : 'foo' , value : 'bar' } )
257
+ Vue . nextTick ( ( ) => {
258
+ expect ( vm . $children [ 0 ] . mutableValue ) . toEqual ( { label : 'foo' , value : 'bar' } )
259
+ done ( )
260
+ } )
261
+ } ) ,
262
+
263
+ fit ( 'can select a given key from a set of options containing objects' , ( done ) => {
264
+ const vm = new Vue ( {
265
+ template : `<div><v-select model="value" :options="[{label: 'foo', value: 'bar'}]"></v-select></div>` ,
266
+ } ) . $mount ( )
267
+ // spyOn(vm.$children[0], '$emit')
268
+ vm . $children [ 0 ] . select ( { label : 'foo' , value : 'bar' } )
269
+ Vue . nextTick ( ( ) => {
270
+ // expect(vm.$children[0].$emit).toHaveBeenCalled('bar')
271
+ // expect(vm.$children[0].value).toEqual('bar')
272
+ expect ( vm . $children [ 0 ] . mutableValue ) . toEqual ( 'bar' )
273
+ done ( )
274
+ } )
275
+ } ) ,
276
+
277
+ fit ( 'can deselect a given key from a set of options containing objects' , ( done ) => {
278
+ const vm = new Vue ( {
279
+ template : `<div><v-select :value="'bar'" model="value" :options="[{label: 'foo', value: 'bar'}]"></v-select></div>` ,
280
+ } ) . $mount ( )
281
+ // spyOn(vm.$children[0], '$emit')
282
+ vm . $children [ 0 ] . select ( { label : 'foo' , value : 'bar' } )
283
+ Vue . nextTick ( ( ) => {
284
+ // expect(vm.$children[0].$emit).toHaveBeenCalled('bar')
285
+ // expect(vm.$children[0].value).toEqual('bar')
286
+ expect ( vm . $children [ 0 ] . mutableValue ) . toEqual ( null )
287
+ done ( )
288
+ } )
289
+ } ) ,
290
+
252
291
describe ( 'change Event' , ( ) => {
253
292
it ( 'will trigger the input event when the selection changes' , ( done ) => {
254
293
const vm = new Vue ( {
0 commit comments