Skip to content

Commit

Permalink
added regression test for #288
Browse files Browse the repository at this point in the history
  • Loading branch information
bsuh committed Sep 30, 2014
1 parent 0bc94a7 commit 8a8f82b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/e2e/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,39 @@ asyncTest('issue214 regression', function() {
start()
})
})

asyncTest('issue288 regression', function() {
// see https://github.com/lhorie/mithril.js/issues/288
// this test will pass using phantomjs, because phantomjs
// doesn't provide window.requestAnimationFrame
expect(2)

function controller() {
this.inputValue = m.prop('')

this.submit = function() {
if (this.inputValue()) {
this.inputValue('')
}
}.bind(this);
}

function view(ctrl) {
return m('form', { onsubmit: ctrl.submit }, [
m('input#testinput', {
onkeyup: m.withAttr('value', ctrl.inputValue),
value: ctrl.inputValue()
}),
m('button[type=submit]')
])
}

var ctrl = m.module(dummyEl, { controller: controller, view: view })

Syn.click({}, 'testinput')
.type('abcd[enter]', function() {
equal(ctrl.inputValue(), '')
equal(document.getElementById('testinput').value, '')
start()
})
})

0 comments on commit 8a8f82b

Please sign in to comment.