unrecognized selector should return an empty array. also formatted unit tests

This commit is contained in:
ericdrowell
2012-09-25 12:12:27 -07:00
parent 9bfe5f5e52
commit 74bef1e108
4 changed files with 28 additions and 25 deletions

View File

@@ -2592,7 +2592,7 @@ Kinetic.Container.prototype = {
} }
// unrecognized selector // unrecognized selector
else { else {
return false; return [];
} }
}, },
_getDescendants: function(arr) { _getDescendants: function(arr) {

File diff suppressed because one or more lines are too long

View File

@@ -176,7 +176,7 @@ Kinetic.Container.prototype = {
} }
// unrecognized selector // unrecognized selector
else { else {
return false; return [];
} }
}, },
_getDescendants: function(arr) { _getDescendants: function(arr) {

View File

@@ -742,7 +742,9 @@ Test.prototype.tests = {
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');
@@ -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
@@ -3350,7 +3354,6 @@ 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]
}); });