Sha256: ccc68c6950d3e6cf3cbffaf1846ace4b7f02d200cb9c253cfe9238af6920ed12

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

#= require spec_helper

describe 'test environment setup', ->

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


describe 'Button', ->
  template 'button.html'
  
  describe 'manual clicks', ->

    it 'fires when clicking on the container directly', ->
      button = new modularity.Button($('#test #button1'))
      button.bind_event('clicked', (spy = jasmine.createSpy()))

      button.container.click()

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


    it 'fires when clicking embedded elements of the button', ->
      button = new modularity.Button($('#test #button2'))
      button.bind_event('clicked', (spy = jasmine.createSpy()))

      button.container.find('.embedded').click()

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


  describe 'programmatic clicks', ->

    it 'programmatically clicks the button', ->
      button = new modularity.Button($('#test #button2'))
      spy = jasmine.createSpy()
      button.bind_event('clicked', spy)

      button.click()

      expect(spy).toHaveBeenCalled()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
modularity-rails-0.9.0 spec/javascripts/modules/button_spec.coffee