Reduce render count for multiple render mocha test

This commit is contained in:
Niklas von Hertzen 2015-01-05 20:54:07 +02:00
parent b6a73b635a
commit 433dc98177

View File

@ -29,14 +29,15 @@
it("render correctly", function(done) { it("render correctly", function(done) {
this.timeout(5000); this.timeout(5000);
var d = 0; var d = 0;
for (var i = 0; i < 10; i++) { var count = 3;
for (var i = 0; i < count; i++) {
html2canvas(document.querySelector('#green-block')).then(function (canvas) { html2canvas(document.querySelector('#green-block')).then(function (canvas) {
expect(canvas.width).to.equal(200); expect(canvas.width).to.equal(200);
expect(canvas.height).to.equal(200); expect(canvas.height).to.equal(200);
validCanvasPixels(canvas); validCanvasPixels(canvas);
canvas.width = canvas.height = 10; canvas.width = canvas.height = 10;
d++; d++;
if (d === 10) { if (d === count) {
done(); done();
} }
}); });
@ -46,7 +47,8 @@
it("render correctly when non sequential", function(done) { it("render correctly when non sequential", function(done) {
this.timeout(5000); this.timeout(5000);
var d = 0; var d = 0;
for (var i = 0; i < 10; i++) { var count = 3;
for (var i = 0; i < count; i++) {
html2canvas(document.querySelector('#block'), {onclone: function(document) { html2canvas(document.querySelector('#block'), {onclone: function(document) {
return new Promise(function(resolve) { return new Promise(function(resolve) {
document.querySelector('#block').style.backgroundColor = 'green'; document.querySelector('#block').style.backgroundColor = 'green';
@ -60,7 +62,7 @@
validCanvasPixels(canvas); validCanvasPixels(canvas);
canvas.width = canvas.height = 10; canvas.width = canvas.height = 10;
d++; d++;
if (d === 10) { if (d === count) {
done(); done();
} }
}); });