Permalink
Browse files

Fixes #63 names added to dom element

  • Loading branch information...
koenbok committed May 15, 2014
1 parent 4630242 commit b31938ad8113c4feff169c2a42d34517a5a22c73
Showing with 16 additions and 2 deletions.
  1. +14 −2 framer/Layer.coffee
  2. +2 −0 test/tests/LayerTest.coffee
@@ -82,8 +82,6 @@ class exports.Layer extends BaseClass
##############################################################
# Properties
@define "name", @simpleProperty "name", ""
# Css properties
@define "width", layerProperty "width", "width", 100
@define "height", layerProperty "height", "height", 100
@@ -147,6 +145,20 @@ class exports.Layer extends BaseClass
@define "borderWidth", layerStyleProperty "borderWidth"
##############################################################
# Identity
@define "name",
exportable: true
default: ""
get: ->
@_getPropertyValue "name"
set: (value) ->
@_setPropertyValue "name", value
# Set the name attribute of the dom element too
# See: https://github.com/koenbok/Framer/issues/63
@_element.setAttribute "name", value
##############################################################
# Geometry
@@ -139,11 +139,13 @@ describe "Layer", ->
it "should set name on create", ->
layer = new Layer name:"Test"
layer.name.should.equal "Test"
layer._element.getAttribute("name").should.equal "Test"
it "should set name after create", ->
layer = new Layer
layer.name = "Test"
layer.name.should.equal "Test"
layer._element.getAttribute("name").should.equal "Test"
# it "should handle background color with image", ->

0 comments on commit b31938a

Please sign in to comment.