Sha256: afb4ca09ebd891a26cd826560835a23346987e0eccc3c4701572889c0ea0bed0

Contents?: true

Size: 948 Bytes

Versions: 9

Compression:

Stored size: 948 Bytes

Contents

#= require spec_helper
#= require modularity/modules/button


describe 'Button', ->
  
  beforeEach ->
    template 'button'

  describe 'manual clicks', ->

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

      button.container.click()

      spy.should.have.been.calledOnce


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

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

      spy.should.have.been.calledOnce


  describe 'programmatic clicks', ->

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

      button.click()

      spy.should.have.been.called

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
modularity-rails-0.15.0 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.14.0 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.12.3 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.12.2 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.12.1 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.12.0 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.11.1 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.11.0 demo/spec/javascripts/modules/button_spec.coffee
modularity-rails-0.10.0 demo/spec/javascripts/modules/button_spec.coffee