Sha256: cd7a047c61f0f0884c19e3d002b522993f2ba2a0b42a4e24ded9bef089c7d5c4

Contents?: true

Size: 904 Bytes

Versions: 1

Compression:

Stored size: 904 Bytes

Contents

describe "Mercury.dialogHandlers.formatblock", ->

  beforeEach ->
    fixture.load('mercury/dialogs/formatblock.html')
    @dialog = {element: $(fixture.el)}
    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

1 entries across 1 versions & 1 rubygems

Version Path
kiteditor-1.0.12 spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee