Skip to content
This repository has been archived by the owner on Jan 12, 2018. It is now read-only.

Commit

Permalink
fix test suite for newer dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Burgestrand committed Jun 4, 2014
1 parent ca8e8c9 commit 58eee75
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
16 changes: 8 additions & 8 deletions test/integration/bound.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ describe 'Bound attributes and text nodes', ->

it 'uses model formatter', ->
model = {}
Serenade.defineProperty(model, "name", value: "Jonas", format: (val) -> val.toUpperCase())
Serenade.defineProperty model, "name", value: "OrAnGE", format: (val) -> val.toLowerCase()
@render 'div[data-name=@name style:color=@name] @name', model
expect(@body.querySelector('div').getAttribute('data-name')).to.eql("JONAS")
expect(@body.querySelector('div').style.color).to.eql("JONAS")
expect(@body.querySelector('div').textContent).to.eql("JONAS")
model.name = "peter"
expect(@body.querySelector('div').getAttribute('data-name')).to.eql("PETER")
expect(@body.querySelector('div').style.color).to.eql("PETER")
expect(@body.querySelector('div').textContent).to.eql("PETER")
expect(@body.querySelector('div').getAttribute('data-name')).to.eql("orange")
expect(@body.querySelector('div').style.color).to.eql("orange")
expect(@body.querySelector('div').textContent).to.eql("orange")
model.name = "ReD"
expect(@body.querySelector('div').getAttribute('data-name')).to.eql("red")
expect(@body.querySelector('div').style.color).to.eql("red")
expect(@body.querySelector('div').textContent).to.eql("red")

it 'can handle bound text as root nodes', ->
model = Serenade(first: "Jonas", last: "Nicklas")
Expand Down
14 changes: 7 additions & 7 deletions test/integration/collection.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ describe 'Collection', ->
expect(@body).to.have.element('ul')

it 'can reference the items itself', ->
model = { people: ['jonas', 'peter'] }
model = { colors: ['red', 'blue'] }

@render '''
ul
- collection @people
- collection @colors
li[id=@ style:color=@] @
''', model
expect(@body).to.have.element('ul > li#jonas')
expect(@body).to.have.element('ul > li#peter')
expect(@body.querySelector("#jonas")).to.have.text("jonas")
expect(@body.querySelector("#peter")).to.have.text("peter")
expect(@body.querySelector("li").style.color).to.eql("jonas")
expect(@body).to.have.element('ul > li#red')
expect(@body).to.have.element('ul > li#blue')
expect(@body.querySelector("#red")).to.have.text("red")
expect(@body.querySelector("#blue")).to.have.text("blue")
expect(@body.querySelector("li").style.color).to.eql("red")

it 'compiles a Serenade.collection in a collection instruction', ->
model = { people: new Serenade.Collection([{ name: 'jonas' }, { name: 'peter' }]) }
Expand Down
3 changes: 2 additions & 1 deletion test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--compilers coffee:coffee-script --recursive
--compilers coffee:coffee-script/register --recursive
--globals document,window,body
4 changes: 2 additions & 2 deletions test/spec_helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ beforeEach ->
Serenade.unregisterAll()
Serenade.clearCache()

@setupDom = ->
@setupDom = =>
@document = require("jsdom").jsdom(null, null, features: { QuerySelector: true })
@window = @document.createWindow()
@window = @document.parentWindow
@body = @document.body
Serenade.document = @document

Expand Down

0 comments on commit 58eee75

Please sign in to comment.