mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Adding test case for issue #556
This commit is contained in:
parent
d5c62c4027
commit
35517181e1
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user