mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Improve named child access tests.
This commit is contained in:
parent
38de43c612
commit
c4b51209f3
1 changed files with 22 additions and 9 deletions
|
@ -304,7 +304,7 @@ test('Check parent children object for named item', function() {
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Named child access', function() {
|
test('Named child access 1', function() {
|
||||||
var path = new Path();
|
var path = new Path();
|
||||||
path.name = 'test';
|
path.name = 'test';
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ test('Named child access 2', function() {
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Named child access 2', function() {
|
test('Named child access 3', function() {
|
||||||
var path = new Path();
|
var path = new Path();
|
||||||
path.name = 'test';
|
path.name = 'test';
|
||||||
|
|
||||||
|
@ -361,9 +361,10 @@ test('Named child access 2', function() {
|
||||||
return paper.project.activeLayer.children['test'] == path;
|
return paper.project.activeLayer.children['test'] == path;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
// TODO: Tests should not access internal properties
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return paper.project.activeLayer._namedChildren['test'].length == 1;
|
return paper.project.activeLayer._namedChildren['test'].length;
|
||||||
}, true);
|
}, 1);
|
||||||
|
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return group.children['test'] == path2;
|
return group.children['test'] == path2;
|
||||||
|
@ -373,15 +374,27 @@ test('Named child access 2', function() {
|
||||||
return group._namedChildren['test'].length == 1;
|
return group._namedChildren['test'].length == 1;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
equals(function() {
|
||||||
|
return paper.project.activeLayer._namedChildren['test'][0] == path;
|
||||||
|
}, true);
|
||||||
|
|
||||||
paper.project.activeLayer.appendTop(path2);
|
paper.project.activeLayer.appendTop(path2);
|
||||||
|
|
||||||
|
equals(function() {
|
||||||
|
return group.children['test'] == null;
|
||||||
|
}, true);
|
||||||
|
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return group._namedChildren['test'] === undefined;
|
return group._namedChildren['test'] === undefined;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
equals(function() {
|
equals(function() {
|
||||||
return paper.project.activeLayer._namedChildren['test'].length == 2;
|
return paper.project.activeLayer.children['test'] == path2;
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
equals(function() {
|
||||||
|
return paper.project.activeLayer._namedChildren['test'].length;
|
||||||
|
}, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Setting name of child back to null', function() {
|
test('Setting name of child back to null', function() {
|
||||||
|
|
Loading…
Reference in a new issue