Rewrite Tab module, refactor Sequence module
This commit is contained in:
@@ -23,11 +23,15 @@ describe 'Courseware', ->
|
||||
describe 'bind', ->
|
||||
beforeEach ->
|
||||
@courseware = new Courseware
|
||||
setFixtures """<div id="seq_content"></div>"""
|
||||
setFixtures """
|
||||
<div class="course-content">
|
||||
<div class="sequence"></div>
|
||||
</div>
|
||||
"""
|
||||
|
||||
it 'binds the sequential content change event', ->
|
||||
it 'binds the content change event', ->
|
||||
@courseware.bind()
|
||||
expect($('#seq_content')).toHandleWith 'contentChanged', @courseware.render
|
||||
expect($('.course-content .sequence')).toHandleWith 'contentChanged', @courseware.render
|
||||
|
||||
describe 'render', ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
describe('bind', function() {
|
||||
beforeEach(function() {
|
||||
this.courseware = new Courseware;
|
||||
return setFixtures("<div id=\"seq_content\"></div>");
|
||||
return setFixtures("<div class=\"course-content\">\n <div class=\"sequence\"></div>\n</div>");
|
||||
});
|
||||
return it('binds the sequential content change event', function() {
|
||||
return it('binds the content change event', function() {
|
||||
this.courseware.bind();
|
||||
return expect($('#seq_content')).toHandleWith('contentChanged', this.courseware.render);
|
||||
return expect($('.course-content .sequence')).toHandleWith('contentChanged', this.courseware.render);
|
||||
});
|
||||
});
|
||||
return describe('render', function() {
|
||||
|
||||
@@ -11,8 +11,8 @@ class @Courseware
|
||||
new Courseware
|
||||
|
||||
bind: ->
|
||||
if $('#seq_content').length
|
||||
$('#seq_content').bind 'contentChanged', @render
|
||||
$('.course-content .sequence, .course-content .tab')
|
||||
.bind 'contentChanged', @render
|
||||
|
||||
render: ->
|
||||
$('.course-content .video').each ->
|
||||
|
||||
Reference in New Issue
Block a user