Sha256: 4c8e902417199139a5695c7b88ed9d0372ae7b3489ac32599143cd094260dabf

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

describe "Mercury.Regions.Simple", ->

  template 'mercury/regions/simple.html'

  beforeEach ->
    @regionElement = $('#editable_region1')

  describe "constructor", ->

     beforeEach ->
       @buildSpy = spyOn(Mercury.Regions.Simple.prototype, 'build').andCallFake(=>)
       @bindEventsSpy = spyOn(Mercury.Regions.Simple.prototype, 'bindEvents').andCallFake(=>)

     it "expects an element and window", ->
       @region = new Mercury.Regions.Simple(@regionElement, window)
       expect(@region.element.get(0)).toEqual($('#editable_region1').get(0))
       expect(@region.window).toEqual(window)

     it "accepts options", ->
       @region = new Mercury.Regions.Simple(@regionElement, window, {foo: 'something'})
       expect(@region.options).toEqual({foo: 'something'})

     it "sets it's type", ->
       @region = new Mercury.Regions.Simple(@regionElement, window)
       expect(@region.type).toEqual('simple')

     it "calls build", ->
       @region = new Mercury.Regions.Simple(@regionElement, window)
       expect(@buildSpy.callCount).toEqual(1)

     it "calls bindEvents", ->
       @region = new Mercury.Regions.Simple(@regionElement, window)
       expect(@bindEventsSpy.callCount).toEqual(1)

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mercury-rails-0.5.0 spec/javascripts/mercury/regions/simple_spec.js.coffee
kuji-mercury-rails-0.3.2 spec/javascripts/mercury/regions/simple_spec.js.coffee