This commit is contained in:
Anton Lavrenov
2020-05-08 09:59:35 -05:00
parent a2adcf5f17
commit d5481b1b72
78 changed files with 3714 additions and 3711 deletions

View File

@@ -1,6 +1,6 @@
suite('Stage', function() {
suite('Stage', function () {
// ======================================================
test('instantiate stage with id', function() {
test('instantiate stage with id', function () {
var container = Konva.document.createElement('div');
container.id = 'container';
@@ -9,7 +9,7 @@ suite('Stage', function() {
var stage = new Konva.Stage({
container: 'container',
width: 578,
height: 200
height: 200,
});
assert.equal(stage.getContent().className, 'konvajs-content');
@@ -17,7 +17,7 @@ suite('Stage', function() {
});
// ======================================================
test('test stage buffer canvas and hit buffer canvas', function() {
test('test stage buffer canvas and hit buffer canvas', function () {
var container = Konva.document.createElement('div');
container.id = 'container';
@@ -29,7 +29,7 @@ suite('Stage', function() {
var stage = new Konva.Stage({
container: 'container',
width: 578,
height: 200
height: 200,
});
assert.equal(stage.bufferCanvas.getPixelRatio(), 2);
@@ -40,7 +40,7 @@ suite('Stage', function() {
});
// ======================================================
test('instantiate stage with dom element', function() {
test('instantiate stage with dom element', function () {
var container = Konva.document.createElement('div');
konvaContainer.appendChild(container);
@@ -48,12 +48,12 @@ suite('Stage', function() {
var stage = new Konva.Stage({
container: container,
width: 578,
height: 200
height: 200,
});
});
// ======================================================
test('stage instantiation should clear container', function() {
test('stage instantiation should clear container', function () {
var container = Konva.document.createElement('div');
var dummy = Konva.document.createElement('p');
@@ -63,7 +63,7 @@ suite('Stage', function() {
var stage = new Konva.Stage({
container: container,
width: 578,
height: 200
height: 200,
});
assert.equal(
@@ -74,7 +74,7 @@ suite('Stage', function() {
});
// ======================================================
test('test stage cloning', function() {
test('test stage cloning', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -94,7 +94,7 @@ suite('Stage', function() {
});
// ======================================================
test('set stage size', function() {
test('set stage size', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -106,7 +106,7 @@ suite('Stage', function() {
fill: 'green',
stroke: 'black',
strokeWidth: 4,
name: 'myCircle'
name: 'myCircle',
});
assert.equal(stage.getSize().width, 578);
@@ -119,7 +119,7 @@ suite('Stage', function() {
assert.equal(stage.getSize().height, 3);
stage.setSize({
width: 4,
height: 5
height: 5,
});
assert.equal(stage.getSize().width, 4);
assert.equal(stage.getSize().height, 5);
@@ -156,13 +156,13 @@ suite('Stage', function() {
});
// ======================================================
test('get stage DOM', function() {
test('get stage DOM', function () {
var stage = addStage();
assert.equal(stage.getContent().className, 'konvajs-content');
});
test('try to move stage ', function() {
test('try to move stage ', function () {
var stage = addStage();
var container = document.createElement('div');
var wrap = stage.container().parentNode;
@@ -175,7 +175,7 @@ suite('Stage', function() {
assert.equal(stage.content, container.children[0]);
});
test('clone stage ', function() {
test('clone stage ', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -186,7 +186,7 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'red',
stroke: 'black'
stroke: 'black',
});
layer.add(shape);
layer.draw();
@@ -203,7 +203,7 @@ suite('Stage', function() {
assert.equal(clone.content, container.children[0]);
});
test('dangling stage ', function() {
test('dangling stage ', function () {
var stage = addStage();
var container = stage.container();
var parent = stage.content.parentElement;
@@ -216,7 +216,7 @@ suite('Stage', function() {
});
// ======================================================
test('stage getIntersection()', function() {
test('stage getIntersection()', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -226,7 +226,7 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'red',
stroke: 'black'
stroke: 'black',
});
var greenCircle = new Konva.Circle({
@@ -235,7 +235,7 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'green',
stroke: 'black'
stroke: 'black',
});
layer.add(redCircle);
@@ -260,14 +260,14 @@ suite('Stage', function() {
});
// ======================================================
test('layer getIntersection() with selector', function() {
test('layer getIntersection() with selector', function () {
var stage = addStage();
var layer = new Konva.Layer({
name: 'layer'
name: 'layer',
});
var group = new Konva.Group({
name: 'group'
name: 'group',
});
var circle = new Konva.Circle({
@@ -276,7 +276,7 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'red',
stroke: 'black'
stroke: 'black',
});
group.add(circle);
@@ -310,7 +310,7 @@ suite('Stage', function() {
});
// ======================================================
test('stage getIntersection() edge detection', function() {
test('stage getIntersection() edge detection', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -320,7 +320,7 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'red',
stroke: 'black'
stroke: 'black',
});
var greenCircle = new Konva.Circle({
@@ -329,10 +329,10 @@ suite('Stage', function() {
radius: 70,
strokeWidth: 4,
fill: 'green',
stroke: 'black'
stroke: 'black',
});
stage.on('contentMousemove', function() {
stage.on('contentMousemove', function () {
var pos = stage.getPointerPosition();
var shape = stage.getIntersection(pos);
if (!shape) {
@@ -362,7 +362,7 @@ suite('Stage', function() {
});
// ======================================================
test('test getAllIntersections', function() {
test('test getAllIntersections', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -373,7 +373,7 @@ suite('Stage', function() {
strokeWidth: 4,
fill: 'red',
stroke: 'black',
id: 'redCircle'
id: 'redCircle',
});
var greenCircle = new Konva.Circle({
@@ -383,7 +383,7 @@ suite('Stage', function() {
strokeWidth: 4,
fill: 'green',
stroke: 'black',
id: 'greenCircle'
id: 'greenCircle',
});
layer.add(redCircle);
@@ -518,7 +518,7 @@ suite('Stage', function() {
});
// ======================================================
test('test getAllIntersections for text', function() {
test('test getAllIntersections for text', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -527,7 +527,7 @@ suite('Stage', function() {
y: 0,
text: 'Hello world',
fontSize: 50,
name: 'intersectText'
name: 'intersectText',
});
layer.add(text);
@@ -542,10 +542,10 @@ suite('Stage', function() {
});
// ======================================================
test('Should not throw on clip for stage', function() {
test('Should not throw on clip for stage', function () {
// no asserts, because we check throw
var stage = addStage({
clipFunc: function(){}
clipFunc: function () {},
});
var layer = new Konva.Layer();
@@ -554,7 +554,7 @@ suite('Stage', function() {
y: 0,
text: 'Hello world',
fontSize: 50,
name: 'intersectText'
name: 'intersectText',
});
layer.add(text);
@@ -562,7 +562,7 @@ suite('Stage', function() {
});
// ======================================================
test('scale stage after add layer', function() {
test('scale stage after add layer', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
@@ -571,7 +571,7 @@ suite('Stage', function() {
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4
strokeWidth: 4,
});
layer.add(circle);
@@ -585,7 +585,7 @@ suite('Stage', function() {
});
// ======================================================
test('scale stage before add shape', function() {
test('scale stage before add shape', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
@@ -594,7 +594,7 @@ suite('Stage', function() {
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4
strokeWidth: 4,
});
stage.setScale({ x: 0.5, y: 0.5 });
@@ -607,7 +607,7 @@ suite('Stage', function() {
});
// ======================================================
test('remove stage', function() {
test('remove stage', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
@@ -616,7 +616,7 @@ suite('Stage', function() {
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4
strokeWidth: 4,
});
layer.add(circle);
@@ -627,7 +627,7 @@ suite('Stage', function() {
});
// ======================================================
test('destroy stage', function() {
test('destroy stage', function () {
var container = Konva.document.createElement('div');
konvaContainer.appendChild(container);
@@ -637,7 +637,7 @@ suite('Stage', function() {
width: 578,
height: 200,
id: 'stageFalconId',
name: 'stageFalconName'
name: 'stageFalconName',
});
var layer = new Konva.Layer();
@@ -649,7 +649,7 @@ suite('Stage', function() {
stroke: 'black',
strokeWidth: 4,
id: 'circleFalconId',
name: 'circleFalconName'
name: 'circleFalconName',
});
layer.add(circle);
@@ -706,7 +706,7 @@ suite('Stage', function() {
});
// ======================================================
test('scale stage with no shapes', function() {
test('scale stage with no shapes', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -718,7 +718,7 @@ suite('Stage', function() {
});
// ======================================================
test('test stage.getStage()', function() {
test('test stage.getStage()', function () {
var stage = addStage();
assert.notEqual(stage.getStage(), undefined);
@@ -726,7 +726,7 @@ suite('Stage', function() {
//console.log(stage.getStage());
});
test('add multiple layers to stage', function() {
test('add multiple layers to stage', function () {
var stage = addStage();
var layer1 = new Konva.Layer();
var layer2 = new Konva.Layer();
@@ -735,7 +735,7 @@ suite('Stage', function() {
assert.equal(stage.getLayers().length, 3, 'stage has exactly three layers');
});
// ======================================================
test('test drag and click', function() {
test('test drag and click', function () {
var stage = addStage();
var layer = new Konva.Layer();
var rect = new Konva.Rect({
@@ -744,13 +744,13 @@ suite('Stage', function() {
width: 50,
height: 50,
fill: 'red',
draggable: true
draggable: true,
});
layer.add(rect);
stage.add(layer);
rect.on('dblclick', function() {
rect.on('dblclick', function () {
assert(false, 'double click fired');
});
@@ -759,32 +759,32 @@ suite('Stage', function() {
// simulate dragging
stage.simulateMouseDown({
x: 60,
y: y
y: y,
});
stage.simulateMouseMove({
x: 61,
y: y
y: y,
});
stage.simulateMouseMove({
x: 62,
y: y
y: y,
});
stage.simulateMouseMove({
x: 63,
y: y
y: y,
});
stage.simulateMouseMove({
x: 64,
y: y
y: y,
});
stage.simulateMouseUp({
x: 65,
y: y
y: y,
});
assert.equal(Konva.isDragging(), false);
@@ -792,19 +792,19 @@ suite('Stage', function() {
// simulate click
stage.simulateMouseDown({
x: 66,
y: y
y: y,
});
stage.simulateMouseUp({
x: 66,
y: y
y: y,
});
assert.equal(Konva.isDragging(), false);
assert.equal(Konva.DD.node, undefined);
});
// ======================================================
test('do not trigger stage click after dragend', function() {
test('do not trigger stage click after dragend', function () {
var stage = addStage();
var layer = new Konva.Layer();
var rect = new Konva.Rect({
@@ -813,7 +813,7 @@ suite('Stage', function() {
width: 50,
height: 50,
fill: 'red',
draggable: true
draggable: true,
});
layer.add(rect);
@@ -821,7 +821,7 @@ suite('Stage', function() {
var clicks = 0;
stage.on('click', function() {
stage.on('click', function () {
debugger;
clicks += 1;
});
@@ -829,12 +829,12 @@ suite('Stage', function() {
// simulate dragging
stage.simulateMouseDown({
x: 25,
y: 25
y: 25,
});
stage.simulateMouseMove({
x: 100,
y: 100
y: 100,
});
// move rect out of mouse
@@ -843,13 +843,13 @@ suite('Stage', function() {
stage.simulateMouseUp({
x: 100,
y: 100
y: 100,
});
assert.equal(clicks, 0);
});
test('can listen click on empty areas', function() {
test('can listen click on empty areas', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -860,31 +860,31 @@ suite('Stage', function() {
var mouseups = 0;
var mousemoves = 0;
stage.on('mousedown', function(e) {
stage.on('mousedown', function (e) {
mousedowns += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('mousemove', function(e) {
stage.on('mousemove', function (e) {
mousemoves += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('mouseup', function(e) {
stage.on('mouseup', function (e) {
mouseups += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('click', function(e) {
stage.on('click', function (e) {
clicks += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('dblclick', function(e) {
stage.on('dblclick', function (e) {
dblicks += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
@@ -893,17 +893,17 @@ suite('Stage', function() {
// simulate dragging
stage.simulateMouseDown({
x: 60,
y: 10
y: 10,
});
stage.simulateMouseMove({
x: 60,
y: 10
y: 10,
});
stage.simulateMouseUp({
x: 65,
y: 10
y: 10,
});
assert.equal(mousedowns, 1, 'first mousedown registered');
@@ -914,12 +914,12 @@ suite('Stage', function() {
stage.simulateMouseDown({
x: 60,
y: 10
y: 10,
});
stage.simulateMouseUp({
x: 65,
y: 10
y: 10,
});
assert.equal(mousedowns, 2, 'second mousedown registered');
@@ -928,7 +928,7 @@ suite('Stage', function() {
assert.equal(dblicks, 1, 'first dbclick registered');
});
test('can listen taps on empty areas', function() {
test('can listen taps on empty areas', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -939,31 +939,31 @@ suite('Stage', function() {
var touchends = 0;
var touchmoves = 0;
stage.on('touchstart', function(e) {
stage.on('touchstart', function (e) {
touchstarts += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('touchend', function(e) {
stage.on('touchend', function (e) {
touchends += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('touchmove', function(e) {
stage.on('touchmove', function (e) {
touchmoves += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('tap', function(e) {
stage.on('tap', function (e) {
taps += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('dbltap', function(e) {
stage.on('dbltap', function (e) {
dbltaps += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
@@ -992,7 +992,7 @@ suite('Stage', function() {
assert.equal(dbltaps, 1, 'dbltap registered');
});
test('pass context and wheel events to shape', function() {
test('pass context and wheel events to shape', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -1002,7 +1002,7 @@ suite('Stage', function() {
y: 50,
width: 100,
height: 100,
fill: 'red'
fill: 'red',
});
layer.add(rect);
layer.draw();
@@ -1011,13 +1011,13 @@ suite('Stage', function() {
var wheels = 0;
// test on empty
stage.on('contextmenu', function(e) {
stage.on('contextmenu', function (e) {
contextmenus += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
});
stage.on('wheel', function(e) {
stage.on('wheel', function (e) {
wheels += 1;
assert.equal(e.target, stage);
assert.equal(e.currentTarget, stage);
@@ -1026,11 +1026,11 @@ suite('Stage', function() {
var top = stage.content.getBoundingClientRect().top;
stage._contextmenu({
clientX: 0,
clientY: top + 0
clientY: top + 0,
});
stage._wheel({
clientX: 0,
clientY: top + 0
clientY: top + 0,
});
assert.equal(contextmenus, 1, 'first contextment registered');
@@ -1040,37 +1040,37 @@ suite('Stage', function() {
stage.off('wheel');
// test on shape
stage.on('contextmenu', function(e) {
stage.on('contextmenu', function (e) {
contextmenus += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
});
stage.on('wheel', function(e) {
stage.on('wheel', function (e) {
wheels += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
});
stage._contextmenu({
clientX: 60,
clientY: top + 60
clientY: top + 60,
});
stage._wheel({
clientX: 60,
clientY: top + 60
clientY: top + 60,
});
assert.equal(contextmenus, 2, 'second contextment registered');
assert.equal(wheels, 2, 'second wheel registered');
});
test('make sure it does not trigger too many events', function() {
test('make sure it does not trigger too many events', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var rect = new Konva.Rect({
width: stage.width(),
height: stage.height()
height: stage.height(),
});
layer.add(rect);
layer.draw();
@@ -1080,25 +1080,25 @@ suite('Stage', function() {
var mousedowns = 0;
var mouseups = 0;
stage.on('mousedown', function(e) {
stage.on('mousedown', function (e) {
mousedowns += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
});
stage.on('mouseup', function(e) {
stage.on('mouseup', function (e) {
mouseups += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
});
stage.on('click', function(e) {
stage.on('click', function (e) {
clicks += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
});
stage.on('dblclick', function(e) {
stage.on('dblclick', function (e) {
dblicks += 1;
assert.equal(e.target, rect);
assert.equal(e.currentTarget, stage);
@@ -1107,12 +1107,12 @@ suite('Stage', function() {
// simulate dragging
stage.simulateMouseDown({
x: 60,
y: 10
y: 10,
});
stage.simulateMouseUp({
x: 65,
y: 10
y: 10,
});
assert.equal(mousedowns, 1, 'first mousedown registered');
@@ -1122,12 +1122,12 @@ suite('Stage', function() {
stage.simulateMouseDown({
x: 60,
y: 10
y: 10,
});
stage.simulateMouseUp({
x: 65,
y: 10
y: 10,
});
assert.equal(mousedowns, 2, 'second mousedown registered');
@@ -1136,7 +1136,7 @@ suite('Stage', function() {
assert.equal(dblicks, 1, 'first dbclick registered');
});
test('test mouseover event on stage', function() {
test('test mouseover event on stage', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
@@ -1145,7 +1145,7 @@ suite('Stage', function() {
y: 50,
width: 50,
height: 50,
fill: 'red'
fill: 'red',
});
layer.add(rect1);
@@ -1154,14 +1154,14 @@ suite('Stage', function() {
y: 100,
width: 50,
height: 50,
fill: 'red'
fill: 'red',
});
layer.add(rect2);
layer.draw();
var mouseover = 0;
stage.on('mouseover', function(e) {
stage.on('mouseover', function (e) {
mouseover += 1;
if (mouseover === 1) {
@@ -1178,27 +1178,27 @@ suite('Stage', function() {
stage._mouseover({
clientX: 0,
clientY: 0
clientY: 0,
});
assert.equal(mouseover, 1, 'initial over');
stage.simulateMouseMove({
x: 10,
y: 10
y: 10,
});
assert.equal(mouseover, 1, 'moved inside stage - no new over events');
stage.simulateMouseMove({
x: 60,
y: 60
y: 60,
});
assert.equal(mouseover, 2, 'moved into inner shape, trigger new mouseover');
stage.simulateMouseMove({
x: 110,
y: 110
y: 110,
});
assert.equal(
@@ -1209,7 +1209,7 @@ suite('Stage', function() {
stage.simulateMouseMove({
x: 10,
y: 10
y: 10,
});
assert.equal(
@@ -1219,14 +1219,14 @@ suite('Stage', function() {
);
});
test('toCanvas in sync way', function() {
test('toCanvas in sync way', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
fill: 'black',
radius: 50
radius: 50,
});
layer.add(circle);
stage.add(layer);
@@ -1234,14 +1234,14 @@ suite('Stage', function() {
compareCanvases(stage.toCanvas(), layer.toCanvas(), 200);
});
test('toDataURL with hidden layer', function() {
test('toDataURL with hidden layer', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
fill: 'red',
radius: 50
radius: 50,
});
layer.add(circle);
stage.add(layer);
@@ -1251,14 +1251,14 @@ suite('Stage', function() {
assert.equal(stage.toDataURL() === stageDataUrl, false);
});
test('toDataURL works as toCanvas', function() {
test('toDataURL works as toCanvas', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
fill: 'red',
radius: 50
radius: 50,
});
layer.add(circle);
stage.add(layer);
@@ -1266,14 +1266,14 @@ suite('Stage', function() {
assert.equal(stage.toDataURL(), stage.toCanvas().toDataURL());
});
test('toDataURL should no relate on stage size', function() {
test('toDataURL should no relate on stage size', function () {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
fill: 'red',
radius: stage.height() * 0.6
radius: stage.height() * 0.6,
});
layer.add(circle);
stage.add(layer);
@@ -1281,7 +1281,7 @@ suite('Stage', function() {
compareCanvases(stage.toCanvas(circle.getClientRect()), circle.toCanvas());
});
test('toCanvas with large size', function() {
test('toCanvas with large size', function () {
var stage = addStage();
var layer = new Konva.Layer();
@@ -1290,7 +1290,7 @@ suite('Stage', function() {
x: stage.height() / 2,
y: stage.height() / 2,
fill: 'black',
radius: radius
radius: radius,
});
layer.add(circle);
stage.add(layer);
@@ -1299,7 +1299,7 @@ suite('Stage', function() {
x: -10,
y: -10,
width: stage.height() + 20,
height: stage.height() + 20
height: stage.height() + 20,
});
var canvas = createCanvas();
@@ -1313,20 +1313,20 @@ suite('Stage', function() {
compareCanvases(stageCanvas, canvas, 100);
});
test('check hit graph with stage listening property', function() {
test('check hit graph with stage listening property', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
showHit(layer);
var circle = new Konva.Circle({
fill: 'green',
radius: 50
radius: 50,
});
layer.add(circle);
var pos = {
x: stage.width() / 2,
y: stage.height() / 2
y: stage.height() / 2,
};
circle.position(pos);
stage.draw();
@@ -1345,12 +1345,12 @@ suite('Stage', function() {
assert.equal(stage.getIntersection(pos), circle, 'circle again');
});
test('toDataURL should use pixelRatio 1 by default', function(done) {
test('toDataURL should use pixelRatio 1 by default', function (done) {
var stage = addStage();
var url = stage.toDataURL();
var image = new window.Image();
image.onload = function() {
image.onload = function () {
assert.equal(image.width, stage.width());
assert.equal(image.height, stage.height());
done();
@@ -1358,11 +1358,11 @@ suite('Stage', function() {
image.src = url;
});
test('show a warning if the stage has too many layers', function() {
test('show a warning if the stage has too many layers', function () {
var stage = addStage();
var oldWarn = Konva.Util.warn;
var called = false;
Konva.Util.warn = function() {
Konva.Util.warn = function () {
called = true;
};