Permalink
Browse files

Added truncate property

  • Loading branch information...
nvh committed Mar 24, 2017
1 parent 095e0ba commit 4428af1bc9dc139a2d6d1dbc2c1674a79df76844
Showing with 15 additions and 0 deletions.
  1. +4 −0 framer/TextLayer.coffee
  2. +11 −0 test/tests/TextLayerTest.coffee
View
@@ -204,6 +204,10 @@ class exports.TextLayer extends Layer
get: -> @direction
set: (value) -> @direction = value
@define "truncate",
get: -> @textOverflow is "ellipsis"
set: (truncate) -> @textOverflow = if truncate then "ellipsis" else null
# Map shadow properties to text shadow
@define "shadowX", layerProperty(@, "shadowX", "textShadow", 0, _.isNumber)
@define "shadowY", layerProperty(@, "shadowY", "textShadow", 0, _.isNumber)
@@ -286,3 +286,14 @@ describe "TextLayer", ->
l.style["-webkit-line-clamp"].should.equal ''
l.height = 400
l.style["-webkit-line-clamp"].should.equal ''
describe "truncate", ->
it "should set textOverflow to ellipsis", ->
l = new TextLayer
text: longText
truncate: true
l.truncate.should.equal true
l.textOverflow.should.equal "ellipsis"
l.truncate = false
l.truncate.should.equal false
expect(l.textOverflow).to.equal null

0 comments on commit 4428af1

Please sign in to comment.