File tree 2 files changed +5
-16
lines changed
test/unit/specs/directives 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ module.exports = {
5
5
bind : function ( ) {
6
6
var self = this
7
7
var el = this . el
8
- var trueExp = this . _checkParam ( 'true-value ' )
9
- var falseExp = this . _checkParam ( 'false-value ' )
8
+ var trueExp = this . _checkParam ( 'true-exp ' )
9
+ var falseExp = this . _checkParam ( 'false-exp ' )
10
10
11
11
function getValue ( ) {
12
12
var val = el . checked
@@ -22,21 +22,10 @@ module.exports = {
22
22
23
23
function matchValue ( value ) {
24
24
var trueValue = true
25
- var falseValue = false
26
-
27
25
if ( trueExp !== null ) {
28
26
trueValue = self . vm . $eval ( trueExp )
29
27
}
30
- if ( falseExp !== null ) {
31
- falseValue = self . vm . $eval ( falseExp )
32
- }
33
- if ( trueValue === value ) {
34
- return true
35
- } else if ( falseValue === value ) {
36
- return false
37
- } else {
38
- return null
39
- }
28
+ return trueValue === value
40
29
}
41
30
this . _matchValue = matchValue
42
31
Original file line number Diff line number Diff line change @@ -141,15 +141,15 @@ if (_.inBrowser) {
141
141
expect ( vm . test ) . toBe ( true )
142
142
} )
143
143
144
- it ( 'checkbox true-value false-value ' , function ( done ) {
144
+ it ( 'checkbox expression ' , function ( done ) {
145
145
var vm = new Vue ( {
146
146
el : el ,
147
147
data : {
148
148
test : '' ,
149
149
expression1 : 'aTrueValue' ,
150
150
expression2 : 'aFalseValue'
151
151
} ,
152
- template : '<input type="checkbox" v-model="test" true-value ="expression1" false-value ="expression2">'
152
+ template : '<input type="checkbox" v-model="test" true-exp ="expression1" false-exp ="expression2">'
153
153
} )
154
154
expect ( vm . test ) . toBe ( '' )
155
155
el . firstChild . click ( )
You can’t perform that action at this time.
0 commit comments