Directly call toggleArrow in sequence render
There might be a chance that an error got thrown after 'contentChanged' event was fired and stop the `toggleArrow()` method to be called. This will make sure that the navigation will still be working even some element in the content is failed.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user