Bmansurov has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189870

Change subject: WIP: Unbreak browser tests
......................................................................

WIP: Unbreak browser tests

Also remove old code.

Follow up on I837297df3db23d24991f58897f83b53774bc3de7

Change-Id: If6cd5dbaec7ea08c446f2757cf0b7b92c87f6e1e
---
M includes/Resources.php
M javascripts/modules/editor/EditorOverlayBase.js
M javascripts/modules/editor/VisualEditorOverlay.js
M templates/modules/editor/editHeader.hogan
D templates/modules/editor/switcher.hogan
M tests/browser/features/editor_ve.feature
M tests/browser/features/support/pages/article_page.rb
7 files changed, 15 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/70/189870/1

diff --git a/includes/Resources.php b/includes/Resources.php
index 8568b36..82e2b9c 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -445,7 +445,6 @@
                        'less/modules/editor/editor.less',
                ),
                'templates' => array(
-                       'switcher.hogan' => 
'templates/modules/editor/switcher.hogan',
                        'editHeader.hogan' => 
'templates/modules/editor/editHeader.hogan',
                        'previewHeader.hogan' => 
'templates/modules/editor/previewHeader.hogan',
                        'saveHeader.hogan' => 
'templates/modules/editor/saveHeader.hogan',
diff --git a/javascripts/modules/editor/EditorOverlayBase.js 
b/javascripts/modules/editor/EditorOverlayBase.js
index 5d00f30..d849885 100644
--- a/javascripts/modules/editor/EditorOverlayBase.js
+++ b/javascripts/modules/editor/EditorOverlayBase.js
@@ -22,9 +22,6 @@
                 * @cfg {Object} defaults Default options hash.
                 * @cfg {Boolean} defaults.hasToolbar Whether the editor has a 
toolbar or not. When
                 *  disabled a header will be show instead.
-                * @cfg {String} defaults.switcherButton HTML of the editor 
switcher button.
-                * @cfg {String} defaults.sourceButton HTML of the button that 
shows the page source.
-                * @cfg {String} defaults.veButton HTML of the button that 
opens the Visual Editor.
                 * @cfg {String} defaults.continueMsg Caption for the next 
button on edit form which takes
                 * you to the screen that shows a preview and license 
information.
                 * @cfg {String} defaults.cancelMsg Caption for cancel button 
on edit form.
@@ -46,25 +43,6 @@
                 */
                defaults: $.extend( {}, Overlay.prototype.defaults, {
                        hasToolbar: false,
-                       switcherButton: new Icon( {
-                               tagName: 'button',
-                               name: 'edit-switch',
-                               // Label required to prevent height rendering 
bug
-                               label: '\u00a0',
-                               additionalClassNames: 'editor-switcher'
-                       } ).toHtmlString(),
-                       sourceButton: new Icon( {
-                               name: 'edit-source',
-                               additionalClassNames: 'icon-32px editor-choice',
-                               hasText: true,
-                               label: mw.msg( 
'mobile-frontend-editor-source-editor' )
-                       } ).toHtmlString(),
-                       veButton: new Icon( {
-                               name: 'edit-ve',
-                               additionalClassNames: 'icon-32px editor-choice',
-                               hasText: true,
-                               label: mw.msg( 
'mobile-frontend-editor-visual-editor' )
-                       } ).toHtmlString(),
                        continueMsg: mw.msg( 'mobile-frontend-editor-continue' 
),
                        cancelMsg: mw.msg( 'mobile-frontend-editor-cancel' ),
                        closeMsg: mw.msg( 'mobile-frontend-editor-keep-editing' 
),
@@ -84,7 +62,6 @@
                } ),
                /** @inheritdoc **/
                templatePartials: {
-                       switcher: mw.template.get( 'mobile.editor.common', 
'switcher.hogan' ),
                        editHeader: mw.template.get( 'mobile.editor.common', 
'editHeader.hogan' ),
                        previewHeader: mw.template.get( 'mobile.editor.common', 
'previewHeader.hogan' ),
                        saveHeader: mw.template.get( 'mobile.editor.common', 
'saveHeader.hogan' )
@@ -143,6 +120,7 @@
 
                        // FIXME: use generic method for following 3 lines
                        pageApi.invalidatePage( title );
+                       console.log('save complete', self);
 
                        if ( this.isNewPage ) {
                                msg = 'mobile-frontend-editor-success-new-page';
@@ -302,6 +280,8 @@
                         * @constructor
                         */
                        function EditVeTool( toolGroup, config ) {
+                               config = config || {};
+                               config.classes = [ 'visual-editor' ];
                                EditVeTool.super.call( this, toolGroup, config 
);
                        }
                        OO.inheritClass( EditVeTool, OO.ui.Tool );
@@ -324,6 +304,8 @@
                         * @constructor
                         */
                        function EditSourceTool( toolGroup, config ) {
+                               config = config || {};
+                               config.classes = [ 'source-editor' ];
                                EditSourceTool.super.call( this, toolGroup, 
config );
                        }
 
@@ -340,7 +322,9 @@
                                // will be overridden later
                        };
 
-                       toolbar = new OO.ui.Toolbar( toolFactory, 
toolGroupFactory );
+                       toolbar = new OO.ui.Toolbar( toolFactory, 
toolGroupFactory, {
+                               classes: [ 'editor-switcher' ]
+                       } );
                        toolFactory.register( EditVeTool );
                        toolFactory.register( EditSourceTool );
 
diff --git a/javascripts/modules/editor/VisualEditorOverlay.js 
b/javascripts/modules/editor/VisualEditorOverlay.js
index cc1a155..ee37655 100644
--- a/javascripts/modules/editor/VisualEditorOverlay.js
+++ b/javascripts/modules/editor/VisualEditorOverlay.js
@@ -183,6 +183,7 @@
                                this.docToSave = 
ve.dm.converter.getDomFromModel( doc );
                        }
                        this.target.prepareCacheKey( this.docToSave ).done( 
function () {
+                               console.log( 'a', self.target );
                                self.target.save( self.docToSave, options );
                        } );
                },
@@ -209,6 +210,7 @@
                },
                /** @inheritdoc **/
                onSaveComplete: function () {
+                       console.log('complete');
                        EditorOverlayBase.prototype.onSaveComplete.apply( this, 
arguments );
                        this.clearSpinner();
                        this.destroyTarget();
diff --git a/templates/modules/editor/editHeader.hogan 
b/templates/modules/editor/editHeader.hogan
index e3622f0..85ab01b 100644
--- a/templates/modules/editor/editHeader.hogan
+++ b/templates/modules/editor/editHeader.hogan
@@ -9,7 +9,8 @@
        {{/hasToolbar}}
        {{#hasToolbar}}<div class="toolbar"></div>{{/hasToolbar}}
        {{#editSwitcher}}
-       {{>switcher}}
+               <div class="switcher-container">
+               </div>
        {{/editSwitcher}}
        {{^readOnly}}
        <div class="overlay-action"><button class="continue" 
disabled>{{continueMsg}}</button></div>
diff --git a/templates/modules/editor/switcher.hogan 
b/templates/modules/editor/switcher.hogan
deleted file mode 100644
index c24c8ec..0000000
--- a/templates/modules/editor/switcher.hogan
+++ /dev/null
@@ -1,8 +0,0 @@
-<div class="switcher-container">
-       {{{switcherButton}}}
-       <div class="switcher-drop-down">
-               <div class="mw-ui-button visual-editor 
{{#isVisualEditor}}selected{{/isVisualEditor}}">
-               {{{veButton}}}</div><!--
-               --><div class="mw-ui-button source-editor 
{{^isVisualEditor}}selected{{/isVisualEditor}}">{{{sourceButton}}}</span></div>
-       </div>
-</div>
diff --git a/tests/browser/features/editor_ve.feature 
b/tests/browser/features/editor_ve.feature
index 92c0019..4670fad 100644
--- a/tests/browser/features/editor_ve.feature
+++ b/tests/browser/features/editor_ve.feature
@@ -5,23 +5,7 @@
     Given I am logged into the mobile website
       And I am in beta mode
       And I am editing a new article with VisualEditor
-
-  Scenario: Switch from VisualEditor to source editor
-    When I switch to editing the source
-      And I see the wikitext editor overlay
-      And I click the wikitext editor overlay close button
-    Then I should not see the wikitext editor overlay
-
-  Scenario: VisualEditor edit controls
-    When I look at the VisualEditor toolbar
-    Then I should see a bold button
-      And I should see an italicize button
-
   Scenario: I can edit a page using VisualEditor
     When I edit the article using VisualEditor
     Then I should see the edit reflected in the article content
 
-  Scenario: Going back from save screen in VisualEditor
-    When I click the escape button
-    Then I should see the article content
-      And I should no longer see the VisualEditor
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index e627bc9..4bd6372 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -86,9 +86,9 @@
   div(:toc, css: '.toc-mobile')
 
   # editor (common)
-  button(:overlay_editor_mode_switcher, css: '.editor-switcher')
-  div(:source_editor_button, css: '.source-editor')
-  div(:visual_editor_button, css: '.visual-editor')
+  span(:overlay_editor_mode_switcher, css: '.editor-switcher 
.oo-ui-indicatorElement-indicator')
+  span(:source_editor_button, css: '.source-editor .oo-ui-icon-edit-source')
+  span(:visual_editor_button, css: '.visual-editor .oo-ui-icon-edit-ve')
 
   # editor
   textarea(:editor_textarea, class: 'wikitext-editor')

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6cd5dbaec7ea08c446f2757cf0b7b92c87f6e1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>

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

Reply via email to