Commit 497f324d by jmclaus

Replaced mouseenter and mouseleave event handlers by mouseover and mouseout. The…

Replaced mouseenter and mouseleave event handlers by mouseover and mouseout. The former were failing Jasmine tests. Since the captions are li elements without descendants, they are identical.
parent 27d00673
...@@ -105,8 +105,8 @@ ...@@ -105,8 +105,8 @@
it('bind all the caption link', function() { it('bind all the caption link', function() {
$('.subtitles li[data-index]').each(function(index, link) { $('.subtitles li[data-index]').each(function(index, link) {
expect($(link)).toHandleWith('mouseenter', videoCaption.captionMouseEnterLeave); expect($(link)).toHandleWith('mouseover', videoCaption.captionMouseOverOut);
expect($(link)).toHandleWith('mouseleave', videoCaption.captionMouseEnterLeave); expect($(link)).toHandleWith('mouseout', videoCaption.captionMouseOverOut);
expect($(link)).toHandleWith('mousedown', videoCaption.captionMouseDown); expect($(link)).toHandleWith('mousedown', videoCaption.captionMouseDown);
expect($(link)).toHandleWith('click', videoCaption.captionClick); expect($(link)).toHandleWith('click', videoCaption.captionClick);
expect($(link)).toHandleWith('focus', videoCaption.captionFocus); expect($(link)).toHandleWith('focus', videoCaption.captionFocus);
...@@ -297,8 +297,8 @@ ...@@ -297,8 +297,8 @@
it('bind all the caption link', function() { it('bind all the caption link', function() {
$('.subtitles li[data-index]').each(function(index, link) { $('.subtitles li[data-index]').each(function(index, link) {
expect($(link)).toHandleWith('mouseenter', videoCaption.captionMouseEnterLeave); expect($(link)).toHandleWith('mouseover', videoCaption.captionMouseOverOut);
expect($(link)).toHandleWith('mouseleave', videoCaption.captionMouseEnterLeave); expect($(link)).toHandleWith('mouseout', videoCaption.captionMouseOverOut);
expect($(link)).toHandleWith('mousedown', videoCaption.captionMouseDown); expect($(link)).toHandleWith('mousedown', videoCaption.captionMouseDown);
expect($(link)).toHandleWith('click', videoCaption.captionClick); expect($(link)).toHandleWith('click', videoCaption.captionClick);
expect($(link)).toHandleWith('focus', videoCaption.captionFocus); expect($(link)).toHandleWith('focus', videoCaption.captionFocus);
......
...@@ -62,7 +62,7 @@ function () { ...@@ -62,7 +62,7 @@ function () {
state.videoCaption.bindHandlers = _.bind(bindHandlers, state); state.videoCaption.bindHandlers = _.bind(bindHandlers, state);
state.videoCaption.fetchCaption = _.bind(fetchCaption, state); state.videoCaption.fetchCaption = _.bind(fetchCaption, state);
state.videoCaption.captionURL = _.bind(captionURL, state); state.videoCaption.captionURL = _.bind(captionURL, state);
state.videoCaption.captionMouseEnterLeave = _.bind(captionMouseEnterLeave, state); state.videoCaption.captionMouseOverOut = _.bind(captionMouseOverOut, state);
state.videoCaption.captionMouseDown = _.bind(captionMouseDown, state); state.videoCaption.captionMouseDown = _.bind(captionMouseDown, state);
state.videoCaption.captionClick = _.bind(captionClick, state); state.videoCaption.captionClick = _.bind(captionClick, state);
state.videoCaption.captionFocus = _.bind(captionFocus, state); state.videoCaption.captionFocus = _.bind(captionFocus, state);
...@@ -325,8 +325,8 @@ function () { ...@@ -325,8 +325,8 @@ function () {
this.videoCaption.subtitlesEl.html(container.html()); this.videoCaption.subtitlesEl.html(container.html());
this.videoCaption.subtitlesEl.find('li[data-index]').on({ this.videoCaption.subtitlesEl.find('li[data-index]').on({
mouseenter: this.videoCaption.captionMouseEnterLeave, mouseover: this.videoCaption.captionMouseOverOut,
mouseleave: this.videoCaption.captionMouseEnterLeave, mouseout: this.videoCaption.captionMouseOverOut,
mousedown: this.videoCaption.captionMouseDown, mousedown: this.videoCaption.captionMouseDown,
click: this.videoCaption.captionClick, click: this.videoCaption.captionClick,
focus: this.videoCaption.captionFocus, focus: this.videoCaption.captionFocus,
...@@ -358,16 +358,16 @@ function () { ...@@ -358,16 +358,16 @@ function () {
this.videoCaption.rendered = true; this.videoCaption.rendered = true;
} }
// On mouseEnter, hide the outline of a caption that has been tabbed to. // On mouseOver, hide the outline of a caption that has been tabbed to.
// On mouseLeave, show the outline of a caption that has been tabbed to. // On mouseOut, show the outline of a caption that has been tabbed to.
function captionMouseEnterLeave(event) { function captionMouseOverOut(event) {
var caption = $(event.target), var caption = $(event.target),
captionIndex = parseInt(caption.attr('data-index'), 10); captionIndex = parseInt(caption.attr('data-index'), 10);
if (captionIndex === this.videoCaption.currentCaptionIndex) { if (captionIndex === this.videoCaption.currentCaptionIndex) {
if (event.type === 'mouseenter') { if (event.type === 'mouseover') {
caption.removeClass('focused').addClass('unfocused'); caption.removeClass('focused').addClass('unfocused');
} }
else { // mouseleave else { // mouseout
caption.removeClass('unfocused').addClass('focused'); caption.removeClass('unfocused').addClass('focused');
} }
} }
......
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