modularity-framework
Version:
Lightweight component-oriented Web UI framework
38 lines (25 loc) • 1.08 kB
text/coffeescript
require './spec_helper'
# For testing.
class TestModule extends modularity.EventualizedModule
init: (container, , ) ->
= yes
=
on: sinon.stub()
on_button_click: ->
describe 'EventualizedModule', ->
describe 'init', ->
beforeEach ->
= new TestModule 'testing',
'param 1',
'param 2'
it 'runs automatically when creating a module', ->
expect( .init_has_run).to.be.true
it 'gets called with all arguments of the constructor', ->
expect( .param_1).to.eql 'param 1'
expect( .param_2).to.eql 'param 2'
it 'runs the super constructor', ->
expect( .container).to.equal 'testing'
it 'runs "eventualize this" at the end', ->
expect( .button.on).to.have.been.calledOnce
expect( .button.on).to.have.been.calledWith 'click',
.on_button_click