From 1f238b953bffeb9a3204f00125fef33a0c2f3a33 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Thu, 8 Aug 2013 09:43:05 +0300 Subject: [PATCH] Fixed test for height of player when CC is disabled. It turned out that we were reading the heights of the contols and other elements before we initialized the heights. --- .../js/spec/videoalpha/video_caption_spec.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/videoalpha/video_caption_spec.js b/common/lib/xmodule/xmodule/js/spec/videoalpha/video_caption_spec.js index 4c46b577db..d1ec74bb13 100644 --- a/common/lib/xmodule/xmodule/js/spec/videoalpha/video_caption_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/videoalpha/video_caption_spec.js @@ -1,5 +1,5 @@ (function() { - xdescribe('VideoCaptionAlpha', function() { + describe('VideoCaptionAlpha', function() { var state, videoPlayer, videoCaption, videoSpeedControl, oldOTBD; function initialize() { @@ -369,14 +369,21 @@ }); it('when CC button is disabled ', function() { - var realHeight = parseInt($('.subtitles').css('maxHeight'), 10), - videoWrapperHeight = $('.video-wrapper').height(), - progressSliderHeight = videoControl.sliderEl.height(), - shouldBeHeight = videoWrapperHeight - 0.5 * progressSliderHeight; + var realHeight, videoWrapperHeight, progressSliderHeight, + controlHeight, shouldBeHeight; state.captionsHidden = true; videoCaption.setSubtitlesHeight(); - expect(realHeight).toBeCloseTo(shouldBeHeight, 2); + + realHeight = parseInt($('.subtitles').css('maxHeight'), 10); + videoWrapperHeight = $('.video-wrapper').height(); + progressSliderHeight = videoControl.sliderEl.height(); + controlHeight = videoControl.el.height(); + shouldBeHeight = videoWrapperHeight - + 0.5 * progressSliderHeight - + controlHeight; + + expect(realHeight).toBe(shouldBeHeight); }); });