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
e381adbc
Commit
e381adbc
authored
Aug 08, 2013
by
Anton Stupak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make js unit tests out of Alpha.
parent
8ba94bb2
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
97 additions
and
121 deletions
+97
-121
common/lib/xmodule/xmodule/js/fixtures/video.html
+38
-5
common/lib/xmodule/xmodule/js/fixtures/video_all.html
+0
-0
common/lib/xmodule/xmodule/js/fixtures/video_html5.html
+0
-0
common/lib/xmodule/xmodule/js/fixtures/video_no_captions.html
+0
-0
common/lib/xmodule/xmodule/js/fixtures/videoalpha.html
+0
-56
common/lib/xmodule/xmodule/js/spec/.gitignore
+2
-2
common/lib/xmodule/xmodule/js/spec/helper.coffee
+5
-6
common/lib/xmodule/xmodule/js/spec/video/general_spec.js
+22
-22
common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
+3
-3
common/lib/xmodule/xmodule/js/spec/video/readme.md
+0
-0
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
+5
-5
common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js
+3
-3
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+6
-6
common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
+4
-4
common/lib/xmodule/xmodule/js/spec/video/video_quality_control_spec.js
+3
-3
common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js
+3
-3
common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js
+3
-3
No files found.
common/lib/xmodule/xmodule/js/fixtures/video.html
View file @
e381adbc
<div
class=
"course-content"
>
<div
id=
"video_example"
>
<div
id=
"example"
>
<div
id=
"video_id"
class=
"video"
data-youtube-id-0-75=
"7tqY6eQzVhE"
data-youtube-id-1-0=
"cogebirgzzM"
<div
id=
"video_id"
class=
"video"
data-streams=
"0.75:7tqY6eQzVhE,1.0:cogebirgzzM"
data-show-captions=
"true"
data-start=
""
data-end=
""
data-caption-asset-path=
"/static/subs/"
>
data-caption-asset-path=
"/static/subs/"
data-autoplay=
"False"
>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<div
class=
"video-player-pre"
></div>
<section
class=
"video-player"
>
<div
id=
"id"
></div>
</section>
<section
class=
"video-controls"
></section>
<div
class=
"video-player-post"
></div>
<section
class=
"video-controls"
>
<div
class=
"slider"
></div>
<div>
<ul
class=
"vcr"
>
<li><a
class=
"video_control"
href=
"#"
title=
"Play"
></a></li>
<li><div
class=
"vidtime"
>
0:00 / 0:00
</div></li>
</ul>
<div
class=
"secondary-controls"
>
<div
class=
"speeds"
>
<a
href=
"#"
>
<h3>
Speed
</h3>
<p
class=
"active"
></p>
</a>
<ol
class=
"video_speeds"
></ol>
</div>
<div
class=
"volume"
>
<a
href=
"#"
></a>
<div
class=
"volume-slider-container"
>
<div
class=
"volume-slider"
></div>
</div>
</div>
<a
href=
"#"
class=
"add-fullscreen"
title=
"Fill browser"
>
Fill Browser
</a>
<a
href=
"#"
class=
"quality_control"
title=
"HD"
>
HD
</a>
<a
href=
"#"
class=
"hide-subtitles"
title=
"Turn off captions"
>
Captions
</a>
</div>
</div>
</section>
</article>
<ol
class=
"subtitles"
><li></li></ol>
</div>
</div>
</div>
...
...
common/lib/xmodule/xmodule/js/fixtures/video
alpha
_all.html
→
common/lib/xmodule/xmodule/js/fixtures/video_all.html
View file @
e381adbc
File moved
common/lib/xmodule/xmodule/js/fixtures/video
alpha
_html5.html
→
common/lib/xmodule/xmodule/js/fixtures/video_html5.html
View file @
e381adbc
File moved
common/lib/xmodule/xmodule/js/fixtures/video
alpha
_no_captions.html
→
common/lib/xmodule/xmodule/js/fixtures/video_no_captions.html
View file @
e381adbc
File moved
common/lib/xmodule/xmodule/js/fixtures/videoalpha.html
deleted
100644 → 0
View file @
8ba94bb2
<div
class=
"course-content"
>
<div
id=
"video_example"
>
<div
id=
"example"
>
<div
id=
"video_id"
class=
"videoalpha"
data-streams=
"0.75:7tqY6eQzVhE,1.0:cogebirgzzM"
data-show-captions=
"true"
data-start=
""
data-end=
""
data-caption-asset-path=
"/static/subs/"
data-autoplay=
"False"
>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<div
class=
"video-player-pre"
></div>
<section
class=
"video-player"
>
<div
id=
"id"
></div>
</section>
<div
class=
"video-player-post"
></div>
<section
class=
"video-controls"
>
<div
class=
"slider"
></div>
<div>
<ul
class=
"vcr"
>
<li><a
class=
"video_control"
href=
"#"
title=
"Play"
></a></li>
<li><div
class=
"vidtime"
>
0:00 / 0:00
</div></li>
</ul>
<div
class=
"secondary-controls"
>
<div
class=
"speeds"
>
<a
href=
"#"
>
<h3>
Speed
</h3>
<p
class=
"active"
></p>
</a>
<ol
class=
"video_speeds"
></ol>
</div>
<div
class=
"volume"
>
<a
href=
"#"
></a>
<div
class=
"volume-slider-container"
>
<div
class=
"volume-slider"
></div>
</div>
</div>
<a
href=
"#"
class=
"add-fullscreen"
title=
"Fill browser"
>
Fill Browser
</a>
<a
href=
"#"
class=
"quality_control"
title=
"HD"
>
HD
</a>
<a
href=
"#"
class=
"hide-subtitles"
title=
"Turn off captions"
>
Captions
</a>
</div>
</div>
</section>
</article>
<ol
class=
"subtitles"
><li></li></ol>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
common/lib/xmodule/xmodule/js/spec/.gitignore
View file @
e381adbc
*.js
# Tests for video
alpha
are written in pure JavaScript.
!video
alpha
/*.js
# Tests for video are written in pure JavaScript.
!video/*.js
common/lib/xmodule/xmodule/js/spec/helper.coffee
View file @
e381adbc
...
...
@@ -111,19 +111,18 @@ jasmine.stubYoutubePlayer = ->
obj
[
'getAvailablePlaybackRates'
]
=
jasmine
.
createSpy
(
'getAvailablePlaybackRates'
).
andReturn
[
0.75
,
1.0
,
1.25
,
1.5
]
obj
jasmine
.
stubVideoPlayerAlpha
=
(
context
,
enableParts
,
html5
=
false
)
->
console
.
log
(
'stubVideoPlayerAlpha called'
)
jasmine
.
stubVideoPlayer
=
(
context
,
enableParts
,
html5
=
false
)
->
suite
=
context
.
suite
currentPartName
=
suite
.
description
while
suite
=
suite
.
parentSuite
if
html5
==
false
loadFixtures
'video
alpha
.html'
loadFixtures
'video.html'
else
loadFixtures
'video
alpha
_html5.html'
loadFixtures
'video_html5.html'
jasmine
.
stubRequests
()
YT
.
Player
=
undefined
window
.
OldVideoPlayer
Alpha
=
undefined
window
.
OldVideoPlayer
=
undefined
jasmine
.
stubYoutubePlayer
()
return
new
Video
Alpha
'#example'
,
'.75:7tqY6eQzVhE,1.0:cogebirgzzM'
return
new
Video
'#example'
,
'.75:7tqY6eQzVhE,1.0:cogebirgzzM'
# Stub jQuery.cookie
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/general_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/general_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'Video
Alpha
'
,
function
()
{
xdescribe
(
'Video'
,
function
()
{
var
oldOTBD
;
beforeEach
(
function
()
{
...
...
@@ -12,7 +12,7 @@
});
afterEach
(
function
()
{
window
.
OldVideoPlayer
Alpha
=
undefined
;
window
.
OldVideoPlayer
=
undefined
;
window
.
onYouTubePlayerAPIReady
=
undefined
;
window
.
onHTML5PlayerAPIReady
=
undefined
;
$
(
'source'
).
remove
();
...
...
@@ -22,13 +22,13 @@
describe
(
'constructor'
,
function
()
{
describe
(
'YT'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
.html'
);
loadFixtures
(
'video.html'
);
$
.
cookie
.
andReturn
(
'0.75'
);
});
describe
(
'by default'
,
function
()
{
beforeEach
(
function
()
{
this
.
state
=
new
window
.
Video
Alpha
(
'#example'
);
this
.
state
=
new
window
.
Video
(
'#example'
);
});
it
(
'check videoType'
,
function
()
{
...
...
@@ -36,7 +36,7 @@
});
it
(
'reset the current video player'
,
function
()
{
expect
(
window
.
OldVideoPlayer
Alpha
).
toBeUndefined
();
expect
(
window
.
OldVideoPlayer
).
toBeUndefined
();
});
it
(
'set the elements'
,
function
()
{
...
...
@@ -64,14 +64,14 @@
var
state
;
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
_html5.html'
);
this
.
stubVideoPlayer
Alpha
=
jasmine
.
createSpy
(
'VideoPlayerAlpha
'
);
loadFixtures
(
'video_html5.html'
);
this
.
stubVideoPlayer
=
jasmine
.
createSpy
(
'VideoPlayer
'
);
$
.
cookie
.
andReturn
(
'0.75'
);
});
describe
(
'by default'
,
function
()
{
beforeEach
(
function
()
{
state
=
new
window
.
Video
Alpha
(
'#example'
);
state
=
new
window
.
Video
(
'#example'
);
});
afterEach
(
function
()
{
...
...
@@ -83,7 +83,7 @@
});
it
(
'reset the current video player'
,
function
()
{
expect
(
window
.
OldVideoPlayer
Alpha
).
toBeUndefined
();
expect
(
window
.
OldVideoPlayer
).
toBeUndefined
();
});
it
(
'set the elements'
,
function
()
{
...
...
@@ -104,8 +104,8 @@
it
(
'parse the videos if subtitles do not exist'
,
function
()
{
var
sub
=
''
;
$
(
'#example'
).
find
(
'.video
alpha
'
).
data
(
'sub'
,
''
);
state
=
new
window
.
Video
Alpha
(
'#example'
);
$
(
'#example'
).
find
(
'.video'
).
data
(
'sub'
,
''
);
state
=
new
window
.
Video
(
'#example'
);
expect
(
state
.
videos
).
toEqual
({
'0.75'
:
sub
,
...
...
@@ -142,7 +142,7 @@
// is required.
describe
(
'HTML5 API is available'
,
function
()
{
beforeEach
(
function
()
{
state
=
new
Video
Alpha
(
'#example'
);
state
=
new
Video
(
'#example'
);
});
afterEach
(
function
()
{
...
...
@@ -158,9 +158,9 @@
describe
(
'youtubeId'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
.html'
);
loadFixtures
(
'video.html'
);
$
.
cookie
.
andReturn
(
'1.0'
);
state
=
new
Video
Alpha
(
'#example'
);
state
=
new
Video
(
'#example'
);
});
describe
(
'with speed'
,
function
()
{
...
...
@@ -180,8 +180,8 @@
describe
(
'setSpeed'
,
function
()
{
describe
(
'YT'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video.html'
);
state
=
new
Video
(
'#example'
);
});
describe
(
'when new speed is available'
,
function
()
{
...
...
@@ -214,8 +214,8 @@
describe
(
'HTML5'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
_html5.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_html5.html'
);
state
=
new
Video
(
'#example'
);
});
describe
(
'when new speed is available'
,
function
()
{
...
...
@@ -249,8 +249,8 @@
describe
(
'getDuration'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video.html'
);
state
=
new
Video
(
'#example'
);
});
it
(
'return duration for current video'
,
function
()
{
...
...
@@ -260,8 +260,8 @@
describe
(
'log'
,
function
()
{
beforeEach
(
function
()
{
loadFixtures
(
'video
alpha
_html5.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_html5.html'
);
state
=
new
Video
(
'#example'
);
spyOn
(
Logger
,
'log'
);
state
.
videoPlayer
.
log
(
'someEvent'
,
{
currentTime
:
25
,
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/html5_video_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'Video
Alpha
HTML5Video'
,
function
()
{
xdescribe
(
'Video HTML5Video'
,
function
()
{
var
state
,
player
,
oldOTBD
,
playbackRates
=
[
0.75
,
1.0
,
1.25
,
1.5
];
function
initialize
()
{
loadFixtures
(
'video
alpha
_html5.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_html5.html'
);
state
=
new
Video
(
'#example'
);
player
=
state
.
videoPlayer
.
player
;
}
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/readme.md
→
common/lib/xmodule/xmodule/js/spec/video/readme.md
View file @
e381adbc
File moved
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_caption_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoCaption
Alpha
'
,
function
()
{
xdescribe
(
'VideoCaption'
,
function
()
{
var
state
,
videoPlayer
,
videoCaption
,
videoSpeedControl
,
oldOTBD
;
function
initialize
()
{
loadFixtures
(
'video
alpha
_all.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_all.html'
);
state
=
new
Video
(
'#example'
);
videoPlayer
=
state
.
videoPlayer
;
videoCaption
=
state
.
videoCaption
;
videoSpeedControl
=
state
.
videoSpeedControl
;
...
...
@@ -33,11 +33,11 @@
});
it
(
'create the caption element'
,
function
()
{
expect
(
$
(
'.video
alpha
'
)).
toContain
(
'ol.subtitles'
);
expect
(
$
(
'.video'
)).
toContain
(
'ol.subtitles'
);
});
it
(
'add caption control to video player'
,
function
()
{
expect
(
$
(
'.video
alpha
'
)).
toContain
(
'a.hide-subtitles'
);
expect
(
$
(
'.video'
)).
toContain
(
'a.hide-subtitles'
);
});
it
(
'fetch the caption'
,
function
()
{
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_control_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoControl
Alpha
'
,
function
()
{
xdescribe
(
'VideoControl'
,
function
()
{
var
state
,
videoControl
,
oldOTBD
;
function
initialize
()
{
loadFixtures
(
'video
alpha
_all.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_all.html'
);
state
=
new
Video
(
'#example'
);
videoControl
=
state
.
videoControl
;
}
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_player_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoPlayer
Alpha
'
,
function
()
{
xdescribe
(
'VideoPlayer'
,
function
()
{
var
state
,
videoPlayer
,
player
,
videoControl
,
videoCaption
,
videoProgressSlider
,
videoSpeedControl
,
videoVolumeControl
,
oldOTBD
;
function
initialize
(
fixture
)
{
if
(
typeof
fixture
===
'undefined'
)
{
loadFixtures
(
'video
alpha
_all.html'
);
loadFixtures
(
'video_all.html'
);
}
else
{
loadFixtures
(
fixture
);
}
state
=
new
Video
Alpha
(
'#example'
);
state
=
new
Video
(
'#example'
);
videoPlayer
=
state
.
videoPlayer
;
player
=
videoPlayer
.
player
;
videoControl
=
state
.
videoControl
;
...
...
@@ -20,7 +20,7 @@
}
function
initializeYouTube
()
{
initialize
(
'video
alpha
.html'
);
initialize
(
'video.html'
);
}
beforeEach
(
function
()
{
...
...
@@ -71,9 +71,9 @@
expect
(
videoProgressSlider
.
el
).
toHaveClass
(
'slider'
);
});
// All the toHandleWith() expect tests are not necessary for this version of Video
Alpha
.
// All the toHandleWith() expect tests are not necessary for this version of Video.
// jQuery event system is not used to trigger and invoke methods. This is an artifact from
// previous version of Video
Alpha
.
// previous version of Video.
});
it
(
'create Youtube player'
,
function
()
{
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_progress_slider_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoProgressSlider
Alpha
'
,
function
()
{
xdescribe
(
'VideoProgressSlider'
,
function
()
{
var
state
,
videoPlayer
,
videoProgressSlider
,
oldOTBD
;
function
initialize
()
{
loadFixtures
(
'video
alpha
_all.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_all.html'
);
state
=
new
Video
(
'#example'
);
videoPlayer
=
state
.
videoPlayer
;
videoProgressSlider
=
state
.
videoProgressSlider
;
}
...
...
@@ -53,7 +53,7 @@
expect
(
videoProgressSlider
.
slider
).
toBeUndefined
();
// We can't expect $.fn.slider not to have been called,
// because sliders are used in other parts of Video
Alpha
.
// because sliders are used in other parts of Video.
});
});
});
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_quality_control_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_quality_control_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoQualityControl
Alpha
'
,
function
()
{
xdescribe
(
'VideoQualityControl'
,
function
()
{
var
state
,
videoControl
,
videoQualityControl
,
oldOTBD
;
function
initialize
()
{
loadFixtures
(
'video
alpha
.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video.html'
);
state
=
new
Video
(
'#example'
);
videoControl
=
state
.
videoControl
;
videoQualityControl
=
state
.
videoQualityControl
;
}
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_speed_control_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoSpeedControl
Alpha
'
,
function
()
{
xdescribe
(
'VideoSpeedControl'
,
function
()
{
var
state
,
videoPlayer
,
videoControl
,
videoSpeedControl
;
function
initialize
()
{
loadFixtures
(
'video
alpha
_all.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_all.html'
);
state
=
new
Video
(
'#example'
);
videoPlayer
=
state
.
videoPlayer
;
videoControl
=
state
.
videoControl
;
videoSpeedControl
=
state
.
videoSpeedControl
;
...
...
common/lib/xmodule/xmodule/js/spec/video
alpha
/video_volume_control_spec.js
→
common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js
View file @
e381adbc
(
function
()
{
xdescribe
(
'VideoVolumeControl
Alpha
'
,
function
()
{
xdescribe
(
'VideoVolumeControl'
,
function
()
{
var
state
,
videoControl
,
videoVolumeControl
,
oldOTBD
;
function
initialize
()
{
loadFixtures
(
'video
alpha
_all.html'
);
state
=
new
Video
Alpha
(
'#example'
);
loadFixtures
(
'video_all.html'
);
state
=
new
Video
(
'#example'
);
videoControl
=
state
.
videoControl
;
videoVolumeControl
=
state
.
videoVolumeControl
;
}
...
...
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