Sha256: 52ce22e7865bf7515f4b589a228f6749acd0dc693b36b37f074b29b7383d8fe3

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

describe 'up.magic', ->
  
  describe 'Javascript functions', ->
  
    describe 'up.on', ->
      
      it 'registers a delagating event listener to the document body', ->
        
        affix('.container .child')
        observeClass = jasmine.createSpy()
        up.on 'click', '.child', (event, $element) ->
          observeClass($element.attr('class'))
   
        $('.container').click()
        $('.child').click()
   
        expect(observeClass).not.toHaveBeenCalledWith('container')
        expect(observeClass).toHaveBeenCalledWith('child')           
      
    describe 'up.awaken', ->
      
      it 'applies an event initializer whenever a matching fragment is inserted', ->
  
        observeClass = jasmine.createSpy()
        up.awaken '.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', ->
  
        destructor = jasmine.createSpy()
        up.awaken '.child', ($element) ->
          destructor
  
        up.ready(affix('.container .child'))
        expect(destructor).not.toHaveBeenCalled()
        
        up.destroy('.container')
        expect(destructor).toHaveBeenCalled()
            
    describe 'up.ready', ->

      it 'should have tests'
      
     

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
upjs-rails-0.3.3 spec_app/spec/javascripts/up/magic_spec.js.coffee
upjs-rails-0.3.2 spec_app/spec/javascripts/up/magic_spec.js.coffee
upjs-rails-0.3.0 spec_app/spec/javascripts/up/magic_spec.js.coffee
upjs-rails-0.2.2 spec_app/spec/javascripts/up/magic_spec.js.coffee