Skip to content
Permalink
Browse files

Merge pull request #278 from koenbok/screen-inspect

Nice print output for Screen
  • Loading branch information...
koenbok committed Dec 27, 2015
2 parents 91e8b76 + 65e0f33 commit 31baf9735e8bdd8035250dfe0a02cd3593b12947
Showing with 22 additions and 0 deletions.
  1. +10 −0 framer/Screen.coffee
  2. +12 −0 test/tests/DeviceComponentTest.coffee
@@ -8,6 +8,16 @@ class ScreenClass extends BaseClass
@define "frame", get: -> {x:0, y:0, width:@width, height:@height}

# Todo: maybe resize based on parent layer

toInspect: ->

round = (value) ->
if parseInt(value) == value
return parseInt(value)
return Utils.round(value, 1)

return "<Screen #{round(@width)}x#{round(@height)}>"


# We use this as a singleton
exports.Screen = new ScreenClass
@@ -87,3 +87,15 @@ describe "DeviceComponent", ->

# reset stubs
Utils.isFramerStudio = _originalIsFramerStudio

it "should influence screen", ->

device = new DeviceComponent()
device.context.run ->
Screen.size.should.eql {width:640, height:1136}
Utils.inspect(Screen).should.equal "<Screen 640x1136>"

device.deviceType = "nexus-5-black"
device.context.run ->
Screen.size.should.eql {width:1080, height:1920}
Utils.inspect(Screen).should.equal "<Screen 1080x1920>"

0 comments on commit 31baf97

Please sign in to comment.
You can’t perform that action at this time.