diff --git a/src/item/Item.js b/src/item/Item.js index 467ff5f1..1c5af251 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -309,10 +309,9 @@ var Item = this.Item = Base.extend({ */ // TODO: isBelow - // TODO: this is confusing the beans - // isParent: function(item) { - // return this.parent == item; - // }, + isParent: function(item) { + return this.parent == item; + }, isChild: function(item) { return item.parent == this; diff --git a/test/tests/item.js b/test/tests/item.js index 4357b55f..351618eb 100644 --- a/test/tests/item.js +++ b/test/tests/item.js @@ -35,7 +35,7 @@ test('appendChild(item)', function() { equals(doc.activeLayer.children.length, 1); }); -test('item.parent / item.isChild', function() { +test('item.parent / item.isChild / item.isParent', function() { var doc = new Document(); var secondDoc = new Document(); var path = new Path(); @@ -43,7 +43,10 @@ test('item.parent / item.isChild', function() { equals(doc.activeLayer.children.indexOf(path) != -1, true); secondDoc.activeLayer.appendTop(path); equals(doc.activeLayer.isChild(path), false); + equals(path.isParent(doc.activeLayer), false); equals(secondDoc.activeLayer.isChild(path), true); + equals(path.isParent(secondDoc.activeLayer), true); + equals(doc.activeLayer.children.indexOf(path) == -1, true); equals(secondDoc.activeLayer.children.indexOf(path) == 0, true); });