Permalink
Browse files

Copy over style properties in Layer.copy()

  • Loading branch information...
nvh committed Aug 1, 2016
1 parent 5ee40e2 commit 6e9d16cab301718efc4d53703234919c1238daf1
Showing with 14 additions and 1 deletion.
  1. +3 −1 framer/Layer.coffee
  2. +11 −0 test/tests/LayerTest.coffee
View
@@ -636,7 +636,9 @@ class exports.Layer extends BaseClass
return layer
copySingle: ->
- return new @constructor(@props)
+ copy = new @constructor(@props)
+ copy.style = @style
+ copy
##############################################################
## IMAGE
@@ -1156,6 +1156,17 @@ describe "Layer", ->
copy.width.should.equal 100
copy.height.should.equal 100
+ it "copied Layer should also copy styles", ->
+ layer = new Layer
+ style:
+ "font-family" : "-apple-system"
+ "font-size" : "1.2em"
+ "text-align" : "right"
+
+ copy = layer.copy()
+ copy.style["font-family"].should.equal "-apple-system"
+ copy.style["font-size"].should.equal "1.2em"
+ copy.style["text-align"].should.equal "right"
describe "Draggable", ->

0 comments on commit 6e9d16c

Please sign in to comment.