Sha256: 3fcbc11153694ad8d2f253fbbe8b558489b2781689f0cac567800aba80fecb21

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

require '/assets/mercury/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

1 entries across 1 versions & 1 rubygems

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