Rewrite Tab module, refactor Sequence module

This commit is contained in:
Prem Sichanugrist
2012-05-10 21:04:53 -04:00
parent 1abe15d4d9
commit 59b453488a
8 changed files with 64 additions and 81 deletions

View File

@@ -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 ->

View File

@@ -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() {

View File

@@ -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 ->