Sha256: 56e6ee78cbf11a4106477ca5a872e292b31fa58db8aa04fd4b9b30f0ffa1d472

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

describe "Joosy.Page", ->

  describe "manager", ->

    beforeEach ->
      @Layout = class Layout extends Joosy.Layout

      class @Page extends Joosy.Page
        @layout Layout

      sinon.stub @Page.prototype, '__bootstrap'

    afterEach ->
      @Page::__bootstrap.restore()

    it "has appropriate accessors", ->
      @Page.scroll '#here'
      expect(@Page::__scrollElement).toEqual '#here'
      expect(@Page::__scrollSpeed).toEqual 500
      expect(@Page::__scrollMargin).toEqual 0

      @Page.scroll '#there', speed: 1000, margin: -5
      expect(@Page::__scrollElement).toEqual '#there'
      expect(@Page::__scrollSpeed).toEqual 1000
      expect(@Page::__scrollMargin).toEqual -5

      @Page.layout 'test'
      expect(@Page::__layoutClass).toEqual 'test'

    it "integrates with Router", ->
      target = sinon.stub Joosy.Router, 'navigate'
      (new @Page $('#application')).navigate 'there'
      expect(target.callCount).toEqual 1
      expect(target.alwaysCalledWithExactly 'there').toBeTruthy()
      Joosy.Router.navigate.restore()

    it "respects beforeFilters cancelation", ->
      sinon.stub @Page.prototype, '__confirmBeforeLoads'
      @Page::__confirmBeforeLoads.returns(false)

      new @Page $('#application')

      expect(@Page::__bootstrap.callCount).toEqual 0

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
joosy-1.2.0.rc.2 spec/joosy/core/page_spec.coffee
joosy-1.2.0.rc.1 spec/joosy/core/page_spec.coffee
joosy-1.2.0.beta.4 spec/joosy/core/page_spec.coffee
joosy-1.2.0.beta.3 spec/joosy/core/page_spec.coffee
joosy-1.2.0.beta.2 spec/joosy/core/page_spec.coffee
joosy-1.2.0.beta.1 spec/joosy/core/page_spec.coffee
joosy-1.2.0.alpha.73 spec/joosy/core/page_spec.coffee
joosy-1.2.0.alpha.71 spec/joosy/core/page_spec.coffee
joosy-1.2.0.alpha.70 spec/joosy/core/page_spec.coffee