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

Skip to content

Commit 82eed21

Browse files
committed
test: update v-model when bind value change
1 parent 6782d10 commit 82eed21

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/specs/directives/public/model_spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,5 +715,33 @@ if (_.inBrowser) {
715715
}, 200)
716716
})
717717

718+
it('update on bind value change', function (done) {
719+
var vm = new Vue({
720+
el: el,
721+
template:
722+
'<input type="radio" v-model="a" checked :value="b">' +
723+
'<input type="radio" v-model="a" :value="c">',
724+
data: {
725+
a: 0,
726+
b: 1,
727+
c: 2
728+
}
729+
})
730+
// should sync inline-checked value to a
731+
expect(vm.a).toBe(1)
732+
vm.b = 3
733+
_.nextTick(function () {
734+
expect(vm.a).toBe(3)
735+
expect(el.firstChild.checked).toBe(true)
736+
expect(el.lastChild.checked).toBe(false)
737+
vm.a = 2
738+
_.nextTick(function () {
739+
expect(el.firstChild.checked).toBe(false)
740+
expect(el.lastChild.checked).toBe(true)
741+
done()
742+
})
743+
})
744+
})
745+
718746
})
719747
}

0 commit comments

Comments
 (0)
0