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
cec1b23d
Commit
cec1b23d
authored
Jun 26, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove mystery guest from the test
parent
0815f349
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
32 deletions
+36
-32
lms/static/coffee/spec/helper.coffee
+7
-7
lms/static/coffee/spec/modules/video/video_player_spec.coffee
+6
-6
lms/static/coffee/spec/modules/video_spec.coffee
+23
-19
No files found.
lms/static/coffee/spec/helper.coffee
View file @
cec1b23d
jasmine
.
getFixtures
().
fixturesPath
=
"/_jasmine/fixtures/"
jasmine
.
stubbedMetadata
=
abc123
:
id
:
'
abc123
'
duration
:
1
00
def456
:
id
:
'
def456
'
slowerSpeedYoutubeId
:
id
:
'
slowerSpeedYoutubeId
'
duration
:
3
00
normalSpeedYoutubeId
:
id
:
'
normalSpeedYoutubeId
'
duration
:
200
bogus
:
duration
:
3
00
duration
:
1
00
jasmine
.
stubbedCaption
=
start
:
[
0
,
10000
,
20000
,
30000
]
...
...
@@ -49,7 +49,7 @@ jasmine.stubVideoPlayer = (context, enableParts, createPlayer=true) ->
loadFixtures
'video.html'
jasmine
.
stubRequests
()
YT
.
Player
=
undefined
context
.
video
=
new
Video
'example'
,
'.75:
abc123,1.0:def456
'
context
.
video
=
new
Video
'example'
,
'.75:
slowerSpeedYoutubeId,1.0:normalSpeedYoutubeId
'
jasmine
.
stubYoutubePlayer
()
if
createPlayer
return
new
VideoPlayer
(
video
:
context
.
video
)
...
...
lms/static/coffee/spec/modules/video/video_player_spec.coffee
View file @
cec1b23d
...
...
@@ -27,7 +27,7 @@ describe 'VideoPlayer', ->
expect
(
window
.
VideoControl
).
toHaveBeenCalledWith
el
:
$
(
'.video-controls'
,
@
player
.
el
)
it
'create video caption'
,
->
expect
(
window
.
VideoCaption
).
toHaveBeenCalledWith
el
:
@
player
.
el
,
youtubeId
:
'
def456
'
,
currentSpeed
:
'1.0'
expect
(
window
.
VideoCaption
).
toHaveBeenCalledWith
el
:
@
player
.
el
,
youtubeId
:
'
normalSpeedYoutubeId
'
,
currentSpeed
:
'1.0'
it
'create video speed control'
,
->
expect
(
window
.
VideoSpeedControl
).
toHaveBeenCalledWith
el
:
$
(
'.secondary-controls'
,
@
player
.
el
),
speeds
:
[
'0.75'
,
'1.0'
],
currentSpeed
:
'1.0'
...
...
@@ -43,7 +43,7 @@ describe 'VideoPlayer', ->
rel
:
0
showinfo
:
0
enablejsapi
:
1
videoId
:
'
def456
'
videoId
:
'
normalSpeedYoutubeId
'
events
:
onReady
:
@
player
.
onReady
onStateChange
:
@
player
.
onStateChange
...
...
@@ -153,7 +153,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PLAYING
it
'log the play_video event'
,
->
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'play_video'
,
id
:
@
player
.
currentTime
,
code
:
'embedCode'
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'play_video'
it
'pause other video player'
,
->
expect
(
@
anotherPlayer
.
pauseVideo
).
toHaveBeenCalled
()
...
...
@@ -187,7 +187,7 @@ describe 'VideoPlayer', ->
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
PAUSED
it
'log the pause_video event'
,
->
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'pause_video'
expect
(
@
video
.
log
).
toHaveBeenCalledWith
'pause_video'
it
'set current video player as inactive'
,
->
expect
(
window
.
player
).
toBeNull
()
...
...
@@ -270,7 +270,7 @@ describe 'VideoPlayer', ->
@
player
.
onSpeedChange
{},
'0.75'
it
'load the video'
,
->
expect
(
@
player
.
player
.
loadVideoById
).
toHaveBeenCalledWith
'
abc123
'
,
'80.000'
expect
(
@
player
.
player
.
loadVideoById
).
toHaveBeenCalledWith
'
slowerSpeedYoutubeId
'
,
'80.000'
it
'trigger updatePlayTime event'
,
->
expect
(
@
player
.
updatePlayTime
).
toHaveBeenCalledWith
'80.000'
...
...
@@ -281,7 +281,7 @@ describe 'VideoPlayer', ->
@
player
.
onSpeedChange
{},
'0.75'
it
'cue the video'
,
->
expect
(
@
player
.
player
.
cueVideoById
).
toHaveBeenCalledWith
'
abc123
'
,
'80.000'
expect
(
@
player
.
player
.
cueVideoById
).
toHaveBeenCalledWith
'
slowerSpeedYoutubeId
'
,
'80.000'
it
'trigger updatePlayTime event'
,
->
expect
(
@
player
.
updatePlayTime
).
toHaveBeenCalledWith
'80.000'
...
...
lms/static/coffee/spec/modules/video_spec.coffee
View file @
cec1b23d
...
...
@@ -3,6 +3,10 @@ describe 'Video', ->
loadFixtures
'video.html'
jasmine
.
stubRequests
()
@
videosDefinition
=
'.75:slowerSpeedYoutubeId,1.0:normalSpeedYoutubeId'
@
slowerSpeedYoutubeId
=
'slowerSpeedYoutubeId'
@
normalSpeedYoutubeId
=
'normalSpeedYoutubeId'
afterEach
->
window
.
player
=
undefined
window
.
onYouTubePlayerAPIReady
=
undefined
...
...
@@ -15,7 +19,7 @@ describe 'Video', ->
describe
'by default'
,
->
beforeEach
->
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
it
'reset the current video player'
,
->
expect
(
window
.
player
).
toBeNull
()
...
...
@@ -25,16 +29,16 @@ describe 'Video', ->
it
'parse the videos'
,
->
expect
(
@
video
.
videos
).
toEqual
'0.75'
:
'abc123'
'1.0'
:
'def456'
'0.75'
:
@
slowerSpeedYoutubeId
'1.0'
:
@
normalSpeedYoutubeId
it
'fetch the video metadata'
,
->
expect
(
@
video
.
metadata
).
toEqual
abc123
:
id
:
'abc123'
duration
:
1
00
def456
:
id
:
'def456'
slowerSpeedYoutubeId
:
id
:
@
slowerSpeedYoutubeId
duration
:
3
00
normalSpeedYoutubeId
:
id
:
@
normalSpeedYoutubeId
duration
:
200
it
'parse available video speeds'
,
->
...
...
@@ -51,7 +55,7 @@ describe 'Video', ->
@
originalYT
=
window
.
YT
window
.
YT
=
{
Player
:
true
}
spyOn
(
window
,
'VideoPlayer'
).
andReturn
(
@
stubVideoPlayer
)
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
afterEach
->
window
.
YT
=
@
originalYT
...
...
@@ -64,7 +68,7 @@ describe 'Video', ->
beforeEach
->
@
originalYT
=
window
.
YT
window
.
YT
=
{}
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
afterEach
->
window
.
YT
=
@
originalYT
...
...
@@ -77,7 +81,7 @@ describe 'Video', ->
@
originalYT
=
window
.
YT
window
.
YT
=
{}
spyOn
(
window
,
'VideoPlayer'
).
andReturn
(
@
stubVideoPlayer
)
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
window
.
onYouTubePlayerAPIReady
()
afterEach
->
...
...
@@ -90,20 +94,20 @@ describe 'Video', ->
describe
'youtubeId'
,
->
beforeEach
->
$
.
cookie
.
andReturn
'1.0'
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
describe
'with speed'
,
->
it
'return the video id for given speed'
,
->
expect
(
@
video
.
youtubeId
(
'0.75'
)).
toEqual
'abc123'
expect
(
@
video
.
youtubeId
(
'1.0'
)).
toEqual
'def456'
expect
(
@
video
.
youtubeId
(
'0.75'
)).
toEqual
@
slowerSpeedYoutubeId
expect
(
@
video
.
youtubeId
(
'1.0'
)).
toEqual
@
normalSpeedYoutubeId
describe
'without speed'
,
->
it
'return the video id for current speed'
,
->
expect
(
@
video
.
youtubeId
()).
toEqual
'def456'
expect
(
@
video
.
youtubeId
()).
toEqual
@
normalSpeedYoutubeId
describe
'setSpeed'
,
->
beforeEach
->
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
describe
'when new speed is available'
,
->
beforeEach
->
...
...
@@ -124,14 +128,14 @@ describe 'Video', ->
describe
'getDuration'
,
->
beforeEach
->
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
it
'return duration for current video'
,
->
expect
(
@
video
.
getDuration
()).
toEqual
200
describe
'log'
,
->
beforeEach
->
@
video
=
new
Video
'example'
,
'.75:abc123,1.0:def456'
@
video
=
new
Video
'example'
,
@
videosDefinition
@
video
.
setSpeed
'1.0'
spyOn
Logger
,
'log'
@
video
.
player
=
{
currentTime
:
25
}
...
...
@@ -140,6 +144,6 @@ describe 'Video', ->
it
'call the logger with valid parameters'
,
->
expect
(
Logger
.
log
).
toHaveBeenCalledWith
'someEvent'
,
id
:
'example'
code
:
'def456'
code
:
@
normalSpeedYoutubeId
currentTime
:
25
speed
:
'1.0'
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