Sha256: 4012c3ab902a881b95103b1f18b20c2b5892c7fb5576200965982f81df7e8870

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

describe "Mercury.modalHandlers.insertCharacter", ->

  beforeEach ->
    fixture.load('mercury/modals/insertcharacter.html')
    @modal =
      element: $(fixture.el)
      hide: ->
    @modalHideSpy = spyOn(@modal, 'hide').andCallFake(=>)
    Mercury.modalHandlers.insertCharacter.call(@modal)

  describe "clicking on a character", ->

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

    it "hides the modal", ->
      jasmine.simulate.click($('#char2').get(0))
      expect(@modalHideSpy.callCount).toEqual(1)


  describe "clicking on any other element", ->

    it "does nothing", ->
      jasmine.simulate.click($('#char3').get(0))
      expect(@modalHideSpy.callCount).toEqual(0)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kiteditor-1.0.12 spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee