Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d778f2e9
Commit
d778f2e9
authored
Jun 07, 2013
by
Brian Talbot
Committed by
Giulio Gratta
Jun 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates jasmine tests to correspond to new capa template HTML
parent
a377f860
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
+14
-14
No files found.
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
View file @
d778f2e9
...
@@ -16,7 +16,7 @@ describe 'Problem', ->
...
@@ -16,7 +16,7 @@ describe 'Problem', ->
# note that the fixturesPath is set in spec/helper.coffee
# note that the fixturesPath is set in spec/helper.coffee
loadFixtures
'problem.html'
loadFixtures
'problem.html'
spyOn
Logger
,
'log'
spyOn
Logger
,
'log'
spyOn
(
$
.
fn
,
'load'
).
andCallFake
(
url
,
callback
)
->
spyOn
(
$
.
fn
,
'load'
).
andCallFake
(
url
,
callback
)
->
$
(
@
).
html
readFixtures
(
'problem_content.html'
)
$
(
@
).
html
readFixtures
(
'problem_content.html'
)
...
@@ -27,13 +27,13 @@ describe 'Problem', ->
...
@@ -27,13 +27,13 @@ describe 'Problem', ->
it
'set the element from html'
,
->
it
'set the element from html'
,
->
@
problem999
=
new
Problem
(
"
@
problem999
=
new
Problem
(
"
<section class='xmodule_display xmodule_CapaModule' data-type='Problem'>
<section class='xmodule_display xmodule_CapaModule' data-type='Problem'>
<section id='problem_999'
<section id='problem_999'
class='problems-wrapper'
class='problems-wrapper'
data-problem-id='i4x://edX/999/problem/Quiz'
data-problem-id='i4x://edX/999/problem/Quiz'
data-url='/problem/quiz/'>
data-url='/problem/quiz/'>
</section>
</section>
</section>
</section>
"
)
"
)
expect
(
@
problem999
.
element_id
).
toBe
'problem_999'
expect
(
@
problem999
.
element_id
).
toBe
'problem_999'
it
'set the element from loadFixtures'
,
->
it
'set the element from loadFixtures'
,
->
...
@@ -62,7 +62,7 @@ describe 'Problem', ->
...
@@ -62,7 +62,7 @@ describe 'Problem', ->
expect
(
$
(
'section.action input.reset'
)).
toHandleWith
'click'
,
@
problem
.
reset
expect
(
$
(
'section.action input.reset'
)).
toHandleWith
'click'
,
@
problem
.
reset
it
'bind the show button'
,
->
it
'bind the show button'
,
->
expect
(
$
(
'section.action
input
.show'
)).
toHandleWith
'click'
,
@
problem
.
show
expect
(
$
(
'section.action
button
.show'
)).
toHandleWith
'click'
,
@
problem
.
show
it
'bind the save button'
,
->
it
'bind the save button'
,
->
expect
(
$
(
'section.action input.save'
)).
toHandleWith
'click'
,
@
problem
.
save
expect
(
$
(
'section.action input.save'
)).
toHandleWith
'click'
,
@
problem
.
save
...
@@ -126,14 +126,14 @@ describe 'Problem', ->
...
@@ -126,14 +126,14 @@ describe 'Problem', ->
describe
'when the response is correct'
,
->
describe
'when the response is correct'
,
->
it
'call render with returned content'
,
->
it
'call render with returned content'
,
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
answers
,
callback
)
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
answers
,
callback
)
->
callback
(
success
:
'correct'
,
contents
:
'Correct!'
)
callback
(
success
:
'correct'
,
contents
:
'Correct!'
)
@
problem
.
check
()
@
problem
.
check
()
expect
(
@
problem
.
el
.
html
()).
toEqual
'Correct!'
expect
(
@
problem
.
el
.
html
()).
toEqual
'Correct!'
describe
'when the response is incorrect'
,
->
describe
'when the response is incorrect'
,
->
it
'call render with returned content'
,
->
it
'call render with returned content'
,
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
answers
,
callback
)
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
answers
,
callback
)
->
callback
(
success
:
'incorrect'
,
contents
:
'Incorrect!'
)
callback
(
success
:
'incorrect'
,
contents
:
'Incorrect!'
)
@
problem
.
check
()
@
problem
.
check
()
expect
(
@
problem
.
el
.
html
()).
toEqual
'Incorrect!'
expect
(
@
problem
.
el
.
html
()).
toEqual
'Incorrect!'
...
@@ -159,7 +159,7 @@ describe 'Problem', ->
...
@@ -159,7 +159,7 @@ describe 'Problem', ->
it
'POST to the problem reset page'
,
->
it
'POST to the problem reset page'
,
->
spyOn
$
,
'postWithPrefix'
spyOn
$
,
'postWithPrefix'
@
problem
.
reset
()
@
problem
.
reset
()
expect
(
$
.
postWithPrefix
).
toHaveBeenCalledWith
'/problem/Problem1/problem_reset'
,
expect
(
$
.
postWithPrefix
).
toHaveBeenCalledWith
'/problem/Problem1/problem_reset'
,
{
id
:
'i4x://edX/101/problem/Problem1'
},
jasmine
.
any
(
Function
)
{
id
:
'i4x://edX/101/problem/Problem1'
},
jasmine
.
any
(
Function
)
it
'render the returned content'
,
->
it
'render the returned content'
,
->
...
@@ -179,7 +179,7 @@ describe 'Problem', ->
...
@@ -179,7 +179,7 @@ describe 'Problem', ->
it
'log the problem_show event'
,
->
it
'log the problem_show event'
,
->
@
problem
.
show
()
@
problem
.
show
()
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'problem_show'
,
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'problem_show'
,
problem
:
'i4x://edX/101/problem/Problem1'
problem
:
'i4x://edX/101/problem/Problem1'
it
'fetch the answers'
,
->
it
'fetch the answers'
,
->
...
@@ -198,7 +198,7 @@ describe 'Problem', ->
...
@@ -198,7 +198,7 @@ describe 'Problem', ->
it
'toggle the show answer button'
,
->
it
'toggle the show answer button'
,
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
@
problem
.
show
()
@
problem
.
show
()
expect
(
$
(
'.show
'
)).
toHaveValue
'Hide Answer
'
expect
(
$
(
'.show
.show-label'
)).
toHaveText
'Hide Answer(s)
'
it
'add the showed class to element'
,
->
it
'add the showed class to element'
,
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
...
@@ -223,7 +223,7 @@ describe 'Problem', ->
...
@@ -223,7 +223,7 @@ describe 'Problem', ->
expect
(
$
(
'label[for="input_1_1_3"]'
)).
toHaveAttr
'correct_answer'
,
'true'
expect
(
$
(
'label[for="input_1_1_3"]'
)).
toHaveAttr
'correct_answer'
,
'true'
expect
(
$
(
'label[for="input_1_2_1"]'
)).
not
.
toHaveAttr
'correct_answer'
,
'true'
expect
(
$
(
'label[for="input_1_2_1"]'
)).
not
.
toHaveAttr
'correct_answer'
,
'true'
describe
'when the answers are alreay shown'
,
->
describe
'when the answers are alrea
d
y shown'
,
->
beforeEach
->
beforeEach
->
@
problem
.
el
.
addClass
'showed'
@
problem
.
el
.
addClass
'showed'
@
problem
.
el
.
prepend
'''
@
problem
.
el
.
prepend
'''
...
@@ -243,7 +243,7 @@ describe 'Problem', ->
...
@@ -243,7 +243,7 @@ describe 'Problem', ->
it
'toggle the show answer button'
,
->
it
'toggle the show answer button'
,
->
@
problem
.
show
()
@
problem
.
show
()
expect
(
$
(
'.show
'
)).
toHaveValue
'Show Answer
'
expect
(
$
(
'.show
.show-label'
)).
toHaveText
'Show Answer(s)
'
it
'remove the showed class from element'
,
->
it
'remove the showed class from element'
,
->
@
problem
.
show
()
@
problem
.
show
()
...
@@ -261,7 +261,7 @@ describe 'Problem', ->
...
@@ -261,7 +261,7 @@ describe 'Problem', ->
it
'POST to save problem'
,
->
it
'POST to save problem'
,
->
spyOn
$
,
'postWithPrefix'
spyOn
$
,
'postWithPrefix'
@
problem
.
save
()
@
problem
.
save
()
expect
(
$
.
postWithPrefix
).
toHaveBeenCalledWith
'/problem/Problem1/problem_save'
,
expect
(
$
.
postWithPrefix
).
toHaveBeenCalledWith
'/problem/Problem1/problem_save'
,
'foo=1&bar=2'
,
jasmine
.
any
(
Function
)
'foo=1&bar=2'
,
jasmine
.
any
(
Function
)
# TODO: figure out why failing
# TODO: figure out why failing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment