File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1
1
var _ = require ( '../../util' )
2
2
var Watcher = require ( '../../watcher' )
3
+ var dirParser = require ( '../../parsers/directive' )
3
4
4
5
module . exports = {
5
6
@@ -61,6 +62,7 @@ module.exports = {
61
62
62
63
function initOptions ( expression ) {
63
64
var self = this
65
+ var descriptor = dirParser . parse ( expression ) [ 0 ]
64
66
function optionUpdateWatcher ( value ) {
65
67
if ( _ . isArray ( value ) ) {
66
68
self . el . innerHTML = ''
@@ -74,9 +76,12 @@ function initOptions (expression) {
74
76
}
75
77
this . optionWatcher = new Watcher (
76
78
this . vm ,
77
- expression ,
79
+ descriptor . expression ,
78
80
optionUpdateWatcher ,
79
- { deep : true }
81
+ {
82
+ deep : true ,
83
+ filters : _ . resolveFilters ( this . vm , descriptor . filters )
84
+ }
80
85
)
81
86
// update with initial value
82
87
optionUpdateWatcher ( this . optionWatcher . value )
Original file line number Diff line number Diff line change @@ -313,6 +313,27 @@ if (_.inBrowser) {
313
313
expect ( vm . test ) . toBe ( 1 )
314
314
} )
315
315
316
+ it ( 'select + options + filter' , function ( ) {
317
+ var vm = new Vue ( {
318
+ el : el ,
319
+ data : {
320
+ opts : [ 'a' , 'b' ]
321
+ } ,
322
+ filters : {
323
+ aFilter : function ( opts ) {
324
+ return opts . map ( function ( val , i ) {
325
+ return val + i
326
+ } )
327
+ }
328
+ } ,
329
+ template : '<select v-model="test" options="opts | aFilter"></select>'
330
+ } )
331
+ expect ( el . firstChild . innerHTML ) . toBe (
332
+ '<option value="a0">a0</option>' +
333
+ '<option value="b1">b1</option>'
334
+ )
335
+ } )
336
+
316
337
it ( 'text' , function ( done ) {
317
338
var vm = new Vue ( {
318
339
el : el ,
You can’t perform that action at this time.
0 commit comments