Sha256: c95476acf9b183b25be32ee4387df6e9a0ef119cf4e1cfab4a2eef92db145330

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

require '/assets/mercury/mercury.js'

describe "Mercury.modalHandlers.htmleditor", ->

  template 'mercury/modals/htmleditor.html'

  beforeEach ->
    @modal =
      element: $('#test')
      hide: ->
    Mercury.region =
      html: -> '<span>html \ncontent</span>'
    Mercury.modalHandlers.htmleditor.call(@modal)

  describe "loading", ->

    it "sets the value of the textarea", ->
      expect($('#test textarea').val()).toEqual('<span>html \ncontent</span>')


  describe "submitting", ->

    it "triggers a replaceHTML action", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#submit').get(0))
      expect(spy.callCount).toEqual(1)
      expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html content</span>'}])

    it "hides the modal", ->
      spy = spyOn(@modal, 'hide').andCallFake(=>)
      jasmine.simulate.click($('#submit').get(0))
      expect(spy.callCount).toEqual(1)

Version data entries

1 entries across 1 versions & 1 rubygems

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