Sha256: 1bd83b6b749f81dbe78d6ef86f93c38ea3c4ea58215500e8b447a175f158dd43

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

describe "Mercury.Regions.Image", ->

  beforeEach ->
    fixture.load('mercury/regions/image.html')
    @regionElement = $('#image_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($('#image_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

1 entries across 1 versions & 1 rubygems

Version Path
kiteditor-1.0.12 spec/javascripts/mercury/regions/image_spec.js.coffee