all unit tests pass in IE9

This commit is contained in:
Evan You 2013-10-13 14:02:19 -04:00
parent b2c4882fda
commit 160ddb599a
4 changed files with 16 additions and 8 deletions

View File

@ -19,7 +19,7 @@
"mock": true,
"Seed": true,
"$": true,
"mockChangeEvent": true,
"mockHTMLEvent": true,
"mockMouseEvent": true,
"mockKeyEvent": true
}

View File

@ -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
}

View File

@ -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')
})

View File

@ -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 () {