Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (33 sloc) 1.038 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
{ assert, brains, Browser } = require("./helpers")


describe "CSS", ->

  describe "style", ->

    before (done)->
      brains.get "/styled", (req, res)-> res.send """
<html>
<body>
<div id="styled"></div>
</body>
</html>
"""
      brains.ready done

    before (done)->
      browser = new Browser()
      browser.visit("http://localhost:3003/styled")
        .then =>
          @style = browser.query("#styled").style
          return
        .then(done, done)

    it "should be formatted string", ->
      @style.opacity = .55
      assert.equal typeof @style.opacity, "string"
      assert.equal @style.opacity, "0.55"
    it "should not accept non-numbers", ->
      @style.opacity = ".46"
      @style.opacity = "four-six"
      assert.equal @style.opacity, "0.46"
    it "should default to empty string", ->
      @style.opacity = 1.0
      @style.opacity = undefined
      assert.equal @style.opacity, ""
      @style.opacity = null
      assert.equal @style.opacity, ""
Something went wrong with that request. Please try again.