Commit aed32a09 by Christina Roberts

Merge pull request #10237 from stvstnfrd/noop-tests

Remove unused specs
parents 300bd431 ca99606f
......@@ -71,13 +71,6 @@ describe 'Problem', ->
it 'bind the math input', ->
expect($('input.math')).toHandleWith 'keyup', @problem.refreshMath
# TODO: figure out why failing
xit 'replace math content on the page', ->
expect(MathJax.Hub.Queue.mostRecentCall.args).toEqual [
['Text', @stubbedJax, ''],
[@problem.updateMathML, @stubbedJax, $('#input_example_1').get(0)]
]
describe 'bind_with_custom_input_id', ->
beforeEach ->
spyOn window, 'update_schematics'
......@@ -205,15 +198,6 @@ describe 'Problem', ->
expect(@problem.el.html()).toEqual 'Incorrect!'
expect(window.SR.readElts).toHaveBeenCalled()
# TODO: figure out why failing
xdescribe 'when the response is undetermined', ->
it 'alert the response', ->
spyOn window, 'alert'
spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) ->
callback(success: 'Number Only!')
@problem.check()
expect(window.alert).toHaveBeenCalledWith 'Number Only!'
describe 'reset', ->
beforeEach ->
@problem = new Problem($('.xblock-student_view'))
......@@ -554,13 +538,6 @@ describe 'Problem', ->
runs ->
expect(window.SR.readElts).toHaveBeenCalled()
# TODO: figure out why failing
xit 'alert to the user', ->
spyOn window, 'alert'
spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> callback(success: 'OK')
@problem.save()
expect(window.alert).toHaveBeenCalledWith 'Saved'
describe 'refreshMath', ->
beforeEach ->
@problem = new Problem($('.xblock-student_view'))
......@@ -613,11 +590,6 @@ describe 'Problem', ->
@problem.refreshAnswers()
expect(@stubCodeMirror.save).toHaveBeenCalled()
# TODO: figure out why failing
xit 'serialize all answers', ->
@problem.refreshAnswers()
expect(@problem.answers).toEqual "input_1_1=one&input_1_2=two"
describe 'multiple JsInput in single problem', ->
jsinput_html = readFixtures('jsinput_problem.html')
......
# TODO: figure out why failing
xdescribe 'Sequence', ->
beforeEach ->
# Stub MathJax
window.MathJax = { Hub: { Queue: -> } }
spyOn Logger, 'log'
loadFixtures 'sequence.html'
@items = $.parseJSON readFixtures('items.json')
describe 'constructor', ->
beforeEach ->
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence', 1
it 'set the element', ->
expect(@sequence.el).toEqual $('#sequence_1')
it 'build the navigation', ->
classes = $('#sequence-list li>a').map(-> $(this).attr('class')).get()
elements = $('#sequence-list li>a').map(-> $(this).attr('data-element')).get()
titles = $('#sequence-list li>a>p').map(-> $(this).html()).get()
# expect(classes).toEqual ['seq_video_active', 'seq_video_inactive', 'seq_problem_inactive']
expect(classes).toEqual ['active', 'inactive', 'visited']
expect(elements).toEqual ['1', '2', '3']
expect(titles).toEqual ['Video 1', 'Video 2', 'Sample Problem']
it 'bind the page events', ->
expect($('#sequence-list a')).toHandleWith 'click', @sequence.goto
it 'render the active sequence content', ->
expect($('#seq_content').html()).toEqual 'Video 1'
describe 'toggleArrows', ->
beforeEach ->
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence', 1
describe 'when the first tab is active', ->
beforeEach ->
@sequence.position = 1
@sequence.toggleArrows()
it 'disable the previous button', ->
expect($('.sequence-nav-button.button-previous')).toHaveClass 'disabled'
it 'enable the next button', ->
expect($('.sequence-nav-button.button-next')).not.toHaveClass 'disabled'
expect($('.sequence-nav-button.button-next')).toHandleWith 'click', @sequence.next
describe 'when the middle tab is active', ->
beforeEach ->
@sequence.position = 2
@sequence.toggleArrows()
it 'enable the previous button', ->
expect($('.sequence-nav-button.button-previous')).not.toHaveClass 'disabled'
expect($('.sequence-nav-button.button-previous')).toHandleWith 'click', @sequence.previous
it 'enable the next button', ->
expect($('.sequence-nav-button.button-next')).not.toHaveClass 'disabled'
expect($('.sequence-nav-button.button-next')).toHandleWith 'click', @sequence.next
describe 'when the last tab is active', ->
beforeEach ->
@sequence.position = 3
@sequence.toggleArrows()
it 'enable the previous button', ->
expect($('.sequence-nav-button.button-previous')).not.toHaveClass 'disabled'
expect($('.sequence-nav-button.button-previous')).toHandleWith 'click', @sequence.previous
it 'disable the next button', ->
expect($('.sequence-nav-button.button-next')).toHaveClass 'disabled'
describe 'render', ->
beforeEach ->
spyOn $, 'postWithPrefix'
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence'
spyOnEvent @sequence.el, 'contentChanged'
spyOn(@sequence, 'toggleArrows').andCallThrough()
describe 'with a different position than the current one', ->
beforeEach ->
@sequence.render 1
describe 'with no previous position', ->
it 'does not save the new position', ->
expect($.postWithPrefix).not.toHaveBeenCalled()
describe 'with previous position', ->
beforeEach ->
@sequence.position = 2
@sequence.render 1
it 'mark the previous tab as visited', ->
# expect($('[data-element="2"]')).toHaveClass 'seq_video_visited'
expect($('[data-element="2"]')).toHaveClass 'visited'
it 'save the new position', ->
expect($.postWithPrefix).toHaveBeenCalledWith '/modx/1/goto_position', position: 1
it 'mark new tab as active', ->
# expect($('[data-element="1"]')).toHaveClass 'seq_video_active'
expect($('[data-element="1"]')).toHaveClass 'active'
it 'render the new content', ->
expect($('#seq_content').html()).toEqual 'Video 1'
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.el
describe 'with the same position as the current one', ->
it 'should not trigger contentChanged event', ->
@sequence.position = 2
@sequence.render 2
expect('contentChanged').not.toHaveBeenTriggeredOn @sequence.el
describe 'goto', ->
beforeEach ->
jasmine.stubRequests()
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence', 2
$('[data-element="3"]').click()
it 'log the sequence goto event', ->
expect(Logger.log).toHaveBeenCalledWith 'seq_goto', old: 2, new: 3, id: '1'
it 'call render on the right sequence', ->
expect($('#seq_content').html()).toEqual 'Sample Problem'
describe 'next', ->
beforeEach ->
jasmine.stubRequests()
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence', 2
$.scrollTo 150
$('.sequence-nav-button.button-next').click()
it 'log the next sequence event', ->
expect(Logger.log).toHaveBeenCalledWith 'seq_next', old: 2, new: 3, id: '1'
it 'call render on the next sequence', ->
expect($('#seq_content').html()).toEqual 'Sample Problem'
it 'scrolls to the top of the page', ->
expect($('body').scrollTop()).toBe 0
describe 'previous', ->
beforeEach ->
jasmine.stubRequests()
@sequence = new Sequence '1', 'sequence_1', @items, 'sequence', 2
$.scrollTo 150
$('.sequence-nav-button.button-previous').click()
it 'log the previous sequence event', ->
expect(Logger.log).toHaveBeenCalledWith 'seq_prev', old: 2, new: 1, id: '1'
it 'call render on the previous sequence', ->
expect($('#seq_content').html()).toEqual 'Video 1'
it 'scrolls to the top of the page', ->
expect($('body').scrollTop()).toBe 0
describe 'link_for', ->
it 'return a link for specific position', ->
sequence = new Sequence '1', 'sequence_1', @items, 2
expect(sequence.link_for(2)).toBe '[data-element="2"]'
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