mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
finish tests fixing
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
simulateMouseUp,
|
||||
simulateTouchStart,
|
||||
simulateTouchEnd,
|
||||
isNode,
|
||||
} from './utis';
|
||||
|
||||
describe('MouseEvents', function () {
|
||||
@@ -189,8 +190,6 @@ describe('MouseEvents', function () {
|
||||
it('test listening true/false with clicks', function () {
|
||||
var stage = addStage();
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
var layer = new Konva.Layer();
|
||||
|
||||
var circle = new Konva.Circle({
|
||||
@@ -418,8 +417,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
assert.equal(circle.fill(), 'red', 'circle fill should be red');
|
||||
assert.equal(circle.stroke(), 'black', 'circle stroke should be black');
|
||||
|
||||
@@ -506,8 +503,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
setTimeout(function () {
|
||||
// move mouse to center of circle to trigger mouseover
|
||||
simulateMouseMove(stage, {
|
||||
@@ -646,8 +641,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(group);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
var groupMousedowns = 0;
|
||||
var greenCircleMousedowns = 0;
|
||||
|
||||
@@ -722,7 +715,6 @@ describe('MouseEvents', function () {
|
||||
stage.add(layer);
|
||||
layer.draw();
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
simulateMouseDown(stage, {
|
||||
x: 135,
|
||||
y: 30,
|
||||
@@ -764,7 +756,6 @@ describe('MouseEvents', function () {
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
// move mouse slowly
|
||||
for (var i = 99; i < 129; i++) {
|
||||
simulateMouseMove(stage, {
|
||||
@@ -846,8 +837,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(group);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
setTimeout(function () {
|
||||
// move mouse outside of circles
|
||||
simulateMouseMove(stage, {
|
||||
@@ -1008,8 +997,6 @@ describe('MouseEvents', function () {
|
||||
group2Mouseout += 1;
|
||||
});
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
simulateMouseMove(stage, {
|
||||
x: 10,
|
||||
y: 10,
|
||||
@@ -1236,8 +1223,6 @@ describe('MouseEvents', function () {
|
||||
group22Mouseout += 1;
|
||||
});
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
simulateMouseMove(stage, {
|
||||
x: 10,
|
||||
y: 10,
|
||||
@@ -1649,8 +1634,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(group2);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
// events array
|
||||
var e = [];
|
||||
|
||||
@@ -1716,8 +1699,6 @@ describe('MouseEvents', function () {
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
|
||||
var mouseovers = 0;
|
||||
var mouseouts = 0;
|
||||
|
||||
@@ -2111,7 +2092,7 @@ describe('MouseEvents', function () {
|
||||
mouseenterCount += 1;
|
||||
});
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
var top = (stage.content && stage.content.getBoundingClientRect().top) || 0;
|
||||
var evt = {
|
||||
clientX: 10,
|
||||
clientY: 10 + top,
|
||||
@@ -2133,7 +2114,7 @@ describe('MouseEvents', function () {
|
||||
mouseleave += 1;
|
||||
});
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
var top = (stage.content && stage.content.getBoundingClientRect().top) || 0;
|
||||
var evt = {
|
||||
clientX: 0,
|
||||
clientY: 0 + top,
|
||||
@@ -2192,7 +2173,7 @@ describe('MouseEvents', function () {
|
||||
// move into a circle
|
||||
simulateMouseMove(stage, { x: 200, y: 5 });
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
var top = (stage.content && stage.content.getBoundingClientRect().top) || 0;
|
||||
var evt = {
|
||||
clientX: 200,
|
||||
clientY: -5 + top,
|
||||
@@ -2308,7 +2289,7 @@ describe('MouseEvents', function () {
|
||||
mouseenter += 1;
|
||||
});
|
||||
|
||||
var top = stage.content.getBoundingClientRect().top;
|
||||
var top = (stage.content && stage.content.getBoundingClientRect().top) || 0;
|
||||
var evt = {
|
||||
clientX: 10,
|
||||
clientY: 10 + top,
|
||||
@@ -2371,6 +2352,9 @@ describe('MouseEvents', function () {
|
||||
});
|
||||
|
||||
it('test scaled with CSS stage', function () {
|
||||
if (isNode) {
|
||||
return;
|
||||
}
|
||||
var stage = addStage();
|
||||
|
||||
stage.container().style.transform = 'scale(0.5)';
|
||||
|
||||
Reference in New Issue
Block a user