Sha256: 6d1bf972df7af575dcf6ae6fca18ea389606a8e17463806cb7fb37f011b40298

Contents?: true

Size: 903 Bytes

Versions: 2

Compression:

Stored size: 903 Bytes

Contents

require '/assets/mercury.js'

describe "Mercury.dialogHandlers.style", ->

  template 'mercury/dialogs/style.html'

  beforeEach ->
    @dialog = {element: $('#test')}
    Mercury.dialogHandlers.style.call(@dialog)

  describe "when an element with a data-class attribute is clicked", ->

    it "triggers an action", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#red').get(0))
      expect(spy.callCount).toEqual(1)
      expect(spy.argsForCall[0]).toEqual(['action', {action: 'style', value: 'red'}])
      jasmine.simulate.click($('#bold').get(0))
      expect(spy.argsForCall[1]).toEqual(['action', {action: 'style', value: 'bold'}])


  describe "when any other element is clicked", ->

    it "does nothing", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#blue').get(0))
      expect(spy.callCount).toEqual(0)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercury-rails-0.2.3 spec/javascripts/mercury/dialogs/style_spec.js.coffee
mercury-rails-0.2.0 spec/javascripts/mercury/dialogs/style_spec.js.coffee