Sha256: a41276c70d94410c57d9e5ec3087e9ba805a1769c3b8e713f5df16f8340c54fe

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

#= require spec_helper

describe 'test environment setup', ->

  it 'loading libraries', ->
    load_modularity()
    loadCS "/vendor/assets/javascripts/mixins/closable.coffee"

    class window.ClosableModuleStandard extends Module
      @mixin closable


describe 'Closable', ->
  template 'closable.html'

  beforeEach ->
    
  describe 'embedded close button', ->
    it 'finds the close button div automatically', ->
      new ClosableModuleStandard('#test #closable1')
      $('#test #closable1 .CloseButton').click()

      expect($('#test #closable1').length).toEqual(0)


  describe 'when clicking the close button', ->
    it 'removes the container', ->
      new ClosableModuleStandard('#test #closable1')
      $('#test #closable1 .CloseButton').click()

      expect($('#test #closable1').length).toEqual(0)
      
    
    it "fires the 'closed' event", ->
      closable_module = new ClosableModuleStandard('#test #closable1')
      closable_module.bind_event('closed', (spy = jasmine.createSpy()))

      $('#test #closable1 .CloseButton').click()

      expect(spy).toHaveBeenCalled()
      expect(spy.callCount).toEqual(1)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
modularity-rails-0.6.2 spec/javascripts/mixins/closable_spec.coffee
modularity-rails-0.6.1 spec/javascripts/mixins/closable_spec.coffee