Sha256: 4c26f997899031ddae362f7d2ec42161eeda153766adf3540d8eeb08f8c5b1c7

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

describe "Mercury.Regions.Image", ->

  template 'mercury/regions/image.html'

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

  describe "constructor", ->

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

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

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

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

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

     it "calls bindEvents", ->
       @region = new Mercury.Regions.Image(@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/image_spec.js.coffee
kuji-mercury-rails-0.3.2 spec/javascripts/mercury/regions/image_spec.js.coffee