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

Change subject: Default filter options settings
......................................................................


Default filter options settings

Bug: T162139
Change-Id: I436e086c3dc335bb176bdd37392a215ee70f068b
---
M modules/ext.TwoColConflict.filterOptions.js
M tests/browser/features/filter_options.feature
M tests/browser/features/support/pages/edit_conflict_page.rb
M tests/browser/features/support/step_definitions/edit_conflict_steps.rb
4 files changed, 32 insertions(+), 7 deletions(-)

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



diff --git a/modules/ext.TwoColConflict.filterOptions.js 
b/modules/ext.TwoColConflict.filterOptions.js
index 985ec9b..e192087 100644
--- a/modules/ext.TwoColConflict.filterOptions.js
+++ b/modules/ext.TwoColConflict.filterOptions.js
@@ -15,7 +15,15 @@
                        }
                } );
 
-               $( 'input[name="mw-twocolconflict-same"]' ).change( function() {
+               // select 'both' as the default option
+               $( 'input[name="mw-twocolconflict-show-changes"]' )[ 0 
].click();
+
+               /**
+                * Either shows or hides the text surrounding the diff text
+                *
+                * @param {boolean} show
+                */
+               function surroundingText( show ) {
                        var $changeDiv = 
autoScroll.getFirstVisibleChangesElement(),
                                manualOffset;
 
@@ -24,7 +32,7 @@
                                $( '.mw-twocolconflict-changes-editor' )
                        );
 
-                       if ( $( this ).val() === 'show' ) {
+                       if ( show ) {
                                $( 
'.mw-twocolconflict-diffchange-same-collapsed' ).hide();
                                $( '.mw-twocolconflict-diffchange-same-full' 
).show();
                        } else {
@@ -36,8 +44,15 @@
                        $( '.mw-twocolconflict-diffchange-same-full' 
).promise().done( function() {
                                autoScroll.scrollToChangeWithOffset( 
$changeDiv, manualOffset );
                        } );
+               }
+
+               $( 'input[name="mw-twocolconflict-same"]' ).click( function() {
+                       surroundingText( $( this ).val() === 'show' );
                } );
 
+               // select 'hide' as the default option
+               $( 'input[name="mw-twocolconflict-same"]' )[ 1 ].click();
+
                $( '.mw-twocolconflict-diffchange-same-collapsed' ).click( 
function() {
                        var $changeDiv = $( this ).parent(),
                                manualOffset;
diff --git a/tests/browser/features/filter_options.feature 
b/tests/browser/features/filter_options.feature
index 918a852..b93f593 100644
--- a/tests/browser/features/filter_options.feature
+++ b/tests/browser/features/filter_options.feature
@@ -9,17 +9,18 @@
     When I handle a multi line edit conflict
     And I select the show mine option
     Then The two column edit conflict screen should be shown
+    And The hide unchanged text option should be selected
     And Section for common changes should be there
-    And Section for full common changes should be there
-    And Section for collapsed common changes should not be there
+    And Section for collapsed common changes should be there
+    And Section for full common changes should not be there
     And Section for foreign changes should not be there
 
   Scenario: Hide common changes filter collapses common changes
     When I handle a multi line edit conflict
-    And I select the hide unchanged text option
+    And I select the show unchanged text option
     Then The two column edit conflict screen should be shown
-    And Section for collapsed common changes should be there
-    And Section for full common changes should not be there
+    And Section for full common changes should be there
+    And Section for collapsed common changes should not be there
 
   Scenario: Show hidden common changes when clicking the collapsed text
     When I handle a multi line edit conflict
diff --git a/tests/browser/features/support/pages/edit_conflict_page.rb 
b/tests/browser/features/support/pages/edit_conflict_page.rb
index 72d8f80..3bfc08d 100644
--- a/tests/browser/features/support/pages/edit_conflict_page.rb
+++ b/tests/browser/features/support/pages/edit_conflict_page.rb
@@ -29,6 +29,7 @@
   span(:twocolconflict_option_mine_div, xpath: 
'(//*[@name="mw-twocolconflict-show-changes"]//parent::span)[2]')
 
   radio_button(:twocolconflict_option_show, xpath: 
'(//*[@name="mw-twocolconflict-same"])[1]')
+  radio_button(:twocolconflict_option_hide, xpath: 
'(//*[@name="mw-twocolconflict-same"])[2]')
   span(:twocolconflict_option_show_div, xpath: 
'(//*[@name="mw-twocolconflict-same"]//parent::span)[1]')
   span(:twocolconflict_option_hide_div, xpath: 
'(//*[@name="mw-twocolconflict-same"]//parent::span)[2]')
 
diff --git 
a/tests/browser/features/support/step_definitions/edit_conflict_steps.rb 
b/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
index 3c76b9f..820fc19 100644
--- a/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
+++ b/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
@@ -101,6 +101,10 @@
   
on(EditConflictPage).twocolconflict_option_hide_div_element.when_present.click
 end
 
+When(/^I select the show unchanged text option$/) do
+  
on(EditConflictPage).twocolconflict_option_show_div_element.when_present.click
+end
+
 When(/^I handle an edit conflict$/) do
   step 'I go to the "TwoColConflict Test Page" page with content "I am a 
sentence."'
   step 'I click Edit'
@@ -125,6 +129,10 @@
   expect(on(EditConflictPage).twocolconflict_option_show_selected?).to 
be_truthy
 end
 
+Then(/^The hide unchanged text option should be selected$/) do
+  expect(on(EditConflictPage).twocolconflict_option_hide_selected?).to 
be_truthy
+end
+
 Then(/^The editor view should be scrolled$/) do
   browser.execute_script('$( ".mw-twocolconflict-editor-col textarea" 
).scrollTop() > 0;')
 end

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

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

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

Reply via email to