Files
edx-platform/common/static/coffee/spec/xblock/runtime.v1_spec.coffee
Calen Pennington 864d831ce3 Use XBlock handlers for handle_ajax in XModules
Adds xblock handler_url support to the LMS, and makes handle_ajax use
that code.

[LMS-230] [LMS-229]
2013-11-08 11:08:48 -05:00

23 lines
662 B
CoffeeScript

describe "XBlock.runtime.v1", ->
beforeEach ->
setFixtures """
<div class='xblock' data-handler-prefix='/xblock/fake-usage-id/handler'/>
"""
@children = [
{name: 'childA'},
{name: 'childB'}
]
@element = $('.xblock')[0]
@runtime = XBlock.runtime.v1(@element, @children)
it "provides a handler url", ->
expect(@runtime.handlerUrl('foo')).toBe('/xblock/fake-usage-id/handler/foo')
it "provides a list of children", ->
expect(@runtime.children).toBe(@children)
it "maps children by name", ->
expect(@runtime.childMap.childA).toBe(@children[0])
expect(@runtime.childMap.childB).toBe(@children[1])