render progress status while problem content rendering
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
describe 'Problem', ->
|
||||
problem_content_default = readFixtures('problem_content.html')
|
||||
|
||||
beforeEach ->
|
||||
# Stub MathJax
|
||||
window.MathJax =
|
||||
@@ -20,7 +22,7 @@ describe 'Problem', ->
|
||||
|
||||
spyOn Logger, 'log'
|
||||
spyOn($.fn, 'load').andCallFake (url, callback) ->
|
||||
$(@).html readFixtures('problem_content.html')
|
||||
$(@).html problem_content_default
|
||||
callback()
|
||||
|
||||
describe 'constructor', ->
|
||||
@@ -96,6 +98,13 @@ describe 'Problem', ->
|
||||
@problem.renderProgressState()
|
||||
expect(@problem.$('.problem-progress').html()).toEqual "(1 point possible)"
|
||||
|
||||
it 'displays the number of points possible when rendering happens with the content', ->
|
||||
@problem.el.data('progress_status', 'none')
|
||||
@problem.el.data('progress_detail', '0/2')
|
||||
expect(@problem.$('.problem-progress').html()).toEqual ""
|
||||
@problem.render(problem_content_default)
|
||||
expect(@problem.$('.problem-progress').html()).toEqual "(2 points possible)"
|
||||
|
||||
describe 'with any other valid status', ->
|
||||
it 'reports the current score', ->
|
||||
@problem.el.data('progress_status', 'foo')
|
||||
@@ -103,6 +112,13 @@ describe 'Problem', ->
|
||||
@problem.renderProgressState()
|
||||
expect(@problem.$('.problem-progress').html()).toEqual "(1/1 point)"
|
||||
|
||||
it 'shows current score when rendering happens with the content', ->
|
||||
@problem.el.data('progress_status', 'test status')
|
||||
@problem.el.data('progress_detail', '2/2')
|
||||
expect(@problem.$('.problem-progress').html()).toEqual ""
|
||||
@problem.render(problem_content_default)
|
||||
expect(@problem.$('.problem-progress').html()).toEqual "(2/2 points)"
|
||||
|
||||
describe 'render', ->
|
||||
beforeEach ->
|
||||
@problem = new Problem($('.xblock-student_view'))
|
||||
|
||||
@@ -159,6 +159,7 @@ class @Problem
|
||||
@setupInputTypes()
|
||||
@bind()
|
||||
@queueing()
|
||||
@renderProgressState()
|
||||
@el.attr('aria-busy', 'false')
|
||||
else
|
||||
$.postWithPrefix "#{@url}/problem_get", (response) =>
|
||||
|
||||
Reference in New Issue
Block a user