From 8fb06ce1947f6984dc60ebe777c3e6f4e1df4e23 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Mon, 2 Jul 2012 15:06:10 -0400 Subject: [PATCH] Update code according to changes in 829e502 --- lms/static/coffee/spec/courseware_spec.coffee | 4 +-- lms/static/coffee/spec/helper.coffee | 6 ++-- .../coffee/spec/modules/problem_spec.coffee | 28 +++++++++---------- .../coffee/spec/modules/sequence_spec.coffee | 16 +++++------ lms/static/coffee/src/courseware.coffee | 2 +- lms/static/coffee/src/modules/problem.coffee | 2 +- lms/static/coffee/src/modules/sequence.coffee | 2 +- lms/templates/problem_ajax.html | 2 +- lms/templates/seq_module.html | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lms/static/coffee/spec/courseware_spec.coffee b/lms/static/coffee/spec/courseware_spec.coffee index cc64536849..3b40930b41 100644 --- a/lms/static/coffee/spec/courseware_spec.coffee +++ b/lms/static/coffee/spec/courseware_spec.coffee @@ -34,7 +34,7 @@ describe 'Courseware', ->
-
+
@@ -46,7 +46,7 @@ describe 'Courseware', -> expect(window.Video).toHaveBeenCalledWith('2', '1.0:def5678') it 'detect the problem element and convert it', -> - expect(window.Problem).toHaveBeenCalledWith('3', '/example/url/') + expect(window.Problem).toHaveBeenCalledWith(3, 'problem_3', '/example/url/') it 'detect the histrogram element and convert it', -> expect(window.Histogram).toHaveBeenCalledWith('3', [[0, 1]]) diff --git a/lms/static/coffee/spec/helper.coffee b/lms/static/coffee/spec/helper.coffee index c0d3d77950..33c7fdb43f 100644 --- a/lms/static/coffee/spec/helper.coffee +++ b/lms/static/coffee/spec/helper.coffee @@ -20,12 +20,12 @@ jasmine.stubRequests = -> settings.success data: jasmine.stubbedMetadata[match[1]] else if match = settings.url.match /static\/subs\/(.+)\.srt\.sjson/ settings.success jasmine.stubbedCaption - else if settings.url.match /modx\/problem\/.+\/problem_get$/ + else if settings.url.match /modx\/.+\/problem_get$/ settings.success html: readFixtures('problem_content.html') else if settings.url == '/calculate' || - settings.url == '/6002x/modx/sequence/1/goto_position' || + settings.url.match(/modx\/.+\/goto_position$/) || settings.url.match(/event$/) || - settings.url.match(/modx\/problem\/.+\/problem_(check|reset|show|save)$/) + settings.url.match(/modx\/.+\/problem_(check|reset|show|save)$/) # do nothing else throw "External request attempted for #{settings.url}, which is not defined." diff --git a/lms/static/coffee/spec/modules/problem_spec.coffee b/lms/static/coffee/spec/modules/problem_spec.coffee index 48d63784d6..107930c3b1 100644 --- a/lms/static/coffee/spec/modules/problem_spec.coffee +++ b/lms/static/coffee/spec/modules/problem_spec.coffee @@ -17,7 +17,7 @@ describe 'Problem', -> describe 'constructor', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" it 'set the element', -> expect(@problem.el).toBe '#problem_1' @@ -26,7 +26,7 @@ describe 'Problem', -> beforeEach -> spyOn window, 'update_schematics' MathJax.Hub.getAllJax.andReturn [@stubbedJax] - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" it 'set mathjax typeset', -> expect(MathJax.Hub.Queue).toHaveBeenCalled() @@ -60,7 +60,7 @@ describe 'Problem', -> describe 'render', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @bind = @problem.bind spyOn @problem, 'bind' @@ -88,7 +88,7 @@ describe 'Problem', -> describe 'check', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @problem.answers = 'foo=1&bar=2' it 'log the problem_check event', -> @@ -98,7 +98,7 @@ describe 'Problem', -> it 'submit the answer for check', -> spyOn $, 'postWithPrefix' @problem.check() - expect($.postWithPrefix).toHaveBeenCalledWith '/modx/problem/1/problem_check', 'foo=1&bar=2', jasmine.any(Function) + expect($.postWithPrefix).toHaveBeenCalledWith '/modx/1/problem_check', 'foo=1&bar=2', jasmine.any(Function) describe 'when the response is correct', -> it 'call render with returned content', -> @@ -121,7 +121,7 @@ describe 'Problem', -> describe 'reset', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" it 'log the problem_reset event', -> @problem.answers = 'foo=1&bar=2' @@ -131,7 +131,7 @@ describe 'Problem', -> it 'POST to the problem reset page', -> spyOn $, 'postWithPrefix' @problem.reset() - expect($.postWithPrefix).toHaveBeenCalledWith '/modx/problem/1/problem_reset', { id: 1 }, jasmine.any(Function) + expect($.postWithPrefix).toHaveBeenCalledWith '/modx/1/problem_reset', { id: 1 }, jasmine.any(Function) it 'render the returned content', -> spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> @@ -141,7 +141,7 @@ describe 'Problem', -> describe 'show', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @problem.el.prepend '
' describe 'when the answer has not yet shown', -> @@ -155,7 +155,7 @@ describe 'Problem', -> it 'fetch the answers', -> spyOn $, 'postWithPrefix' @problem.show() - expect($.postWithPrefix).toHaveBeenCalledWith '/modx/problem/1/problem_show', jasmine.any(Function) + expect($.postWithPrefix).toHaveBeenCalledWith '/modx/1/problem_show', jasmine.any(Function) it 'show the answers', -> spyOn($, 'postWithPrefix').andCallFake (url, callback) -> @@ -220,7 +220,7 @@ describe 'Problem', -> describe 'save', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @problem.answers = 'foo=1&bar=2' it 'log the problem_save event', -> @@ -230,7 +230,7 @@ describe 'Problem', -> it 'POST to save problem', -> spyOn $, 'postWithPrefix' @problem.save() - expect($.postWithPrefix).toHaveBeenCalledWith '/modx/problem/1/problem_save', 'foo=1&bar=2', jasmine.any(Function) + expect($.postWithPrefix).toHaveBeenCalledWith '/modx/1/problem_save', 'foo=1&bar=2', jasmine.any(Function) it 'alert to the user', -> spyOn window, 'alert' @@ -240,7 +240,7 @@ describe 'Problem', -> describe 'refreshMath', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" $('#input_example_1').val 'E=mc^2' @problem.refreshMath target: $('#input_example_1').get(0) @@ -250,7 +250,7 @@ describe 'Problem', -> describe 'updateMathML', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @stubbedJax.root.toMathML.andReturn '' describe 'when there is no exception', -> @@ -270,7 +270,7 @@ describe 'Problem', -> describe 'refreshAnswers', -> beforeEach -> - @problem = new Problem 1, '/problem/url/' + @problem = new Problem 1, "problem_1", "/problem/url/" @problem.el.html '''