jasmine-gwt/lib/assets/javascripts/jasmine/GWT.js.coffee

28 lines
708 B
CoffeeScript
Raw Normal View History

2012-01-11 19:30:10 +00:00
jasmine.GWT =
Step: (type, name, parameter) ->
if scenario = jasmine.GWT.currentScenario_
scenario[type](name, parameter)
else
2012-01-17 14:09:44 +00:00
(jasmine.GWT.Steps[type] ||= []).push([ name, parameter ])
2012-01-11 19:30:10 +00:00
Hook: (type, code) ->
2012-01-17 14:09:44 +00:00
(jasmine.GWT.Hooks[type] ||= []).push(code)
2012-01-11 19:30:10 +00:00
World: (object_or_code) ->
if typeof object_or_code != 'function'
2012-01-17 14:09:44 +00:00
object_or_code = jasmine.GWT.generateWorldMethods(object_or_code)
jasmine.GWT.Hook('World', object_or_code)
2012-01-11 19:30:10 +00:00
runHook: (type, context) ->
for code in (jasmine.GWT.Hooks[type] || [])
code.apply(context)
2012-01-17 14:09:44 +00:00
generateWorldMethods: (object) ->
->
for method, code of object
this[method] = code
2012-01-11 19:30:10 +00:00
Steps: {}
Hooks: {}