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
2fb6c02b
Commit
2fb6c02b
authored
Sep 18, 2013
by
jmclaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for tabbing through captions
parent
5ccf717d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
2 deletions
+108
-2
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
+108
-2
No files found.
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
View file @
2fb6c02b
...
@@ -93,6 +93,7 @@
...
@@ -93,6 +93,7 @@
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
expect
(
$
(
link
)).
toHaveData
(
'index'
,
index
);
expect
(
$
(
link
)).
toHaveData
(
'index'
,
index
);
expect
(
$
(
link
)).
toHaveData
(
'start'
,
captionsData
.
start
[
index
]);
expect
(
$
(
link
)).
toHaveData
(
'start'
,
captionsData
.
start
[
index
]);
expect
(
$
(
link
)).
toHaveData
(
'tabindex'
,
0
);
expect
(
$
(
link
)).
toHaveText
(
captionsData
.
text
[
index
]);
expect
(
$
(
link
)).
toHaveText
(
captionsData
.
text
[
index
]);
});
});
});
});
...
@@ -104,7 +105,13 @@
...
@@ -104,7 +105,13 @@
it
(
'bind all the caption link'
,
function
()
{
it
(
'bind all the caption link'
,
function
()
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
expect
(
$
(
link
)).
toHandleWith
(
'click'
,
videoCaption
.
seekPlayer
);
expect
(
$
(
link
)).
toHandleWith
(
'mouseenter'
,
videoCaption
.
captionMouseEnterLeave
);
expect
(
$
(
link
)).
toHandleWith
(
'mouseleave'
,
videoCaption
.
captionMouseEnterLeave
);
expect
(
$
(
link
)).
toHandleWith
(
'mousedown'
,
videoCaption
.
captionMouseDown
);
expect
(
$
(
link
)).
toHandleWith
(
'click'
,
videoCaption
.
captionClick
);
expect
(
$
(
link
)).
toHandleWith
(
'focus'
,
videoCaption
.
captionFocus
);
expect
(
$
(
link
)).
toHandleWith
(
'blur'
,
videoCaption
.
captionBlur
);
expect
(
$
(
link
)).
toHandleWith
(
'keydown'
,
videoCaption
.
captionKeyDown
);
});
});
});
});
...
@@ -278,6 +285,7 @@
...
@@ -278,6 +285,7 @@
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
expect
(
$
(
link
)).
toHaveData
(
'index'
,
index
);
expect
(
$
(
link
)).
toHaveData
(
'index'
,
index
);
expect
(
$
(
link
)).
toHaveData
(
'start'
,
captionsData
.
start
[
index
]);
expect
(
$
(
link
)).
toHaveData
(
'start'
,
captionsData
.
start
[
index
]);
expect
(
$
(
link
)).
toHaveData
(
'tabindex'
,
0
);
expect
(
$
(
link
)).
toHaveText
(
captionsData
.
text
[
index
]);
expect
(
$
(
link
)).
toHaveText
(
captionsData
.
text
[
index
]);
});
});
});
});
...
@@ -289,7 +297,13 @@
...
@@ -289,7 +297,13 @@
it
(
'bind all the caption link'
,
function
()
{
it
(
'bind all the caption link'
,
function
()
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
$
(
'.subtitles li[data-index]'
).
each
(
function
(
index
,
link
)
{
expect
(
$
(
link
)).
toHandleWith
(
'click'
,
videoCaption
.
seekPlayer
);
expect
(
$
(
link
)).
toHandleWith
(
'mouseenter'
,
videoCaption
.
captionMouseEnterLeave
);
expect
(
$
(
link
)).
toHandleWith
(
'mouseleave'
,
videoCaption
.
captionMouseEnterLeave
);
expect
(
$
(
link
)).
toHandleWith
(
'mousedown'
,
videoCaption
.
captionMouseDown
);
expect
(
$
(
link
)).
toHandleWith
(
'click'
,
videoCaption
.
captionClick
);
expect
(
$
(
link
)).
toHandleWith
(
'focus'
,
videoCaption
.
captionFocus
);
expect
(
$
(
link
)).
toHandleWith
(
'blur'
,
videoCaption
.
captionBlur
);
expect
(
$
(
link
)).
toHandleWith
(
'keydown'
,
videoCaption
.
captionKeyDown
);
});
});
});
});
...
@@ -558,6 +572,98 @@
...
@@ -558,6 +572,98 @@
});
});
});
});
});
});
describe
(
'caption accessibility'
,
function
()
{
beforeEach
(
function
()
{
initialize
();
});
describe
(
'when getting focus through TAB key'
,
function
()
{
beforeEach
(
function
()
{
$
(
'.subtitles li:first'
).
trigger
(
jQuery
.
Event
(
'focus'
);
});
it
(
'shows an outline around the caption'
,
function
()
{
expect
(
$
(
'.subtitles li:first'
)).
not
.
toHaveClass
(
'unfocused'
);
expect
(
$
(
'.subtitles li:first'
)).
toHaveClass
(
'focused'
);
});
it
(
'has automatic scrolling disabled'
,
function
()
{
expect
(
videoCaption
.
autoScrolling
).
toBe
(
false
));
});
});
describe
(
'when loosing focus through TAB key'
,
function
()
{
beforeEach
(
function
()
{
$
(
'.subtitles li:first'
).
trigger
(
jQuery
.
Event
(
'blur'
);
});
it
(
'does not show an outline around the caption'
,
function
()
{
expect
(
$
(
'.subtitles li:first'
)).
not
.
toHaveClass
(
'focused'
);
expect
(
$
(
'.subtitles li:first'
)).
toHaveClass
(
'unfocused'
);
});
it
(
'has automatic scrolling enabled'
,
function
()
{
expect
(
videoCaption
.
autoScrolling
).
toBe
(
true
));
});
});
describe
(
'when same caption gets the focus through mouse after having
focus through TAB key'
,
function
()
{
beforeEach
(
function
()
{
$
(
'.subtitles li:first'
).
trigger
(
jQuery
.
Event
(
'focus'
);
$
(
'.subtitles li:first'
).
trigger
(
jQuery
.
Event
(
'mouseclick'
);
});
it
(
'does not show an outline around it'
,
function
()
{
expect
(
$
(
'.subtitles li:first'
)).
not
.
toHaveClass
(
'focused'
);
expect
(
$
(
'.subtitles li:first'
)).
toHaveClass
(
'unfocused'
);
});
it
(
'has automatic scrolling enabled'
,
function
()
{
expect
(
videoCaption
.
autoScrolling
).
toBe
(
true
));
});
});
describe
(
'when a second caption gets focus through mouse after first had
focus through TAB key'
,
function
()
{
beforeEach
(
function
()
{
$
(
'.subtitles li:first'
).
trigger
(
jQuery
.
Event
(
'focus'
);
$
(
'.subtitles li:last'
).
trigger
(
jQuery
.
Event
(
'mouseclick'
);
});
it
(
'does not show an outline around the first'
,
function
()
{
expect
(
$
(
'.subtitles li:first'
)).
not
.
toHaveClass
(
'focused'
);
expect
(
$
(
'.subtitles li:first'
)).
toHaveClass
(
'unfocused'
);
});
it
(
'shows an outline around the second'
,
function
()
{
expect
(
$
(
'.subtitles li:last'
)).
not
.
toHaveClass
(
'unfocused'
);
expect
(
$
(
'.subtitles li:last'
)).
toHaveClass
(
'focused'
);
});
it
(
'has automatic scrolling enabled'
,
function
()
{
expect
(
videoCaption
.
autoScrolling
).
toBe
(
true
));
});
});
describe
(
'when enter key is pressed on a caption'
,
function
()
{
beforeEach
(
function
()
{
var
e
=
$
.
Event
(
'keypress'
);
e
.
which
=
13
;
// ENTER key
$
(
'.subtitles li:first'
).
trigger
(
e
);
});
it
(
'shows an outline around it'
,
function
()
{
expect
(
$
(
'.subtitles li:first'
)).
not
.
toHaveClass
(
'unfocused'
);
expect
(
$
(
'.subtitles li:first'
)).
toHaveClass
(
'focused'
);
});
it
(
'calls seekPlayer'
,
function
()
{
expect
(
videoCaption
.
seekPlayer
).
toHaveBeenCalled
();
});
});
});
});
});
}).
call
(
this
);
}).
call
(
this
);
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