Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix superLayer assignment bug
- Loading branch information
Showing
with
33 additions
and
4 deletions.
-
+18
−3
framer/Layer.coffee
-
+15
−1
test/tests/LayerTest.coffee
|
@@ -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", -> |
|
|