jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363157 )

Change subject: Merge draggableDragAction and dependencies
......................................................................


Merge draggableDragAction and dependencies

Also temporarily deactivate browser tests for bar clicking.

Change-Id: I347533ef445cb3c37e420beebcc79919e56a1223
---
M modules/ext.RevisionSlider.SliderView.js
M modules/ext.RevisionSlider.SliderViewTwo.js
M tests/browser/features/history.feature
M tests/browser/features/pointers.feature
4 files changed, 63 insertions(+), 83 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ext.RevisionSlider.SliderView.js 
b/modules/ext.RevisionSlider.SliderView.js
index 5b46a72..6b568da 100644
--- a/modules/ext.RevisionSlider.SliderView.js
+++ b/modules/ext.RevisionSlider.SliderView.js
@@ -273,29 +273,38 @@
                },
 
                draggableDragAction: function ( event, ui, pointer, 
lastValidLeftPos ) {
-                       var olderLeftPos, newerLeftPos,
-                               isNew = $( pointer ).hasClass( 
'mw-revslider-pointer-newer' );
+                       var pos, $revisions, $hoveredRevisionWrapper;
 
-                       ui.position.left = Math.min(
-                               ui.position.left,
-                               this.getNewestVisibleRevisonLeftPos()
+                       pos = this.getRevisionPositionFromLeftOffset(
+                               $( pointer ).offset().left + this.revisionWidth 
/ 2
                        );
 
-                       olderLeftPos = 
this.pointerOlder.getView().getElement().position().left;
-                       newerLeftPos = 
this.pointerNewer.getView().getElement().position().left;
+                       if ( pos === lastValidLeftPos ) {
+                               return pos;
+                       }
 
-                       if ( ui.position.left === ( isNew ? olderLeftPos : 
newerLeftPos ) ) {
-                               ui.position.left = lastValidLeftPos;
-                       } else {
-                               lastValidLeftPos = ui.position.left;
-                               if ( this.dir === 'ltr' ) {
-                                       this.resetPointerColorsBasedOnValues( 
olderLeftPos, newerLeftPos );
+                       $revisions = this.getRevisionsElement();
+                       $hoveredRevisionWrapper = this.getRevElementAtPosition( 
$revisions, pos ).parent();
+                       this.slider.getRevisions().getView().showTooltip( 
$hoveredRevisionWrapper );
+
+                       return pos;
+               },
+
+               getRevisionPositionFromLeftOffset: function ( leftOffset ) {
+                       var $revisions = this.getRevisionsElement(),
+                               revisionsX = 
mw.libs.revisionSlider.correctElementOffsets( $revisions.offset() ).left,
+                               pos = Math.ceil( Math.abs( leftOffset - 
revisionsX ) / this.revisionWidth );
+
+                       if ( this.dir === 'rtl' ) {
+                               // pre-loading the revisions on the right side 
leads to shifted position numbers
+                               if ( this.slider.isAtStart() ) {
+                                       pos = 
this.slider.getRevisionsPerWindow() - pos + 1;
                                } else {
-                                       this.resetPointerColorsBasedOnValues( 
newerLeftPos, olderLeftPos );
+                                       pos += 
this.slider.getRevisionsPerWindow();
                                }
                        }
 
-                       return lastValidLeftPos;
+                       return pos;
                },
 
                setPointerDragCursor: function () {
@@ -920,8 +929,14 @@
                        this.slider.setRevisionsPerWindow( 
expandedRevisionWindowCapacity );
 
                        this.slide( Math.floor( ( 
this.pointerNewer.getPosition() - 1 ) / expandedRevisionWindowCapacity ), 0 );
-               }
+               },
 
+               /**
+                * @return {jQuery}
+                */
+               getRevisionsElement: function () {
+                       return 
this.slider.getRevisions().getView().getElement();
+               }
        } );
 
        mw.libs.revisionSlider = mw.libs.revisionSlider || {};
diff --git a/modules/ext.RevisionSlider.SliderViewTwo.js 
b/modules/ext.RevisionSlider.SliderViewTwo.js
index a565735..ec0030d 100644
--- a/modules/ext.RevisionSlider.SliderViewTwo.js
+++ b/modules/ext.RevisionSlider.SliderViewTwo.js
@@ -115,24 +115,6 @@
                        
SliderViewTwo.super.prototype.resetPointerStylesBasedOnPosition.call( this );
                },
 
-               draggableDragAction: function ( event, ui, pointer, 
lastValidLeftPos ) {
-                       var pos, $revisions, $hoveredRevisionWrapper;
-
-                       pos = this.getRevisionPositionFromLeftOffset(
-                               $( pointer ).offset().left + this.revisionWidth 
/ 2
-                       );
-
-                       if ( pos === lastValidLeftPos ) {
-                               return pos;
-                       }
-
-                       $revisions = this.getRevisionsElement();
-                       $hoveredRevisionWrapper = this.getRevElementAtPosition( 
$revisions, pos ).parent();
-                       this.slider.getRevisions().getView().showTooltip( 
$hoveredRevisionWrapper );
-
-                       return pos;
-               },
-
                setPointerDragCursor: function () {
                        $( '.mw-revslider-pointer, ' +
                                '.mw-revslider-pointer-container, ' +
@@ -203,23 +185,6 @@
                        this.alignPointers();
                },
 
-               getRevisionPositionFromLeftOffset: function ( leftOffset ) {
-                       var $revisions = this.getRevisionsElement(),
-                               revisionsX = 
mw.libs.revisionSlider.correctElementOffsets( $revisions.offset() ).left,
-                               pos = Math.ceil( Math.abs( leftOffset - 
revisionsX ) / this.revisionWidth );
-
-                       if ( this.dir === 'rtl' ) {
-                               // pre-loading the revisions on the right side 
leads to shifted position numbers
-                               if ( this.slider.isAtStart() ) {
-                                       pos = 
this.slider.getRevisionsPerWindow() - pos + 1;
-                               } else {
-                                       pos += 
this.slider.getRevisionsPerWindow();
-                               }
-                       }
-
-                       return pos;
-               },
-
                resetPointerStylesBasedOnPosition: function () {
                        this.updateOlderSliderLineCSS();
                        this.updateNewerSliderLineCSS();
@@ -278,10 +243,6 @@
 
                getDistanceBetweenPointers: function () {
                        return this.pointerNewer.getPosition() - 
this.pointerOlder.getPosition();
-               },
-
-               getRevisionsElement: function () {
-                       return 
this.slider.getRevisions().getView().getElement();
                },
 
                revisionWrapperClickHandler: function () {
diff --git a/tests/browser/features/history.feature 
b/tests/browser/features/history.feature
index 51e20b5..b76b587 100644
--- a/tests/browser/features/history.feature
+++ b/tests/browser/features/history.feature
@@ -3,23 +3,25 @@
   Background:
     Given a page with 4 revision(s) exists
 
-  Scenario: RevisionSlider history can be accessed using browser back and 
forward buttons after clicking on a revision
-    Given I am on the diff page
-    When I have loaded the RevisionSlider and dismissed the help dialog
-    And I click on revision 1 to move the lower pointer
-    And I wait until the diff has loaded
-    And I click on revision 2 to move the upper pointer
-    And I wait until the diff has loaded
-    And I click the browser back button
-    And I wait until the diff has loaded
-    And I click the browser back button
-    And I wait until the diff has loaded
-    And I click the browser forward button
-    And I wait until the diff has loaded
-    Then the lower pointer should be on revision 1
-    And the upper pointer should be on revision 4
-    And revision 1 should be loaded on the left of the diff
-    And revision 4 should be loaded on the right of the diff
+#  Deactivated until bar clicking will be reintroduced see T165831
+#
+#  Scenario: RevisionSlider history can be accessed using browser back and 
forward buttons after clicking on a revision
+#    Given I am on the diff page
+#    When I have loaded the RevisionSlider and dismissed the help dialog
+#    And I click on revision 1 to move the lower pointer
+#    And I wait until the diff has loaded
+#    And I click on revision 2 to move the upper pointer
+#    And I wait until the diff has loaded
+#    And I click the browser back button
+#    And I wait until the diff has loaded
+#    And I click the browser back button
+#    And I wait until the diff has loaded
+#    And I click the browser forward button
+#    And I wait until the diff has loaded
+#    Then the lower pointer should be on revision 1
+#    And the upper pointer should be on revision 4
+#    And revision 1 should be loaded on the left of the diff
+#    And revision 4 should be loaded on the right of the diff
 
   Scenario: RevisionSlider history can be accessed using browser back and 
forward buttons after dragging to a revision
     Given I am on the diff page
diff --git a/tests/browser/features/pointers.feature 
b/tests/browser/features/pointers.feature
index 616635b..b720c2f 100644
--- a/tests/browser/features/pointers.feature
+++ b/tests/browser/features/pointers.feature
@@ -3,17 +3,19 @@
   Background:
     Given a page with 5 revision(s) exists
 
-  Scenario: RevisionSlider pointers move when revision bars are clicked
-    Given I am on the diff page
-    When I have loaded the RevisionSlider and dismissed the help dialog
-    And I click on revision 3 to move the lower pointer
-    And I wait until the diff has loaded
-    And I click on revision 4 to move the upper pointer
-    And I wait until the diff has loaded
-    Then the lower pointer should be on revision 3
-    And the upper pointer should be on revision 4
-    And revision 3 should be loaded on the left of the diff
-    And revision 4 should be loaded on the right of the diff
+#  Deactivated until bar clicking will be reintroduced see T165831
+#
+#  Scenario: RevisionSlider pointers move when revision bars are clicked
+#    Given I am on the diff page
+#    When I have loaded the RevisionSlider and dismissed the help dialog
+#    And I click on revision 3 to move the lower pointer
+#    And I wait until the diff has loaded
+#    And I click on revision 4 to move the upper pointer
+#    And I wait until the diff has loaded
+#    Then the lower pointer should be on revision 3
+#    And the upper pointer should be on revision 4
+#    And revision 3 should be loaded on the left of the diff
+#    And revision 4 should be loaded on the right of the diff
 
   Scenario: RevisionSlider pointers can be dragged
     Given I am on the diff page

-- 
To view, visit https://gerrit.wikimedia.org/r/363157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I347533ef445cb3c37e420beebcc79919e56a1223
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/RevisionSlider
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to