Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Check layer value types
- Loading branch information
Showing
with
10 additions
and
0 deletions.
-
+3
−0
framer/Layer.coffee
-
+7
−0
test/tests/LayerTest.coffee
|
@@ -21,6 +21,9 @@ layerProperty = (obj, name, cssProperty, fallback, validator, set) -> |
|
|
|
|
|
set: (value) -> |
|
|
|
|
|
if value and validator and not validator(value) |
|
|
throw new Error("Layer.#{name}: value '#{value}' of type '#{typeof(value)}'' is not valid") |
|
|
|
|
|
@_properties[name] = value |
|
|
@_element.style[cssProperty] = LayerStyle[cssProperty](@) |
|
|
|
|
|
|
@@ -233,6 +233,13 @@ describe "Layer", -> |
|
|
layer.backgroundColor.should.equal "red" |
|
|
layer.style["backgroundColor"].should.equal "red" |
|
|
|
|
|
it "should check value type", -> |
|
|
|
|
|
f = -> |
|
|
layer = new Layer |
|
|
layer.x = "hello" |
|
|
f.should.throw() |
|
|
|
|
|
|
|
|
describe "Filter Properties", -> |
|
|
|
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.