jenkins-bot has submitted this change and it was merged.

Change subject: Hide 'Cancel' button on preview screen
......................................................................


Hide 'Cancel' button on preview screen

Remove the cancel test in qunit since there is no cancel button
in preview screen anymore

Change-Id: Id9f7fd04702d1b583dc67bb2dcb7505e8b857e83
---
M modules/new/components/flow-board.js
M tests/qunit/new/components/test_flow-board.js
2 files changed, 8 insertions(+), 13 deletions(-)

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



diff --git a/modules/new/components/flow-board.js 
b/modules/new/components/flow-board.js
index 203b941..04a5c69 100644
--- a/modules/new/components/flow-board.js
+++ b/modules/new/components/flow-board.js
@@ -738,6 +738,7 @@
                                templateParams,
                                $button = $( this ),
                                $form = $button.closest( 'form' ),
+                               $cancelButton = 
$form.find('.mw-ui-button[data-role="cancel"]'),
                                flowBoard = 
FlowBoardComponent.prototype.getInstanceByElement( $form ),
                                $titleField = $form.find( 'input' ).filter( 
'[data-role=title]' ),
                                $target = info.$target,
@@ -831,18 +832,18 @@
                                .parent( 'form' )
                                .before( $previewContainer );
 
-                       // On cancel, make the preview get removed and reset 
the form back to its original state
-                       flowBoardComponentAddCancelCallback( $form, function () 
{
-                               flowBoardComponentResetPreview( $button );
-                       } );
-
+                       // Hide cancel button on preview screen
+                       $cancelButton.hide();
                        // Assign the reset-preview information for later use
                        $button
                                .data( 'flow-return-to-edit', {
                                        text: $button.text(),
                                        $nodes: $previewContainer
                                } )
-                               .text( 
flowBoard.TemplateEngine.l10n('flow-preview-return-edit-post') );
+                               .text( 
flowBoard.TemplateEngine.l10n('flow-preview-return-edit-post') )
+                               .click( function() {
+                                       $cancelButton.show();
+                               } );
                };
 
                /**
diff --git a/tests/qunit/new/components/test_flow-board.js 
b/tests/qunit/new/components/test_flow-board.js
index c7d9b91..784d54a 100644
--- a/tests/qunit/new/components/test_flow-board.js
+++ b/tests/qunit/new/components/test_flow-board.js
@@ -102,7 +102,7 @@
        assert.strictEqual( $topic.hasClass( 'flow-topic-moderatestate-close' 
), true, 'Has the moderated close state.' );
 } );
 
-QUnit.test( 'FlowBoardComponent.UI.events.apiHandlers.preview', 6, function( 
assert ) {
+QUnit.test( 'FlowBoardComponent.UI.events.apiHandlers.preview', 3, function( 
assert ) {
        var $container = this.$el,
                $form = $( '<form>' ).appendTo( $container ),
                $input = $( '<input value="HEADING">' ).appendTo( $form ),
@@ -126,12 +126,6 @@
        assert.strictEqual( $container.find( '.flow-preview-warning' ).length, 
1, 'There is a preview warning.' );
        assert.strictEqual( $textarea.hasClass( 'flow-preview-target-hidden' ), 
true, 'Textarea is hidden.' );
        assert.strictEqual( $input.hasClass( 'flow-preview-target-hidden' ), 
true, 'Input is hidden.' );
-
-       // now cancel the form
-       this.UI.events.interactiveHandlers.cancelForm.call( $btn, new $.Event() 
);
-       assert.strictEqual( $container.find( '.flow-preview-warning' ).length, 
0, 'There is no preview warning.' );
-       assert.strictEqual( $textarea.hasClass( 'flow-preview-target-hidden' ), 
false, 'Textarea is no longer hidden.' );
-       assert.strictEqual( $input.hasClass( 'flow-preview-target-hidden' ), 
false, 'Input is no longer hidden.' );
 } );
 
 QUnit.test( 'FlowBoardComponent.UI.events.apiHandlers.preview (summary)', 3, 
function( assert ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id9f7fd04702d1b583dc67bb2dcb7505e8b857e83
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to