Sha256: bb3ddff1ce4ae48eda2fbe0bfe9fb18f8da253122d00b07cc38ecbb42f688632

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

describe 'The Controller Component', ->
  beforeEach ->
    controller = Luca.register  'Luca.components.SpecController'
    controller.extends          'Luca.components.Controller' 
    controller.defines
      name: "spec_controller"
      defaultCard: 'one'
      rootComponent: true
      components:[
        name: "one"
        type: "controller"
        components:[
          name: "alpha"
        ,
          name: "bravo"
        ]
      ,
        name: "two"
        type: "controller"
        components:[
          name: "charlie"
        ,
          name: "delta"
        ]
      ,
        name: "three"
        type: "controller"
        components:[
          name: "echo"
        ]
      ,
        name: "four"
        type: "view"
      ]

    @controller = new Luca.components.SpecController().render()

  it "should track the names of its pages", ->
    names = @controller.sectionNames()
    expect( names... ).toEqual 'one', 'two', 'three', 'four'

  it "should track the names of its controllers", ->
    names = _( @controller.controllers() ).pluck 'name'
    expect( names... ).toEqual 'one', 'two', 'three'

  it "should be stateful", ->
    expect( @controller.state ).toBeDefined()

  it "should track the active page", -> 
    @controller.navigate_to("two")
    expect( @controller.activePage() ).toEqual 'two'

  it "should define a controllerPath method on each page", ->
    expect( @controller.activeComponent().controllerPath ).toBeDefined()

  it "should know the controller path", ->
    path = @controller.activeComponent().controllerPath()
    expect( path... ).toEqual "spec_controller", "one"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
luca-0.9.76 spec/components/controller_spec.coffee