2013-09-08 14:42:11 +08:00
|
|
|
mocha.ui('tdd');
|
|
|
|
var assert = chai.assert,
|
|
|
|
kineticContainer = document.getElementById('kinetic-container');
|
|
|
|
|
|
|
|
Kinetic.enableTrace = true;
|
2013-09-14 14:26:58 +08:00
|
|
|
// make sure pixel ratio is 1 or else the tests will fail on devices with retina display
|
|
|
|
Kinetic.pixelRatio = 1;
|
2013-09-08 14:42:11 +08:00
|
|
|
|
2013-09-09 12:36:54 +08:00
|
|
|
function addStage() {
|
2013-09-08 14:42:11 +08:00
|
|
|
var container = document.createElement('div'),
|
|
|
|
stage = new Kinetic.Stage({
|
|
|
|
container: container,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
|
|
|
|
kineticContainer.appendChild(container);
|
|
|
|
|
|
|
|
return stage;
|
|
|
|
}
|
|
|
|
|
2013-09-09 12:36:54 +08:00
|
|
|
function addContainer() {
|
|
|
|
var container = document.createElement('div');
|
|
|
|
|
|
|
|
kineticContainer.appendChild(container);
|
|
|
|
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
|
2013-09-08 14:42:11 +08:00
|
|
|
function showHit(layer) {
|
|
|
|
var canvas = layer.hitCanvas._canvas;
|
|
|
|
canvas.style.position = 'relative';
|
|
|
|
|
|
|
|
kineticContainer.appendChild(canvas);
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeEach(function(){
|
|
|
|
var title = document.createElement('h2'),
|
|
|
|
test = this.currentTest;
|
|
|
|
|
|
|
|
title.innerHTML = test.parent.title + ' - ' + test.title;
|
|
|
|
title.className = 'kinetic-title';
|
|
|
|
kineticContainer.appendChild(title);
|
|
|
|
});
|