UNPKG

modularity-framework

Version:

Lightweight component-oriented Web UI framework

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