Permalink
Browse files

Adding test case for issue #556

  • Loading branch information...
philidem committed Feb 1, 2017
1 parent d5c62c4 commit 35517181e1e9602222b12bdfd7fb62767595c8d8
View
@@ -0,0 +1,14 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,json,marko,yml}]
charset = utf-8
indent_style = space
indent_size = 4
@@ -0,0 +1,21 @@
class {
onInput(input) {
this.state = {
error: null
};
}
submit() {
var self = this;
setTimeout(function() {
self.state.error = 'FATAL ERROR';
}, 50);
}
}
<form on-submit('submit')>
<p if(state.error)>
FATAL ERROR
</p>
</form>
@@ -0,0 +1,15 @@
// see https://github.com/marko-js/marko/issues/556
var expect = require('chai').expect;
module.exports = function(helpers, done) {
var widget = helpers.mount(require('./index'), {});
expect(widget.el.innerHTML).to.not.contain('FATAL ERROR');
helpers.triggerEvent(widget.getEl(), 'submit');
setTimeout(function() {
expect(widget.el.innerHTML).to.contain('FATAL ERROR');
done();
}, 100);
};
@@ -8,6 +8,12 @@ function BrowserHelpers() {
}
BrowserHelpers.prototype = {
triggerEvent: function(el, type) {
var ev = document.createEvent("Event");
ev.initEvent(type, true, true);
el.dispatchEvent(ev);
},
triggerMouseEvent: function(el, type) {
var ev = document.createEvent("MouseEvent");
ev.initMouseEvent(
@@ -87,4 +93,4 @@ BrowserHelpers.prototype = {
}
};
module.exports = BrowserHelpers;
module.exports = BrowserHelpers;

0 comments on commit 3551718

Please sign in to comment.