mirror of https://github.com/vuejs/vue.git
all unit tests pass in IE9
This commit is contained in:
parent
b2c4882fda
commit
160ddb599a
|
|
@ -19,7 +19,7 @@
|
|||
"mock": true,
|
||||
"Seed": true,
|
||||
"$": true,
|
||||
"mockChangeEvent": true,
|
||||
"mockHTMLEvent": true,
|
||||
"mockMouseEvent": true,
|
||||
"mockKeyEvent": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
return el
|
||||
}
|
||||
|
||||
function mockChangeEvent () {
|
||||
function mockHTMLEvent (type) {
|
||||
var e = document.createEvent('HTMLEvents')
|
||||
e.initEvent('change', true, true)
|
||||
e.initEvent(type, true, true)
|
||||
return e
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ describe('UNIT: API', function () {
|
|||
input.value = 'hohoho'
|
||||
input.dispatchEvent(mockKeyEvent('keyup'))
|
||||
assert.strictEqual(t.test, 'hi')
|
||||
input.dispatchEvent(mockChangeEvent())
|
||||
input.dispatchEvent(mockHTMLEvent('change'))
|
||||
assert.strictEqual(t.test, 'hohoho')
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ describe('UNIT: Directives', function () {
|
|||
assert.equal(val, 1)
|
||||
}}
|
||||
dir.el.options.selectedIndex = 1
|
||||
dir.el.dispatchEvent(mockChangeEvent())
|
||||
dir.el.dispatchEvent(mockHTMLEvent('change'))
|
||||
assert.ok(triggered)
|
||||
})
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ describe('UNIT: Directives', function () {
|
|||
removed = false
|
||||
}}
|
||||
dir.unbind()
|
||||
dir.el.dispatchEvent(mockChangeEvent())
|
||||
dir.el.dispatchEvent(mockHTMLEvent('change'))
|
||||
assert.ok(removed)
|
||||
})
|
||||
|
||||
|
|
@ -445,6 +445,10 @@ describe('UNIT: Directives', function () {
|
|||
var dir = mockDirective('on')
|
||||
dir.arg = 'click'
|
||||
|
||||
before(function () {
|
||||
document.body.appendChild(dir.el)
|
||||
})
|
||||
|
||||
it('should set the handler to be triggered by arg through update()', function () {
|
||||
var triggered = false
|
||||
dir.update(function () {
|
||||
|
|
@ -505,18 +509,22 @@ describe('UNIT: Directives', function () {
|
|||
|
||||
dir.arg = 'focus'
|
||||
dir.update(handler)
|
||||
dir.el.focus()
|
||||
dir.el.dispatchEvent(mockHTMLEvent('focus'))
|
||||
assert.strictEqual(triggerCount, 1)
|
||||
|
||||
dir.arg = 'blur'
|
||||
dir.update(handler)
|
||||
dir.el.blur()
|
||||
dir.el.dispatchEvent(mockHTMLEvent('blur'))
|
||||
assert.strictEqual(triggerCount, 2)
|
||||
|
||||
document.body.removeChild(dir.el)
|
||||
|
||||
})
|
||||
|
||||
after(function () {
|
||||
document.body.removeChild(dir.el)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('pre', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue