mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
unrecognized selector should return an empty array. also formatted unit tests
This commit is contained in:
parent
9bfe5f5e52
commit
74bef1e108
2
dist/kinetic-core.js
vendored
2
dist/kinetic-core.js
vendored
@ -2592,7 +2592,7 @@ Kinetic.Container.prototype = {
|
|||||||
}
|
}
|
||||||
// unrecognized selector
|
// unrecognized selector
|
||||||
else {
|
else {
|
||||||
return false;
|
return [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_getDescendants: function(arr) {
|
_getDescendants: function(arr) {
|
||||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -176,7 +176,7 @@ Kinetic.Container.prototype = {
|
|||||||
}
|
}
|
||||||
// unrecognized selector
|
// unrecognized selector
|
||||||
else {
|
else {
|
||||||
return false;
|
return [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_getDescendants: function(arr) {
|
_getDescendants: function(arr) {
|
||||||
|
@ -737,12 +737,14 @@ Test.prototype.tests = {
|
|||||||
layer.add(circle);
|
layer.add(circle);
|
||||||
layer.add(rect);
|
layer.add(rect);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
var shapes = layer.get('.myShape');
|
var shapes = layer.get('.myShape');
|
||||||
|
|
||||||
test(shapes.length === 2, 'shapes array should have 2 elements');
|
test(shapes.length === 2, 'shapes array should have 2 elements');
|
||||||
var a = 0;
|
var a = 0;
|
||||||
shapes.apply('on', 'mouseover', function () {a++;});
|
shapes.apply('on', 'mouseover', function() {
|
||||||
|
a++;
|
||||||
|
});
|
||||||
circle.simulate('mouseover');
|
circle.simulate('mouseover');
|
||||||
test(a === 1, 'listener should have fired for circle');
|
test(a === 1, 'listener should have fired for circle');
|
||||||
rect.simulate('mouseover');
|
rect.simulate('mouseover');
|
||||||
@ -1073,7 +1075,7 @@ Test.prototype.tests = {
|
|||||||
|
|
||||||
layer2.hide();
|
layer2.hide();
|
||||||
test(!layer2.isVisible(), 'layer2 should be invisible');
|
test(!layer2.isVisible(), 'layer2 should be invisible');
|
||||||
|
|
||||||
layer2.show();
|
layer2.show();
|
||||||
test(layer2.isVisible(), 'layer2 should be visible');
|
test(layer2.isVisible(), 'layer2 should be visible');
|
||||||
},
|
},
|
||||||
@ -2818,7 +2820,7 @@ Test.prototype.tests = {
|
|||||||
test(text.getShadow().color === 'green', 'text box shadow color should be green');
|
test(text.getShadow().color === 'green', 'text box shadow color should be green');
|
||||||
test(text.getCornerRadius() === 20, 'text box corner radius should be 20');
|
test(text.getCornerRadius() === 20, 'text box corner radius should be 20');
|
||||||
test(text.getDraggable() === false, 'text draggable should be false');
|
test(text.getDraggable() === false, 'text draggable should be false');
|
||||||
|
|
||||||
// test set text to integer
|
// test set text to integer
|
||||||
text.setText(5);
|
text.setText(5);
|
||||||
|
|
||||||
@ -3229,7 +3231,9 @@ Test.prototype.tests = {
|
|||||||
clone.get('.myText')[0].setTextFill('black');
|
clone.get('.myText')[0].setTextFill('black');
|
||||||
test(group.get('.myRect')[0].attrs.myAttr === 'group rect', 'group rect should have myAttr: group rect');
|
test(group.get('.myRect')[0].attrs.myAttr === 'group rect', 'group rect should have myAttr: group rect');
|
||||||
test(clone.get('.myRect')[0].attrs.myAttr === 'group rect', 'clone rect should have myAttr: group rect');
|
test(clone.get('.myRect')[0].attrs.myAttr === 'group rect', 'clone rect should have myAttr: group rect');
|
||||||
clone.get('.myRect')[0].setAttrs({myAttr: 'clone rect'});
|
clone.get('.myRect')[0].setAttrs({
|
||||||
|
myAttr: 'clone rect'
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that when we change a clone object attr that the rect object
|
* Make sure that when we change a clone object attr that the rect object
|
||||||
@ -3349,8 +3353,7 @@ Test.prototype.tests = {
|
|||||||
|
|
||||||
layer.add(rect);
|
layer.add(rect);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
|
|
||||||
rect.setShadow({
|
rect.setShadow({
|
||||||
offset: [1, 2]
|
offset: [1, 2]
|
||||||
});
|
});
|
||||||
@ -3386,7 +3389,7 @@ Test.prototype.tests = {
|
|||||||
});
|
});
|
||||||
test(rect.getShadow().offset.x === 5, 'shadow offset x should be 5');
|
test(rect.getShadow().offset.x === 5, 'shadow offset x should be 5');
|
||||||
test(rect.getShadow().offset.y === 6, 'shadow offset y should be 6');
|
test(rect.getShadow().offset.y === 6, 'shadow offset y should be 6');
|
||||||
|
|
||||||
},
|
},
|
||||||
'NODE - test setOffset': function(containerId) {
|
'NODE - test setOffset': function(containerId) {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
@ -4497,19 +4500,19 @@ Test.prototype.tests = {
|
|||||||
layer.add(bluecircle);
|
layer.add(bluecircle);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
||||||
|
|
||||||
layer.moveDown();
|
layer.moveDown();
|
||||||
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
||||||
|
|
||||||
layer.moveToBottom();
|
layer.moveToBottom();
|
||||||
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
||||||
|
|
||||||
layer.moveUp();
|
layer.moveUp();
|
||||||
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
||||||
|
|
||||||
layer.moveToTop();
|
layer.moveToTop();
|
||||||
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
test(layer.getZIndex() === 0, 'layer should have zindex of 0');
|
||||||
|
|
||||||
},
|
},
|
||||||
'LAYERING - move blue group on top of green group with moveToTop': function(containerId) {
|
'LAYERING - move blue group on top of green group with moveToTop': function(containerId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user