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
871b7fe7
Commit
871b7fe7
authored
Dec 20, 2017
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature disabled JS tests
Fix quality
parent
554c90d1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
47 deletions
+74
-47
cms/djangoapps/contentstore/views/tests/test_videos.py
+3
-9
cms/djangoapps/contentstore/views/videos.py
+3
-1
cms/static/js/spec/views/video_transcripts_spec.js
+67
-36
cms/static/js/views/video_transcripts.js
+1
-1
No files found.
cms/djangoapps/contentstore/views/tests/test_videos.py
View file @
871b7fe7
...
...
@@ -21,7 +21,7 @@ from edxval.api import (
get_video_info
,
get_course_video_image_url
,
create_or_update_video_transcript
)
)
from
mock
import
Mock
,
patch
from
contentstore.models
import
VideoUploadConfig
...
...
@@ -287,8 +287,8 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
}
],
{
'en'
:
'English'
,
'es'
:
'Spanish'
'en'
:
'English'
,
'es'
:
'Spanish'
}
)
)
...
...
@@ -653,12 +653,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
is_video_transcript_enabled
)
# Verify that transcripts column is present in the response if videos transcript feature is enabled.
self
.
assertEqual
(
'<div class="video-head-col video-col transcripts-col">Transcripts</div>'
in
response
.
content
,
is_video_transcript_enabled
)
@ddt.ddt
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_VIDEO_UPLOAD_PIPELINE'
:
True
})
...
...
cms/djangoapps/contentstore/views/videos.py
View file @
871b7fe7
...
...
@@ -580,6 +580,7 @@ def _get_index_videos(course):
_get_values
(
video
)
for
video
in
_get_videos
(
course
)
]
def
get_all_transcript_languages
(
is_video_transcript_enabled
=
False
):
"""
Returns all possible languages for transcript.
...
...
@@ -592,7 +593,7 @@ def get_all_transcript_languages(is_video_transcript_enabled=False):
# Get third party transcription languages.
third_party_transcription_languages
=
transcription_plans
[
TranscriptProvider
.
THREE_PLAY_MEDIA
][
'languages'
]
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'MECHANICAL'
][
'languages'
])
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'PREMIUM'
][
'languages'
])
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'PREMIUM'
][
'languages'
])
third_party_transcription_languages
=
dict
(
third_party_transcription_languages
,
**
cielo_fidelity
[
'PROFESSIONAL'
][
'languages'
])
# Get all settings languages dict.
...
...
@@ -603,6 +604,7 @@ def get_all_transcript_languages(is_video_transcript_enabled=False):
# Return combined settings and 3rd party transcript languages.
return
dict
(
all_languages
,
**
third_party_transcription_languages
)
def
videos_index_html
(
course
):
"""
Returns an HTML page to display previous video uploads and allow new ones
...
...
cms/static/js/spec/views/video_transcripts_spec.js
View file @
871b7fe7
define
(
[
'jquery'
,
'underscore'
,
'backbone'
,
'js/views/video_transcripts'
,
'common/js/spec_helpers/template_helpers'
],
function
(
$
,
_
,
Backbone
,
VideoTranscriptsView
,
TemplateHelpers
)
{
[
'jquery'
,
'underscore'
,
'backbone'
,
'js/views/video_transcripts'
,
'js/views/previous_video_upload_list'
,
'common/js/spec_helpers/template_helpers'
],
function
(
$
,
_
,
Backbone
,
VideoTranscriptsView
,
PreviousVideoUploadListView
,
TemplateHelpers
)
{
'use strict'
;
describe
(
'VideoTranscriptsView'
,
function
()
{
var
$videoTranscriptsViewEl
,
videoTranscriptsView
,
var
videoTranscriptsView
,
renderView
,
transcripts
=
{
en
:
'English'
,
...
...
@@ -21,37 +21,68 @@ define(
ur
:
'Urdu'
},
videoSupportedFileFormats
=
[
'.mov'
,
'.mp4'
],
TRANSCRIPT_DOWNLOAD_FILE_FORMAT
=
'srt'
;
renderView
=
function
(
availableTranscripts
)
{
videoTranscriptsView
=
new
VideoTranscriptsView
({
transcripts
:
availableTranscripts
,
edxVideoID
:
edxVideoID
,
clientVideoID
:
clientVideoID
,
TRANSCRIPT_DOWNLOAD_FILE_FORMAT
=
'srt'
,
videoListView
;
renderView
=
function
(
availableTranscripts
,
isVideoTranscriptEnabled
)
{
var
videoViewIndex
=
0
,
isVideoTranscriptEnabled
=
isVideoTranscriptEnabled
||
_
.
isUndefined
(
isVideoTranscriptEnabled
),
// eslint-disable-line max-len, no-redeclare
videoData
=
{
client_video_id
:
clientVideoID
,
edx_video_id
:
edxVideoID
,
created
:
'2014-11-25T23:13:05'
,
transcripts
:
availableTranscripts
},
videoCollection
=
new
Backbone
.
Collection
([
new
Backbone
.
Model
(
videoData
)]);
videoListView
=
new
PreviousVideoUploadListView
({
collection
:
videoCollection
,
videoImageSettings
:
{},
transcriptAvailableLanguages
:
transcriptAvailableLanguages
,
videoSupportedFileFormats
:
videoSupportedFileFormats
videoSupportedFileFormats
:
videoSupportedFileFormats
,
isVideoTranscriptEnabled
:
isVideoTranscriptEnabled
});
videoTranscriptsView
.
setElement
(
$
(
'.transcripts-col'
));
$videoTranscriptsViewEl
=
videoTranscriptsView
.
render
().
$el
;
videoListView
.
setElement
(
$
(
'.wrapper-assets'
));
videoListView
.
render
();
videoTranscriptsView
=
videoListView
.
itemViews
[
videoViewIndex
].
videoTranscriptsView
;
};
beforeEach
(
function
()
{
setFixtures
(
'<div class="video-col transcripts-col"></div>'
);
TemplateHelpers
.
installTemplate
(
'video-transcripts'
);
setFixtures
(
'<section class="wrapper-assets"></section>'
);
TemplateHelpers
.
installTemplate
(
'previous-video-upload-list'
);
renderView
(
transcripts
);
});
it
(
'renders as expected'
,
function
()
{
expect
(
$videoTranscriptsViewEl
.
find
(
'.show-video-transcripts-container'
)).
toExist
();
expect
(
videoListView
.
$el
.
find
(
'.show-video-transcripts-container'
)).
toExist
();
// Verify transcript container is present.
expect
(
videoListView
.
$el
.
find
(
'.show-video-transcripts-container'
)).
toExist
();
// Veirfy transcript column header is present.
expect
(
videoListView
.
$el
.
find
(
'.js-table-head .video-head-col.transcripts-col'
)).
toExist
();
// Verify transcript data column is present.
expect
(
videoListView
.
$el
.
find
(
'.js-table-body .transcripts-col'
)).
toExist
();
// Verify view has initiallized.
expect
(
_
.
isUndefined
(
videoTranscriptsView
)).
toEqual
(
false
);
});
it
(
'does not render transcripts view if feature is disabled'
,
function
()
{
renderView
({},
false
);
// Verify transcript container is not present.
expect
(
videoListView
.
$el
.
find
(
'.show-video-transcripts-container'
)).
not
.
toExist
();
// Veirfy transcript column header is not present.
expect
(
videoListView
.
$el
.
find
(
'.js-table-head .video-head-col.transcripts-col'
)).
not
.
toExist
();
// Verify transcript data column is not present.
expect
(
videoListView
.
$el
.
find
(
'.js-table-body .transcripts-col'
)).
not
.
toExist
();
// Verify view has not initiallized.
expect
(
_
.
isUndefined
(
videoTranscriptsView
)).
toEqual
(
true
);
});
it
(
'does not shows transcripts'
,
function
()
{
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
).
toEqual
(
true
);
expect
(
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
'Show transcripts ('
+
_
.
size
(
transcripts
)
+
')'
);
});
...
...
@@ -59,50 +90,50 @@ define(
it
(
'shows transcripts container on show transcript button click'
,
function
()
{
// Verify transcript container is hidden
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
).
toEqual
(
true
);
// Verify initial button text
expect
(
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
'Show transcripts ('
+
_
.
size
(
transcripts
)
+
')'
);
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
// Verify transcript container is not hidden
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
).
toEqual
(
false
);
// Verify button text is changed.
expect
(
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
'Hide transcripts ('
+
_
.
size
(
transcripts
)
+
')'
);
});
it
(
'hides transcripts when clicked on hide transcripts button'
,
function
()
{
// Click to show transcripts first.
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
// Verify button text.
expect
(
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
'Hide transcripts ('
+
_
.
size
(
transcripts
)
+
')'
);
// Verify transcript container is not hidden
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
).
toEqual
(
false
);
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
// Verify button text is changed.
expect
(
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button-text'
).
html
().
trim
()).
toEqual
(
'Show transcripts ('
+
_
.
size
(
transcripts
)
+
')'
);
// Verify transcript container is hidden
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcripts-wrapper'
).
hasClass
(
'hidden'
)
).
toEqual
(
true
);
});
...
...
@@ -112,20 +143,20 @@ define(
// Verify appropriate text is shown
expect
(
$videoTranscriptsViewE
l
.
find
(
'.transcripts-empty-text'
).
html
()
videoTranscriptsView
.
$e
l
.
find
(
'.transcripts-empty-text'
).
html
()
).
toEqual
(
'No transcript available yet.'
);
});
it
(
'renders correct transcript attributes'
,
function
()
{
var
$transcriptEl
;
// Show transcripts
$videoTranscriptsViewE
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
expect
(
$videoTranscriptsViewE
l
.
find
(
'.show-video-transcript-content'
).
length
).
toEqual
(
videoTranscriptsView
.
$e
l
.
find
(
'.toggle-show-transcripts-button'
).
click
();
expect
(
videoTranscriptsView
.
$e
l
.
find
(
'.show-video-transcript-content'
).
length
).
toEqual
(
_
.
size
(
transcripts
)
);
_
.
each
(
transcripts
,
function
(
langaugeText
,
languageCode
)
{
$transcriptEl
=
$
(
$videoTranscriptsViewE
l
.
find
(
'#show-video-transcript-content-'
+
languageCode
));
$transcriptEl
=
$
(
videoTranscriptsView
.
$e
l
.
find
(
'#show-video-transcript-content-'
+
languageCode
));
// Verify correct transcript title is set.
expect
(
$transcriptEl
.
find
(
'.transcript-title'
).
html
()).
toEqual
(
'Video client title n_'
+
languageCode
+
'.'
+
TRANSCRIPT_DOWNLOAD_FILE_FORMAT
...
...
cms/static/js/views/video_transcripts.js
View file @
871b7fe7
...
...
@@ -62,7 +62,7 @@ define(
StringUtils
.
interpolate
(
gettext
(
'{toggleShowTranscriptText} transcripts ({totalTranscripts})'
),
{
toggleShowTranscriptText
:
$transcriptsWrapperEl
.
hasClass
(
'hidden'
)
?
gettext
(
'Show'
)
:
gettext
(
'Hide'
),
toggleShowTranscriptText
:
$transcriptsWrapperEl
.
hasClass
(
'hidden'
)
?
gettext
(
'Show'
)
:
gettext
(
'Hide'
),
// eslint-disable-line max-len
totalTranscripts
:
_
.
size
(
this
.
transcripts
)
}
)
...
...
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