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
8144a1df
Commit
8144a1df
authored
Jan 30, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in next_problem jasmine tests
parent
36d8b876
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
common/lib/xmodule/xmodule/js/spec/combinedopenended/display_spec.coffee
+32
-2
No files found.
common/lib/xmodule/xmodule/js/spec/combinedopenended/display_spec.coffee
View file @
8144a1df
...
...
@@ -40,9 +40,8 @@ describe 'CombinedOpenEnded', ->
expect
(
window
.
queuePollerID
).
toBe
(
5
)
it
'polling stops properly'
,
=>
$
.
postWithPrefix
=
jasmine
.
createSpy
(
"$.postWithPrefix"
)
fakeResponseDone
=
state
:
"done"
$
.
postWithPrefix
.
andCallFake
(
url
,
callback
)
->
callback
(
fakeResponseDone
)
spyOn
(
$
,
'postWithPrefix'
)
.
andCallFake
(
url
,
callback
)
->
callback
(
fakeResponseDone
)
@
combined
.
poll
()
expect
(
window
.
queuePollerID
).
toBeUndefined
()
expect
(
window
.
setTimeout
).
not
.
toHaveBeenCalled
()
...
...
@@ -80,3 +79,34 @@ describe 'CombinedOpenEnded', ->
@
combined
.
rebind
()
expect
(
@
combined
.
answer_area
.
attr
(
"disabled"
)).
toBe
(
"disabled"
)
expect
(
@
combined
.
next_problem
).
toHaveBeenCalled
()
describe
'next_problem'
,
->
beforeEach
->
@
combined
=
new
CombinedOpenEnded
@
element
@
combined
.
child_state
=
'done'
it
'handling a successful call'
,
->
fakeResponse
=
success
:
true
html
:
"dummy html"
allow_reset
:
false
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
val
,
callback
)
->
callback
(
fakeResponse
)
spyOn
(
@
combined
,
'reinitialize'
)
spyOn
(
@
combined
,
'rebind'
)
@
combined
.
next_problem
()
expect
(
$
.
postWithPrefix
).
toHaveBeenCalled
()
expect
(
@
combined
.
reinitialize
).
toHaveBeenCalledWith
(
@
combined
.
element
)
expect
(
@
combined
.
rebind
).
toHaveBeenCalled
()
expect
(
@
combined
.
answer_area
.
val
()).
toBe
(
''
)
expect
(
@
combined
.
child_state
).
toBe
(
'initial'
)
it
'handling an unsuccessful call'
,
->
fakeResponse
=
success
:
false
error
:
'This is an error'
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
val
,
callback
)
->
callback
(
fakeResponse
)
@
combined
.
next_problem
()
expect
(
@
combined
.
errors_area
.
html
()).
toBe
(
fakeResponse
.
error
)
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