Commit b8fd728e by Prem Sichanugrist

Pass in element in CMS.start() instead

parent 28959973
...@@ -10,11 +10,12 @@ describe "CMS", -> ...@@ -10,11 +10,12 @@ describe "CMS", ->
describe "start", -> describe "start", ->
beforeEach -> beforeEach ->
@element = $("<div>")
spyOn(CMS.Views, "Course").andReturn(jasmine.createSpyObj("Course", ["render"])) spyOn(CMS.Views, "Course").andReturn(jasmine.createSpyObj("Course", ["render"]))
CMS.start() CMS.start(@element)
it "create the Course", -> it "create the Course", ->
expect(CMS.Views.Course).toHaveBeenCalled() expect(CMS.Views.Course).toHaveBeenCalledWith(el: @element)
expect(CMS.Views.Course().render).toHaveBeenCalled() expect(CMS.Views.Course().render).toHaveBeenCalled()
describe "view stack", -> describe "view stack", ->
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
viewStack: [] viewStack: []
start: -> start: (el) ->
new CMS.Views.Course(el: $('section.main-container')).render() new CMS.Views.Course(el: el).render()
replaceView: (view) -> replaceView: (view) ->
@viewStack = [view] @viewStack = [view]
...@@ -32,4 +32,4 @@ $ -> ...@@ -32,4 +32,4 @@ $ ->
$.ajaxSetup $.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' } headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
CMS.start() CMS.start($('section.main-container'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment