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
1cd932c9
Commit
1cd932c9
authored
Mar 31, 2014
by
Dave St.Germain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes LMS-2474 by ensuring that readElts reads always reads an element
parent
8708c37a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
7 deletions
+31
-7
common/lib/xmodule/xmodule/js/js_test.yml
+1
-0
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
+28
-4
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+1
-0
common/static/js/src/accessibility_tools.js
+1
-3
No files found.
common/lib/xmodule/xmodule/js/js_test.yml
View file @
1cd932c9
...
...
@@ -58,6 +58,7 @@ lib_paths:
-
common_static/js/test/add_ajax_prefix.js
-
common_static/js/src/utility.js
-
public/js/split_test_staff.js
-
common_static/js/src/accessibility_tools.js
# Paths to spec (test) JavaScript files
spec_paths
:
...
...
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
View file @
1cd932c9
...
...
@@ -7,10 +7,8 @@ describe 'Problem', ->
@
stubbedJax
=
root
:
jasmine
.
createSpyObj
(
'jax.root'
,
[
'toMathML'
])
MathJax
.
Hub
.
getAllJax
.
andReturn
[
@
stubbedJax
]
window
.
update_schematics
=
->
# mock the screen reader alert
window
.
SR
=
readElts
:
`
function
(){}
`
readText
:
`
function
(){}
`
spyOn
SR
,
'readElts'
spyOn
SR
,
'readText'
# Load this function from spec/helper.coffee
# Note that if your test fails with a message like:
...
...
@@ -168,6 +166,7 @@ describe 'Problem', ->
callback
(
success
:
'correct'
,
contents
:
'Correct!'
)
@
problem
.
check
()
expect
(
@
problem
.
el
.
html
()).
toEqual
'Correct!'
expect
(
window
.
SR
.
readElts
).
toHaveBeenCalled
()
describe
'when the response is incorrect'
,
->
it
'call render with returned content'
,
->
...
...
@@ -175,6 +174,7 @@ describe 'Problem', ->
callback
(
success
:
'incorrect'
,
contents
:
'Incorrect!'
)
@
problem
.
check
()
expect
(
@
problem
.
el
.
html
()).
toEqual
'Incorrect!'
expect
(
window
.
SR
.
readElts
).
toHaveBeenCalled
()
# TODO: figure out why failing
xdescribe
'when the response is undetermined'
,
->
...
...
@@ -237,12 +237,25 @@ describe 'Problem', ->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
@
problem
.
show
()
expect
(
$
(
'.show .show-label'
)).
toHaveText
'Hide Answer'
expect
(
window
.
SR
.
readElts
).
toHaveBeenCalled
()
it
'add the showed class to element'
,
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
{})
@
problem
.
show
()
expect
(
@
problem
.
el
).
toHaveClass
'showed'
it
'reads the answers'
,
->
runs
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
callback
)
->
callback
(
answers
:
'answers'
)
@
problem
.
show
()
waitsFor
(
->
return
jQuery
.
active
==
0
),
"jQuery requests finished"
,
1000
runs
->
expect
(
window
.
SR
.
readElts
).
toHaveBeenCalled
()
describe
'multiple choice question'
,
->
beforeEach
->
@
problem
.
el
.
prepend
'''
...
...
@@ -487,6 +500,17 @@ describe 'Problem', ->
expect
(
$
.
postWithPrefix
).
toHaveBeenCalledWith
'/problem/Problem1/problem_save'
,
'foo=1&bar=2'
,
jasmine
.
any
(
Function
)
it
'reads the save message'
,
->
runs
->
spyOn
(
$
,
'postWithPrefix'
).
andCallFake
(
url
,
answers
,
callback
)
->
callback
(
success
:
'OK'
)
@
problem
.
save
()
waitsFor
(
->
return
jQuery
.
active
==
0
),
"jQuery requests finished"
,
1000
runs
->
expect
(
window
.
SR
.
readElts
).
toHaveBeenCalled
()
# TODO: figure out why failing
xit
'alert to the user'
,
->
spyOn
window
,
'alert'
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
1cd932c9
...
...
@@ -366,6 +366,7 @@ class @Problem
alert_elem
=
"<div class='capa_alert'>"
+
msg
+
"</div>"
@
el
.
find
(
'.action'
).
after
(
alert_elem
)
@
el
.
find
(
'.capa_alert'
).
css
(
opacity
:
0
).
animate
(
opacity
:
1
,
700
)
window
.
SR
.
readElts
@
el
.
find
(
'.capa_alert'
)
save
:
=>
if
not
@
check_save_waitfor
(
@
save_internal
)
...
...
common/static/js/src/accessibility_tools.js
View file @
1cd932c9
...
...
@@ -158,9 +158,7 @@ $(function(){
};
SRAlert
.
prototype
.
readElts
=
function
(
elts
)
{
var
feedback
,
_this
=
this
;
feedback
=
''
;
var
feedback
=
''
;
$
.
each
(
elts
,
function
(
idx
,
value
)
{
return
feedback
+=
'<p>'
+
$
(
value
).
html
()
+
'</p>
\
n'
;
});
...
...
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