Sha256: 8fefdba5cb26cad20a2172925ff4ba529e11cafab148d9dc68b4f1856b52a044

Contents?: true

Size: 925 Bytes

Versions: 2

Compression:

Stored size: 925 Bytes

Contents

require '/assets/mercury.js'

describe "Mercury.dialogHandlers.formatblock", ->

  template 'mercury/dialogs/formatblock.html'

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

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

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


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

    it "does nothing", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#em').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/formatblock_spec.js.coffee
mercury-rails-0.2.0 spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee