spec_app/spec/javascripts/up/magic_spec.js.coffee in upjs-rails-0.6.2 vs spec_app/spec/javascripts/up/magic_spec.js.coffee in upjs-rails-0.6.3
- old
+ new
@@ -15,27 +15,27 @@
$('.child').click()
expect(observeClass).not.toHaveBeenCalledWith('container')
expect(observeClass).toHaveBeenCalledWith('child')
- describe 'up.awaken', ->
+ describe 'up.compiler', ->
it 'applies an event initializer whenever a matching fragment is inserted', ->
observeClass = jasmine.createSpy()
- up.awaken '.child', ($element) ->
+ up.compiler '.child', ($element) ->
observeClass($element.attr('class'))
up.ready(affix('.container .child'))
expect(observeClass).not.toHaveBeenCalledWith('container')
expect(observeClass).toHaveBeenCalledWith('child')
- it 'lets allows initializers return a destructor function, which is called when the awakened fragments gets destroyed', ->
+ it 'lets allows initializers return a destructor function, which is called when a compiled fragment gets destroyed', ->
destructor = jasmine.createSpy()
- up.awaken '.child', ($element) ->
+ up.compiler '.child', ($element) ->
destructor
up.ready(affix('.container .child'))
expect(destructor).not.toHaveBeenCalled()
@@ -43,11 +43,11 @@
expect(destructor).toHaveBeenCalled()
it 'parses an up-data attribute as JSON and passes the parsed object as a second argument to the initializer', ->
observeArgs = jasmine.createSpy()
- up.awaken '.child', ($element, data) ->
+ up.compiler '.child', ($element, data) ->
observeArgs($element.attr('class'), data)
data = { key1: 'value1', key2: 'value2' }
$tag = affix(".child").attr('up-data', JSON.stringify(data))
@@ -56,10 +56,10 @@
expect(observeArgs).toHaveBeenCalledWith('child', data)
it 'passes an empty object as a second argument to the initializer if there is no up-data attribute', ->
observeArgs = jasmine.createSpy()
- up.awaken '.child', ($element, data) ->
+ up.compiler '.child', ($element, data) ->
observeArgs($element.attr('class'), data)
up.ready(affix(".child"))
expect(observeArgs).toHaveBeenCalledWith('child', {})
\ No newline at end of file