Commit a628c523 by Adam Palay

Revert "AC-454 adding visual clarify for selected menu options"

This reverts commit 55d84d34.
parent 51d85809
......@@ -535,8 +535,6 @@
.speed-option,
.control-lang {
@include border-left($baseline/10 solid rgb(14, 166, 236));
font-weight: $font-bold;
color: rgb(14, 166, 236); // UXPL primary accent
}
}
......
......@@ -55,9 +55,8 @@
</div>
</section>
</article>
<div class="subtitles">
<ol class="subtitles-menu"><li></li></ol>
</div>
<ol class="subtitles"><li></li></ol>
</div>
</div>
</div>
......@@ -109,9 +108,7 @@
</section>
</article>
<div class="subtitles">
<ol class="subtitles-menu"><li></li></ol>
</div>
<ol class="subtitles"><li></li></ol>
</div>
</div>
</div>
......
......@@ -20,10 +20,12 @@ var options = {
libraryFilesToInclude: [
{pattern: 'common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'RequireJS-namespace-undefine.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common_static/common/js/vendor/underscore.js', included: true},
{pattern: 'common_static/common/js/vendor/backbone.js', included: true},
{pattern: 'common_static/edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common_static/js/vendor/draggabilly.js'},
{pattern: 'common_static/common/js/vendor/jquery.js', included: true},
......@@ -48,14 +50,11 @@ var options = {
{pattern: 'common_static/js/vendor/jasmine-imagediff.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-waituntil.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-extensions.js', included: true},
{pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true}
],
libraryFiles: [
{pattern: 'common_static/edx-pattern-library/js/**/*.js'},
{pattern: 'common_static/edx-ui-toolkit/js/**/*.js'}
{pattern: 'common_static/edx-pattern-library/js/**/*.js'}
],
// Make sure the patterns in sourceFiles and specFiles do not match the same file.
......
(function(requirejs, define) {
'use strict';
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
var defineDependency = function (globalName, name, noShim) {
var getGlobalValue = function(name) {
var globalNamePath = name.split('.'),
result = window,
i;
for (i = 0; i < globalNamePath.length; i++) {
result = result[globalNamePath[i]];
}
return result;
},
globalValue = getGlobalValue(globalName);
if (globalValue) {
if (noShim) {
define(name, {});
}
else {
define(name, [], function() { return globalValue; });
}
}
else {
console.error("Expected library to be included on page, but not found on window object: " + name);
}
};
defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore");
}
(function(requirejs) {
requirejs.config({
baseUrl: '/base/',
paths: {
......@@ -38,8 +6,7 @@
"modernizr": "common_static/edx-pattern-library/js/modernizr-custom",
"afontgarde": "common_static/edx-pattern-library/js/afontgarde",
"edxicons": "common_static/edx-pattern-library/js/edx-icons",
"draggabilly": "common_static/js/vendor/draggabilly",
'edx-ui-toolkit': 'common_static/edx-ui-toolkit'
"draggabilly": "common_static/js/vendor/draggabilly"
},
"moment": {
exports: "moment"
......@@ -51,4 +18,5 @@
exports: "AFontGarde"
}
});
}).call(this, RequireJS.requirejs, RequireJS.define);
}).call(this, RequireJS.requirejs);
......@@ -266,7 +266,6 @@
expect($('.closed-captions')).toHaveAttrs({
'lang': 'de'
});
expect(link).toHaveAttr('aria-pressed', 'true');
});
it('when clicking on link with current language', function () {
......@@ -285,7 +284,6 @@
expect(state.storage.setItem)
.not.toHaveBeenCalledWith('language', 'en');
expect($('.langs-list li.is-active').length).toBe(1);
expect(link).toHaveAttr('aria-pressed', 'true');
});
it('open the language toggle on hover', function () {
......@@ -415,7 +413,7 @@
});
it('show explanation message', function () {
expect($('.subtitles .subtitles-menu li')).toHaveText(
expect($('.subtitles-menu li')).toHaveText(
'Transcript will be displayed when you start playing the video.'
);
});
......
......@@ -203,18 +203,16 @@
describe('onSpeedChange', function () {
beforeEach(function () {
state = jasmine.initializePlayer();
$('li[data-speed="1.0"]').addClass('is-active').attr('aria-pressed', 'true');
$('li[data-speed="1.0"]').addClass('is-active');
state.videoSpeedControl.setSpeed(0.75);
});
it('set the new speed as active', function () {
expect($('li[data-speed="1.0"]')).not.toHaveClass('is-active');
expect($('li[data-speed="1.0"] .speed-option').attr('aria-pressed')).not.toEqual('true');
expect($('li[data-speed="0.75"]')).toHaveClass('is-active');
expect($('li[data-speed="0.75"] .speed-option').attr('aria-pressed')).toEqual('true');
expect($('.speeds .speed-button .value')).toHaveHtml('0.75x');
expect($('.video-speeds li[data-speed="1.0"]'))
.not.toHaveClass('is-active');
expect($('.video-speeds li[data-speed="0.75"]'))
.toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('0.75x');
});
});
......
(function (requirejs, require, define) {
"use strict";
define(
'video/08_video_speed_control.js', [
'video/00_iterator.js',
'edx-ui-toolkit/js/utils/html-utils'
], function (Iterator, HtmlUtils) {
'video/08_video_speed_control.js',
['video/00_iterator.js'],
function (Iterator) {
/**
* Video speed control module.
* @exports video/08_video_speed_control.js
......@@ -96,37 +95,23 @@ define(
* Creates any necessary DOM elements, attach them, and set their,
* initial configuration.
* @param {array} speeds List of speeds available for the player.
* @param {string} currentSpeed The current speed set to the player.
*/
render: function (speeds, currentSpeed) {
render: function (speeds) {
var speedsContainer = this.speedsContainer,
reversedSpeeds = speeds.concat().reverse(),
speedsList = $.map(reversedSpeeds, function (speed) {
return HtmlUtils.interpolateHtml(
HtmlUtils.joinHtml(
HtmlUtils.HTML('<li data-speed="{speed}">'),
HtmlUtils.HTML('<button class="control speed-option" tabindex="-1" aria-pressed="false">'),
HtmlUtils.HTML(speed),
HtmlUtils.HTML('x'),
HtmlUtils.HTML('</button>'),
HtmlUtils.HTML('</li>')
),
{
speed: speed
}
).toString();
return [
'<li data-speed="', speed, '">',
'<button class="control speed-option" tabindex="-1">',
speed, 'x',
'</button>',
'</li>'
].join('');
});
HtmlUtils.setHtml(
speedsContainer,
HtmlUtils.HTML(speedsList)
);
speedsContainer.html(speedsList.join(''));
this.speedLinks = new Iterator(speedsContainer.find('.speed-option'));
HtmlUtils.prepend(
this.state.el.find('.secondary-controls'),
HtmlUtils.HTML(this.el)
);
this.setActiveSpeed(currentSpeed);
this.state.el.find('.secondary-controls').prepend(this.el);
},
/**
......@@ -231,38 +216,17 @@ define(
if (speed !== this.currentSpeed || forceUpdate) {
this.speedsContainer
.find('li')
.siblings("li[data-speed='" + speed + "']");
.removeClass('is-active')
.siblings("li[data-speed='" + speed + "']")
.addClass('is-active');
this.speedButton.find('.value').text(speed + 'x');
this.speedButton.find('.value').html(speed + 'x');
this.currentSpeed = speed;
if (!silent) {
this.el.trigger('speedchange', [speed, this.state.speed]);
}
}
this.resetActiveSpeed();
this.setActiveSpeed(speed);
},
resetActiveSpeed: function() {
var speedOptions = this.speedsContainer.find('li');
$(speedOptions).each(function(index, el) {
$(el).removeClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'false');
});
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + speed + '"]');
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
this.speedButton.attr('title', gettext('Video speed: ') + speed + 'x');
},
/**
......@@ -280,13 +244,10 @@ define(
* @param {jquery Event} event
*/
clickLinkHandler: function (event) {
var el = $(event.currentTarget).parent(),
speed = $(el).data('speed');
var speed = $(event.currentTarget).parent().data('speed');
this.resetActiveSpeed();
this.setActiveSpeed(speed);
this.closeMenu();
this.state.videoCommands.execute('speed', speed);
this.closeMenu(true);
return false;
},
......
......@@ -3,6 +3,7 @@
/* jshint node: true */
/*jshint -W079 */
'use strict';
var path = require('path');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
......@@ -15,27 +16,23 @@ var options = {
// Avoid adding files to this list. Use RequireJS.
libraryFilesToInclude: [
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'js/RequireJS-namespace-undefine.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.core.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.grid.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'lms/js/spec/main_requirejs_coffee.js', included: true},
{pattern: 'js/RequireJS-namespace-undefine.js', included: true},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'common/js/vendor/underscore.js', included: true},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'xmodule_js/common_static/js/src/logger.js', included: true},
{pattern: 'xmodule_js/common_static/js/test/i18n.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common/js/vendor/jquery.js', included: true},
{pattern: 'common/js/vendor/jquery-migrate.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery.cookie.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/flot/jquery.flot.js', included: true},
{pattern: 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jquery-ui.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/moment.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/moment-with-locales.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/URI.min.js', included: true},
{pattern: 'xmodule_js/common_static/js/xblock/*.js', included: true},
......@@ -45,9 +42,7 @@ var options = {
{pattern: 'xmodule_js/src/xmodule.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jasmine-imagediff.js', included: true},
{pattern: 'common/js/spec_helpers/jasmine-extensions.js', included: true},
{pattern: 'lms/js/spec/main_requirejs_coffee.js', included: true}
{pattern: 'common/js/spec_helpers/jasmine-extensions.js', included: true}
],
libraryFiles: [
......
(function(requirejs, define) {
(function(requirejs) {
'use strict';
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
var defineDependency = function (globalName, name, noShim) {
var getGlobalValue = function(name) {
var globalNamePath = name.split('.'),
result = window,
i;
for (i = 0; i < globalNamePath.length; i++) {
result = result[globalNamePath[i]];
}
return result;
},
globalValue = getGlobalValue(globalName);
if (globalValue) {
if (noShim) {
define(name, {});
}
else {
define(name, [], function() { return globalValue; });
}
}
else {
console.error("Expected library to be included on page, but not found on window object: " + name);
}
};
defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore");
}
requirejs.config({
baseUrl: '/base/',
paths: {
......@@ -38,8 +7,7 @@
"modernizr": "edx-pattern-library/js/modernizr-custom",
"afontgarde": "edx-pattern-library/js/afontgarde",
"edxicons": "edx-pattern-library/js/edx-icons",
"draggabilly": "xmodule_js/common_static/js/vendor/draggabilly",
'edx-ui-toolkit': 'edx-ui-toolkit'
"draggabilly": "xmodule_js/common_static/js/vendor/draggabilly"
},
"moment": {
exports: "moment"
......@@ -52,4 +20,4 @@
}
});
}).call(this, RequireJS.requirejs, RequireJS.define);
}).call(this, requirejs, define); // jshint ignore:line
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment