8000 test: update v-model when bind value change · bencode/vue@f6f9f16 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6f9f16

Browse files
committed
test: update v-model when bind value change
1 parent 997ab5d commit f6f9f16

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/specs/directives/model_spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,5 +1018,33 @@ if (_.inBrowser) {
10181018
}, 200)
10191019
})
10201020

1021+
it('update on bind value change', function (done) {
1022+
var vm = new Vue({
1023+
el: el,
1024+
template:
1025+
'<input type="radio" v-model="a" checked :value="b">' +
1026+
'<input type="radio" v-model="a" :value="c">',
1027+
data: {
1028+
a: 0,
1029+
b: 1,
1030+
c: 2
1031+
}
1032+
})
1033+
// should sync inline-checked value to a
1034+
expect(vm.a).toBe(1)
1035+
vm.b = 3
1036+
_.nextTick(function () {
1037+
expect(vm.a).toBe(3)
1038+
expect(el.firstChild.checked).toBe(true)
1039+
expect(el.lastChild.checked).toBe(false)
1040+
vm.a = 2
1041+
_.nextTick(function () {
1042+
expect(el.firstChild.checked).toBe(false)
1043+
expect(el.lastChild.checked).toBe(true)
1044+
done()
1045+
})
1046+
})
1047+
})
1048+
10211049
})
10221050
}

0 commit comments

Comments
 (0)
0