Sha256: 573e555d61ef13dbc476b5c4658005a6ff216917a3db2e2ec9c99cc846515b4a

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

require '/assets/mercury.js'

describe "Mercury.modalHandlers.insertCharacter", ->

  template 'mercury/modals/insertcharacter.html'

  beforeEach ->
    @modal =
      element: $('#test')
    @modalHideSpy = spyOn(Mercury.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

2 entries across 2 versions & 1 rubygems

Version Path
mercury-rails-0.2.3 spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee
mercury-rails-0.2.0 spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee