mirror of
https://github.com/status-im/burnchart.git
synced 2025-02-13 10:56:25 +00:00
31 lines
751 B
CoffeeScript
31 lines
751 B
CoffeeScript
assert = require 'assert'
|
|
|
|
RactiveEventful = require '../src/utils/ractive/eventful.coffee'
|
|
|
|
module.exports = ->
|
|
# This represents a way for mediator subscriptions to get cancelled.
|
|
'mediator subscriptions get cancelled': (done) ->
|
|
# Need to be able to deal with custom context.
|
|
ctx = 'called': 0
|
|
|
|
view = new RactiveEventful
|
|
|
|
onconstruct: ->
|
|
# Track how many times we get called.
|
|
@subscribe '!event', ->
|
|
@called += 1
|
|
, ctx
|
|
|
|
onteardown: ->
|
|
# Need to deal with multiple teardown handlers
|
|
do this._super
|
|
|
|
do view.render()
|
|
|
|
view.publish '!event'
|
|
assert.equal ctx.called, 1
|
|
do view.teardown
|
|
view.publish '!event'
|
|
assert.equal ctx.called, 1
|
|
|
|
do done |