Sha256: 87cea602b7f7168aff21d3217a16d617a8a85e584f6ee1b13a4217dc9813e323

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

require '/assets/mercury/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.1.2 spec/javascripts/mercury/dialogs/style_spec.js.coffee
mercury-rails-0.1.1 spec/javascripts/mercury/dialogs/style_spec.js.coffee