mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
var expect = require('chai').expect;
|
|
|
|
function Widget(config) {
|
|
this.logOutput = [];
|
|
|
|
this.name = 'app-dom-events';
|
|
|
|
var _this = this;
|
|
function log(data) {
|
|
_this.logOutput.push(data);
|
|
}
|
|
|
|
this.log = log;
|
|
this.clearLog = function() {
|
|
this.logOutput = [];
|
|
};
|
|
|
|
this.logOutput = [];
|
|
}
|
|
|
|
Widget.prototype = {
|
|
handleRootClick: function(event, el) {
|
|
expect(el.getAttribute('class')).to.equal('app-dom-events');
|
|
expect(event.target.tagName.length>0).to.equal(true);
|
|
this.log('el:click');
|
|
expect(this.name).to.equal('app-dom-events');
|
|
},
|
|
|
|
handleButtonClick: function() {
|
|
this.log('button:click');
|
|
},
|
|
|
|
handleRootMouseMove: function() {
|
|
this.log('el:mousemove');
|
|
},
|
|
|
|
handleButtonSpanMouseMove: function() {
|
|
this.log('button>span:mousemove');
|
|
},
|
|
|
|
handleFooLinkDblClick: function() {
|
|
this.log('#fooLink:dblclick');
|
|
},
|
|
|
|
handleFooLinkMouseOut: function(event, el) {
|
|
expect(event.target).to.equal(el);
|
|
this.log('#fooLink:mouseout');
|
|
},
|
|
|
|
handleHelloWorldMouseDown: function(event, el) {
|
|
expect(this.getEl('helloWorld')).to.equal(el);
|
|
this.log('#helloWorld:mousedown');
|
|
}
|
|
};
|
|
|
|
exports.Widget = Widget; |