mirror of
https://github.com/konvajs/konva.git
synced 2026-01-22 03:11:53 +08:00
added assertion counter to Mocha
This commit is contained in:
@@ -1,6 +1,47 @@
|
||||
mocha.ui('tdd');
|
||||
var assert = chai.assert,
|
||||
kineticContainer = document.getElementById('kinetic-container');
|
||||
kineticContainer = document.getElementById('kinetic-container'),
|
||||
origAssertEqual = assert.equal,
|
||||
origAssert = assert,
|
||||
origNotEqual = assert.notEqual,
|
||||
assertionCount = 0,
|
||||
assertions = document.createElement('em');
|
||||
|
||||
function init() {
|
||||
// assert extenders so that we can count assertions
|
||||
assert = function() {
|
||||
origAssert.apply(this, arguments);
|
||||
assertions.innerHTML = ++assertionCount;
|
||||
};
|
||||
assert.equal = function() {
|
||||
origAssertEqual.apply(this, arguments);
|
||||
assertions.innerHTML = ++assertionCount;
|
||||
};
|
||||
assert.notEqual = function() {
|
||||
origNotEqual.apply(this, arguments);
|
||||
assertions.innerHTML = ++assertionCount;
|
||||
};
|
||||
|
||||
window.onload = function() {
|
||||
var mochaStats = document.getElementById('mocha-stats');
|
||||
|
||||
if (mochaStats) {
|
||||
var li = document.createElement('li');
|
||||
var anchor = document.createElement('a');
|
||||
|
||||
anchor.href = '#';
|
||||
anchor.innerHTML = 'assertions:';
|
||||
assertions.innerHTML = 0;
|
||||
|
||||
li.appendChild(anchor);
|
||||
li.appendChild(assertions);
|
||||
mochaStats.appendChild(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Kinetic.enableTrace = true;
|
||||
// make sure pixel ratio is 1 or else the tests will fail on devices with retina display
|
||||
@@ -46,4 +87,6 @@ beforeEach(function(){
|
||||
Kinetic.inDblClickWindow = false;
|
||||
Kinetic.DD.isDragging = false;
|
||||
Kinetic.DD.node = undefined;
|
||||
});
|
||||
});
|
||||
|
||||
init();
|
||||
Reference in New Issue
Block a user