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
dabef856
Commit
dabef856
authored
Sep 18, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Jasmine tests.
Problem with hideControls not being called via setTimeout().
parent
a14aa6bc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
3 deletions
+86
-3
common/lib/xmodule/xmodule/js/fixtures/video.html
+4
-0
common/lib/xmodule/xmodule/js/fixtures/video_all.html
+4
-0
common/lib/xmodule/xmodule/js/fixtures/video_html5.html
+4
-0
common/lib/xmodule/xmodule/js/fixtures/video_no_captions.html
+5
-2
common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html
+4
-0
common/lib/xmodule/xmodule/js/spec/video/video_focus_grabber_spec.js
+62
-0
common/lib/xmodule/xmodule/js/src/video/025_focus_grabber.js
+3
-1
No files found.
common/lib/xmodule/xmodule/js/fixtures/video.html
View file @
dabef856
...
...
@@ -13,6 +13,8 @@
data-yt-test-timeout=
"1500"
data-yt-test-url=
"https://gdata.youtube.com/feeds/api/videos/"
>
<div
class=
"focus_grabber first"
></div>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<div
class=
"video-player-pre"
></div>
...
...
@@ -51,6 +53,8 @@
<ol
class=
"subtitles"
><li></li></ol>
</div>
<div
class=
"focus_grabber last"
></div>
</div>
</div>
</div>
...
...
common/lib/xmodule/xmodule/js/fixtures/video_all.html
View file @
dabef856
...
...
@@ -16,6 +16,8 @@
data-yt-test-timeout=
"1500"
data-yt-test-url=
"https://gdata.youtube.com/feeds/api/videos/"
>
<div
class=
"focus_grabber first"
></div>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<div
class=
"video-player-pre"
></div>
...
...
@@ -54,6 +56,8 @@
<ol
class=
"subtitles"
><li></li></ol>
</div>
<div
class=
"focus_grabber last"
></div>
</div>
</div>
</div>
...
...
common/lib/xmodule/xmodule/js/fixtures/video_html5.html
View file @
dabef856
...
...
@@ -16,6 +16,8 @@
data-yt-test-timeout=
"1500"
data-yt-test-url=
"https://gdata.youtube.com/feeds/api/videos/"
>
<div
class=
"focus_grabber first"
></div>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<section
class=
"video-player"
>
...
...
@@ -26,6 +28,8 @@
<ol
class=
"subtitles"
><li></li></ol>
</div>
<div
class=
"focus_grabber last"
></div>
</div>
</div>
</div>
...
...
common/lib/xmodule/xmodule/js/fixtures/video_no_captions.html
View file @
dabef856
...
...
@@ -13,6 +13,8 @@
data-yt-test-timeout=
"1500"
data-yt-test-url=
"https://gdata.youtube.com/feeds/api/videos/"
>
<div
class=
"focus_grabber first"
></div>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<section
class=
"video-player"
>
...
...
@@ -21,7 +23,9 @@
<section
class=
"video-controls"
></section>
</article>
</div>
<div
class=
"focus_grabber last"
></div>
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html
View file @
dabef856
...
...
@@ -13,6 +13,8 @@
data-yt-test-timeout=
"1500"
data-yt-test-url=
"https://gdata.youtube.com/feeds/api/videos/"
>
<div
class=
"focus_grabber first"
></div>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<div
class=
"video-player-pre"
></div>
...
...
@@ -51,6 +53,8 @@
<ol
class=
"subtitles"
><li></li></ol>
</div>
<div
class=
"focus_grabber last"
></div>
</div>
</div>
</div>
...
...
common/lib/xmodule/xmodule/js/spec/video/video_focus_grabber_spec.js
0 → 100644
View file @
dabef856
(
function
()
{
describe
(
'Video FocusGrabber'
,
function
()
{
var
state
;
beforeEach
(
function
()
{
loadFixtures
(
'video_html5.html'
);
state
=
new
Video
(
'#example'
);
spyOnEvent
(
state
.
el
,
'mousemove'
);
spyOn
(
state
.
focusGrabber
,
'disableFocusGrabber'
).
andCallThrough
();
spyOn
(
state
.
focusGrabber
,
'enableFocusGrabber'
).
andCallThrough
();
});
it
(
'check existence of focus grabber elements and their position'
,
function
()
{
var
firstFGEl
=
state
.
el
.
find
(
'.focus_grabber.first'
),
lastFGEl
=
state
.
el
.
find
(
'.focus_grabber.last'
),
tcWrapperEl
=
state
.
el
.
find
(
'.tc-wrapper'
);
// Existence check.
expect
(
firstFGEl
.
length
).
toBe
(
1
);
expect
(
lastFGEl
.
length
).
toBe
(
1
);
// Position check.
expect
(
firstFGEl
.
index
()
+
1
).
toBe
(
tcWrapperEl
.
index
());
expect
(
lastFGEl
.
index
()
-
1
).
toBe
(
tcWrapperEl
.
index
());
});
it
(
'from the start, focus grabbers are disabled'
,
function
()
{
expect
(
state
.
focusGrabber
.
elFirst
.
attr
(
'tabindex'
)).
toBe
(
-
1
);
expect
(
state
.
focusGrabber
.
elLast
.
attr
(
'tabindex'
)).
toBe
(
-
1
);
});
it
(
'when first focus grabber is focused "mousemove" event is triggered, grabbers are disabled'
,
function
()
{
state
.
focusGrabber
.
elFirst
.
focus
();
expect
(
'mousemove'
).
toHaveBeenTriggeredOn
(
state
.
el
);
expect
(
state
.
focusGrabber
.
disableFocusGrabber
).
toHaveBeenCalled
();
});
it
(
'when last focus grabber is focused "mousemove" event is triggered, grabbers are disabled'
,
function
()
{
state
.
focusGrabber
.
elLast
.
focus
();
expect
(
'mousemove'
).
toHaveBeenTriggeredOn
(
state
.
el
);
expect
(
state
.
focusGrabber
.
disableFocusGrabber
).
toHaveBeenCalled
();
});
it
(
'after controls autohide focus grabbers are enabled'
,
function
()
{
runs
(
function
()
{
console
.
log
(
'focus 1: a'
);
state
.
videoCaption
.
hideCaptions
(
true
);
state
.
el
.
trigger
(
'mousemove'
);
console
.
log
(
'focus 1: b'
);
});
waits
(
2
*
(
state
.
videoControl
.
fadeOutTimeout
+
100
));
runs
(
function
()
{
expect
(
state
.
focusGrabber
.
enableFocusGrabber
).
toHaveBeenCalled
();
});
});
});
}).
call
(
this
);
common/lib/xmodule/xmodule/js/src/video/025_focus_grabber.js
View file @
dabef856
...
...
@@ -44,8 +44,10 @@ function () {
// Private functions.
function
_makeFunctionsPublic
(
state
)
{
state
.
focusGrabber
.
enableFocusGrabber
=
_
.
bind
(
enableFocusGrabber
,
state
);
state
.
focusGrabber
.
enableFocusGrabber
=
_
.
bind
(
enableFocusGrabber
,
state
);
state
.
focusGrabber
.
disableFocusGrabber
=
_
.
bind
(
disableFocusGrabber
,
state
);
state
.
focusGrabber
.
onFocus
=
_
.
bind
(
onFocus
,
state
);
}
function
_renderElements
(
state
)
{
...
...
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