diff --git a/tests/html/functionalTests.html b/tests/html/functionalTests.html
index d58cfbfc..a06de7ea 100644
--- a/tests/html/functionalTests.html
+++ b/tests/html/functionalTests.html
@@ -23,7 +23,7 @@
test.run();
document.getElementsByTagName('body')[0].addEventListener('mousemove', function(evt) {
- console.log(evt.offsetX + ',' + evt.offsetY);
+ console.log(evt.clientX + ',' + evt.clientY);
}, false);
};
diff --git a/tests/js/functionalTests.js b/tests/js/functionalTests.js
index 84742894..db69e279 100644
--- a/tests/js/functionalTests.js
+++ b/tests/js/functionalTests.js
@@ -461,5 +461,83 @@ Test.prototype.tests = {
test(touchend, '12) touchend should be true');
test(tap, '12) tap should be true');
test(dbltap, '12) dbltap should be true');
+ },
+ 'EVENTS - test group mousedown events': function(containerId) {
+ var stage = new Kinetic.Stage({
+ container: containerId,
+ width: 578,
+ height: 200
+ });
+ var layer = new Kinetic.Layer();
+ var group = new Kinetic.Group();
+
+ var redCircle = new Kinetic.Ellipse({
+ x: stage.getWidth() / 2,
+ y: stage.getHeight() / 2,
+ radius: 80,
+ strokeWidth: 4,
+ fill: 'red',
+ stroke: 'black',
+ name: 'red'
+ });
+
+ var greenCircle = new Kinetic.Ellipse({
+ x: stage.getWidth() / 2,
+ y: stage.getHeight() / 2,
+ radius: 40,
+ strokeWidth: 4,
+ fill: 'green',
+ stroke: 'black',
+ name: 'green'
+ });
+
+ group.add(redCircle);
+ group.add(greenCircle);
+
+ layer.add(group);
+ stage.add(layer);
+
+ var groupMousedowns = 0;
+ var greenCircleMousedowns = 0;
+
+ group.on('mousedown', function() {
+ groupMousedowns++;
+ });
+
+ greenCircle.on('mousedown', function() {
+ greenCircleMousedowns++;
+ });
+
+ stage._mousedown({
+ clientX: 285,
+ clientY: 100
+ });
+
+ test(groupMousedowns === 1, 'groupMousedowns should be 1');
+ test(greenCircleMousedowns === 1, 'greenCircleMousedowns should be 1');
+
+ stage._mousedown({
+ clientX: 332,
+ clientY: 139
+ });
+
+ test(groupMousedowns === 2, 'groupMousedowns should be 2');
+ test(greenCircleMousedowns === 1, 'greenCircleMousedowns should be 1');
+
+ stage._mousedown({
+ clientX: 285,
+ clientY: 92
+ });
+
+ test(groupMousedowns === 3, 'groupMousedowns should be 3');
+ test(greenCircleMousedowns === 2, 'greenCircleMousedowns should be 2');
+
+ stage._mousedown({
+ clientX: 221,
+ clientY: 146
+ });
+
+ test(groupMousedowns === 4, 'groupMousedowns should be 4');
+ test(greenCircleMousedowns === 2, 'greenCircleMousedowns should be 2');
}
};
diff --git a/tests/js/manualTests.js b/tests/js/manualTests.js
index ff09a5a8..1a78a8db 100644
--- a/tests/js/manualTests.js
+++ b/tests/js/manualTests.js
@@ -572,45 +572,6 @@ Test.prototype.tests = {
stage.add(layer);
},
- 'EVENTS - group click events': function(containerId) {
- var stage = new Kinetic.Stage({
- container: containerId,
- width: 578,
- height: 200
- });
- var layer = new Kinetic.Layer();
- var group = new Kinetic.Group();
-
- group.on('click', function() {
- log('click group');
- //console.log(this);
- });
- var redEllipse = new Kinetic.Ellipse({
- x: stage.getWidth() / 2,
- y: stage.getHeight() / 2,
- radius: 80,
- strokeWidth: 4,
- fill: 'red',
- stroke: 'black',
- name: 'red'
- });
-
- var greenEllipse = new Kinetic.Ellipse({
- x: stage.getWidth() / 2,
- y: stage.getHeight() / 2,
- radius: 40,
- strokeWidth: 4,
- fill: 'green',
- stroke: 'black',
- name: 'green'
- });
-
- group.add(redEllipse);
- group.add(greenEllipse);
-
- layer.add(group);
- stage.add(layer);
- },
'EVENTS - group mousemove events': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
diff --git a/tests/js/unitTests.js b/tests/js/unitTests.js
index df8e1bc0..4911153b 100644
--- a/tests/js/unitTests.js
+++ b/tests/js/unitTests.js
@@ -4425,7 +4425,7 @@ Test.prototype.tests = {
var transFinished = false;
var trans = rect.transitionTo({
- duration: 1,
+ duration: 0.2,
x: 400,
y: 30,
rotation: Math.PI * 2,
@@ -4437,15 +4437,11 @@ Test.prototype.tests = {
setTimeout(function() {
trans.stop();
- test(!transFinished, 'transition should not have finished yet');
- }, 500);
+ }, 100);
setTimeout(function() {
trans.resume();
- test(!transFinished, 'transition should not have finished yet');
- }, 1000);
- setTimeout(function() {
- test(transFinished, 'transition should be finished by now');
- }, 2000);
+ }, 100);
+
},
'TRANSITION - transition stage': function(containerId) {
var stage = new Kinetic.Stage({