Sha256: 3f439635357fcfccb0c1b45c06cff81be63ef4fd467927d155df57336afbef3e

Contents?: true

Size: 933 Bytes

Versions: 30

Compression:

Stored size: 933 Bytes

Contents

describe "Mercury.modalHandlers.htmlEditor", ->

  template 'mercury/modals/htmleditor.html'

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

30 entries across 30 versions & 3 rubygems

Version Path
kiteditor-1.0.25 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.24 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.23 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.22 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.21 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.20 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.19 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.18 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.17 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.16 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.14 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.13 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.11 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.10 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.9 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.8 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.7 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.6 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.5 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee
kiteditor-1.0.4 spec/javascripts/mercury/modals/htmleditor_spec.js.coffee