 
 asyncTest 'data-bind-style should bind to a Batman object', ->
   source = '<input type="text" data-bind-style="object"></input>'
-  context = Batman
+  context =
     object: new Batman.Object
       'backgroundColor': 'blue'
       color: 'green'
 
-  helpers.render source, context, (node) ->
+  helpers.render source, context, (node, view) ->
     node = node[0]
     equal node.style['backgroundColor'], 'blue'
     equal node.style['color'], 'green'
 
-    context.set 'object.color', 'blue'
+    view.set('object.color', 'blue')
     equal node.style['color'], 'blue'
     equal node.style['backgroundColor'], 'blue'
 
-    context.unset 'object.color'
+    view.unset('object.color')
     equal node.style['color'], ''
     equal node.style['backgroundColor'], 'blue'
 
-    context.set 'object', new Batman.Object color: 'yellow'
+    view.set('object', new Batman.Object color: 'yellow')
     equal node.style['color'], 'yellow'
     equal node.style['backgroundColor'], ''
 

helpers = if typeof require is 'undefined' then window.viewHelpers else require './view_helper'

QUnit.module 'Batman.View style bindings',
asyncTest 'data-bind-style should bind to a string', 4, ->
  source = '<input type="text" data-bind-style="string"></input>'
  context = Batman
    string: 'backgroundColor:blue; color:green;'

  helpers.render source, context, (node) ->
    node = node[0]
    equal node.style['backgroundColor'], 'blue'
    equal node.style['color'], 'green'

    context.set 'string', 'color: green'
    equal node.style['backgroundColor'], ''
    equal node.style['color'], 'green'


  hash = new Batman.Hash
    'backgroundColor': 'blue'
    color: 'green'

  helpers.render source, {hash}, (node, view) ->
    node = node[0]
    equal node.style['backgroundColor'], 'blue'
    equal node.style['color'], 'green'

    view.set('hash', new Batman.Hash color: 'red')
    equal node.style['backgroundColor'], ''
    equal node.style['color'], 'red'

