Skip to content

Commit dcbeaef

Browse files
committed
only test composition events if not on Android
1 parent 949ada9 commit dcbeaef

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

test/unit/specs/directives/model_spec.js

+33-31
Original file line numberDiff line numberDiff line change
@@ -510,38 +510,40 @@ if (_.inBrowser) {
510510
})
511511
})
512512

513-
it('text + compositionevents', function (done) {
514-
var vm = new Vue({
515-
el: el,
516-
data: {
517-
test: 'aaa',
518-
test2: 'bbb'
519-
},
520-
template: '<input v-model="test"><input v-model="test2 | uppercase">'
513+
if (!_.isAndroid) {
514+
it('text + compositionevents', function (done) {
515+
var vm = new Vue({
516+
el: el,
517+
data: {
518+
test: 'aaa',
519+
test2: 'bbb'
520+
},
521+
template: '<input v-model="test"><input v-model="test2 | uppercase">'
522+
})
523+
var input = el.firstChild
524+
var input2 = el.childNodes[1]
525+
trigger(input, 'compositionstart')
526+
trigger(input2, 'compositionstart')
527+
input.value = input2.value = 'ccc'
528+
// input before composition unlock should not call set
529+
trigger(input, 'input')
530+
trigger(input2, 'input')
531+
expect(vm.test).toBe('aaa')
532+
expect(vm.test2).toBe('bbb')
533+
// after composition unlock it should work
534+
trigger(input, 'compositionend')
535+
trigger(input2, 'compositionend')
536+
trigger(input, 'input')
537+
trigger(input2, 'input')
538+
expect(vm.test).toBe('ccc')
539+
expect(vm.test2).toBe('ccc')
540+
// IE complains about "unspecified error" when calling
541+
// setSelectionRange() on an input element that's been
542+
// removed from the DOM, so we wait until the
543+
// selection range callback has fired to end this test.
544+
_.nextTick(done)
521545
})
522-
var input = el.firstChild
523-
var input2 = el.childNodes[1]
524-
trigger(input, 'compositionstart')
525-
trigger(input2, 'compositionstart')
526-
input.value = input2.value = 'ccc'
527-
// input before composition unlock should not call set
528-
trigger(input, 'input')
529-
trigger(input2, 'input')
530-
expect(vm.test).toBe('aaa')
531-
expect(vm.test2).toBe('bbb')
532-
// after composition unlock it should work
533-
trigger(input, 'compositionend')
534-
trigger(input2, 'compositionend')
535-
trigger(input, 'input')
536-
trigger(input2, 'input')
537-
expect(vm.test).toBe('ccc')
538-
expect(vm.test2).toBe('ccc')
539-
// IE complains about "unspecified error" when calling
540-
// setSelectionRange() on an input element that's been
541-
// removed from the DOM, so we wait until the
542-
// selection range callback has fired to end this test.
543-
_.nextTick(done)
544-
})
546+
}
545547

546548
it('textarea', function () {
547549
var vm = new Vue({

0 commit comments

Comments
 (0)