diff --git a/lms/static/coffee/spec/modules/sequence_spec.coffee b/lms/static/coffee/spec/modules/sequence_spec.coffee index 6ff79c1805..1e5447d847 100644 --- a/lms/static/coffee/spec/modules/sequence_spec.coffee +++ b/lms/static/coffee/spec/modules/sequence_spec.coffee @@ -24,7 +24,6 @@ describe 'Sequence', -> expect(titles).toEqual ['Video 1', 'Video 2', 'Sample Problem'] it 'bind the page events', -> - expect(@sequence.element).toHandleWith 'contentChanged', @sequence.toggleArrows expect($('#sequence-list a')).toHandleWith 'click', @sequence.goto it 'render the active sequence content', -> @@ -76,6 +75,7 @@ describe 'Sequence', -> spyOn $, 'postWithPrefix' @sequence = new Sequence '1', @items, 'sequence' spyOnEvent @sequence.element, 'contentChanged' + spyOn(@sequence, 'toggleArrows').andCallThrough() describe 'with a different position than the current one', -> beforeEach -> @@ -105,6 +105,9 @@ describe 'Sequence', -> it 'update the position', -> expect(@sequence.position).toEqual 1 + it 're-update the arrows', -> + expect(@sequence.toggleArrows).toHaveBeenCalled() + it 'trigger contentChanged event', -> expect('contentChanged').toHaveBeenTriggeredOn @sequence.element diff --git a/lms/static/coffee/src/modules/sequence.coffee b/lms/static/coffee/src/modules/sequence.coffee index 56a9b551bf..463bf419fc 100644 --- a/lms/static/coffee/src/modules/sequence.coffee +++ b/lms/static/coffee/src/modules/sequence.coffee @@ -9,7 +9,6 @@ class @Sequence $(selector, @element) bind: -> - @element.bind 'contentChanged', @toggleArrows @$('#sequence-list a').click @goto buildNavigation: -> @@ -43,6 +42,7 @@ class @Sequence MathJax.Hub.Queue(["Typeset", MathJax.Hub]) @position = new_position + @toggleArrows() @element.trigger 'contentChanged' goto: (event) =>