Permalink
Browse files

Fix superLayer assignment bug

  • Loading branch information...
Koen Bok
Koen Bok committed Jan 12, 2016
1 parent 7399c60 commit dea63dbe4fa5c62ca698b701f93af4cf4a23ea38
Showing with 33 additions and 4 deletions.
  1. +18 −3 framer/Layer.coffee
  2. +15 −1 test/tests/LayerTest.coffee
View
@@ -729,9 +729,24 @@ class exports.Layer extends BaseClass
##############################################################
# Backwards superLayer and children compatibility
@define("superLayer", @proxyProperty("parent", importable:false))
@define("subLayers", @proxyProperty("children", importable:false))
@define("siblingLayers", @proxyProperty("siblings", importable:false))
@define "superLayer",
enumerable: false
exportable: false
importable: false
get: -> @parent
set: (value) -> @parent = value
@define "subLayers",
enumerable: false
exportable: false
importable: false
get: -> @children
@define "siblingLayers",
enumerable: false
exportable: false
importable: false
get: -> @siblings
superLayers: (context=false) -> @ancestors(context)
addSubLayer: (layer) -> @addChild(layer)
@@ -34,6 +34,7 @@ describe "Layer", ->
# if the default background color is not set the content layer of scrollcomponent is not hidden when layers are added
layer = new Layer()
Color.equal(layer.backgroundColor, Framer.Defaults.Layer.backgroundColor).should.be.true
Framer.Defaults =
@@ -272,7 +273,7 @@ describe "Layer", ->
it "should set style properties on create", ->
layer = new Layer backgroundColor: "red"
layer.backgroundColor.should.eql new Color("red")
layer.backgroundColor.isEqual(new Color("red")).should.equal true
layer.style["backgroundColor"].should.equal new Color("red").toString()
it "should check value type", ->
@@ -575,6 +576,19 @@ describe "Layer", ->
layerA.descendants.should.eql [layerB, layerC]
it "should set super/parent with property", ->
layerA = new Layer
layerB = new Layer
layerB.superLayer = layerA
layerA.children.should.eql [layerB]
layerA.subLayers.should.eql [layerB]
it "should set super/parent with with constructor", ->
layerA = new Layer
layerB = new Layer
superLayer: layerA
layerA.children.should.eql [layerB]
layerA.subLayers.should.eql [layerB]
describe "Layering", ->

0 comments on commit dea63db

Please sign in to comment.