Skip to content
Snippets Groups Projects
Commit 728f7d2c authored by Ahtisham Shahid's avatar Ahtisham Shahid
Browse files

Updated Trascript functionality

removed extras

fixed initial state of transcript

Fixed js tests

fixed js tests

created and fixed tests

Updated Trascript functionality

updated v name

fixed spacing
parent cec654f7
No related branches found
No related tags found
No related merge requests found
......@@ -36,13 +36,15 @@
'previousLanguageMenuItem', 'nextLanguageMenuItem', 'handleCaptionToggle',
'showClosedCaptions', 'hideClosedCaptions', 'toggleClosedCaptions',
'updateCaptioningCookie', 'handleCaptioningCookie', 'handleTranscriptToggle',
'listenForDragDrop'
'listenForDragDrop', 'handleTranscriptCookie', 'updateTranscriptCookie'
);
this.state = state;
this.state.videoCaption = this;
this.renderElements();
this.handleCaptioningCookie();
this.listenForDragDrop();
this.handleTranscriptCookie();
return $.Deferred().resolve().promise();
};
......@@ -1142,11 +1144,12 @@
*/
toggle: function(event) {
event.preventDefault();
if (this.state.el.hasClass('closed')) {
this.hideCaptions(false, true, true);
this.updateTranscriptCookie(true);
} else {
this.hideCaptions(true, true, true);
this.updateTranscriptCookie(false);
}
},
......@@ -1232,6 +1235,31 @@
});
}
},
handleTranscriptCookie: function() {
if ($.cookie('show_transcript') === null) {
return;
}
if ($.cookie('show_transcript') !== 'false') {
this.state.hideCaptions = false;
// keep it going until turned off or in case of null initially change to true
this.updateTranscriptCookie(true);
} else {
this.state.hideCaptions = true;
}
this.hideCaptions(this.state.hideCaptions, true, true);
},
updateTranscriptCookie: function(showTranscript) {
if (showTranscript) {
$.cookie('show_transcript', 'true', {
expires: 3650,
path: '/'
});
} else {
$.cookie('show_transcript', 'false', {
path: '/'
});
}
},
listenForDragDrop: function() {
var captions = this.captionDisplayEl['0'];
......
......@@ -288,6 +288,22 @@ class CMSVideoTest(CMSVideoBaseTest):
self.assertTrue(self.video.is_captions_visible())
def test_transcript_state_is_saved_on_reload(self):
"""
Scenario: Transcripts state is preserved
Given I have created a Video component with subtitles
And I have toggled off the transcript
After page reload transcript is already off
Then when I view the video it does show the captions
"""
self._create_course_unit(subtitles=True)
self.video.click_player_button('transcript_button')
self.assertFalse(self.video.is_captions_visible())
self.video.click_player_button('transcript_button')
self.assertTrue(self.video.is_captions_visible())
self.browser.refresh()
self.assertTrue(self.video.is_captions_visible())
def test_caption_line_focus(self):
"""
Scenario: When enter key is pressed on a caption, an outline shows around it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment