jquery-timeago/test/qunit_setup.coffee

24 lines
508 B
CoffeeScript
Raw Normal View History

setupFn = -> null
window.setup = (fn) ->
setupFn = fn
window.moreSetup = (fn) ->
origSetup = setupFn
setup ->
origSetup.call(this)
fn.call(this)
window.clearSetup = ->
setup -> null
originalModule = window.module
window.module = (description) ->
clearSetup()
originalModule(description)
originalTest = window.test
window.test = (description, testFn) ->
setupSnapshot = setupFn
originalTest description, ->
context = {}
setupSnapshot.call(context)
testFn.call(context)