Sha256: ee047dac6093e0eea2e82514716e1f81ca6b8cf64cb3b78f4991687f6290d955

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

describe "Mercury.Regions.Simple", ->

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

1 entries across 1 versions & 1 rubygems

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