Permalink
Browse files

Merge pull request #235 from awt2542/master

added siblingLayersByName() method
  • Loading branch information...
koenbok committed Aug 12, 2015
2 parents daa25a5 + e2c6cd8 commit 6360b78c87d9f80bec976dff6bff35ff34d1544c
Showing with 13 additions and 0 deletions.
  1. +3 −0 framer/Layer.coffee
  2. +10 −0 test/tests/LayerTest.coffee
@@ -644,6 +644,9 @@ class exports.Layer extends BaseClass
subLayersByName: (name) ->
_.filter @subLayers, (layer) -> layer.name == name
siblingLayersByName: (name) ->
_.filter @siblingLayers, (layer) -> layer.name == name
superLayers: (context=false) ->
superLayers = []
@@ -652,6 +652,16 @@ describe "Layer", ->
layerA.subLayersByName("B").should.eql [layerB]
layerA.subLayersByName("C").should.eql [layerC, layerD]
it "should get a siblinglayer by name", ->
layerA = new Layer
layerB = new Layer name:"B", superLayer:layerA
layerC = new Layer name:"C", superLayer:layerA
layerD = new Layer name:"C", superLayer:layerA
layerB.siblingLayersByName("C").should.eql [layerC, layerD]
layerD.siblingLayersByName("B").should.eql [layerB]
it "should get a superlayers", ->
layerA = new Layer
layerB = new Layer superLayer:layerA

0 comments on commit 6360b78

Please sign in to comment.