jenkins-bot has submitted this change and it was merged.
Change subject: Cancelling topic reply preview results in missing form
......................................................................
Cancelling topic reply preview results in missing form
The recent re-addition of mw.flow.editor caused an issue with missing
forms, essentially the preview needs to be undone before the editor
is destroyed.
Bug: 68591
Change-Id: I0490e1ac47a6e1e828d6293983015ba4756673ee
---
M modules/new/components/flow-board.js
M tests/browser/features/reply.feature
M tests/browser/features/step_definitions/reply_steps.rb
M tests/browser/features/support/pages/flow_page.rb
4 files changed, 47 insertions(+), 7 deletions(-)
Approvals:
Jdlrobson: 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 a243ae4..1d9d4cf 100644
--- a/modules/new/components/flow-board.js
+++ b/modules/new/components/flow-board.js
@@ -1764,6 +1764,15 @@
// Store state
$form.data( 'flow-state', 'hidden' );
+ // If any preview is visible cancel it
+ // Must be done before compressing text areas because
+ // the preview may have manipulated them.
+ if ( $form.find( '.flow-preview-warning' ).length ) {
+ flowBoardComponentResetPreview(
+ $form.find(
'button[data-role="cancel"]' )
+ );
+ }
+
$form.find( 'textarea' ).each( function () {
var $editor = $( this );
@@ -1775,13 +1784,6 @@
// Compress all textareas to inputs if needed
FlowBoardComponent.UI.Forms.compressTextarea(
$editor );
} );
-
- // If any preview is visible cancel it
- if ( $form.find( '.flow-preview-warning' ).length ) {
- flowBoardComponentResetPreview(
- $form.find(
'button[data-role="cancel"]' )
- );
- }
if ( initialState === 'collapsed' ) {
// Hide its actions
diff --git a/tests/browser/features/reply.feature
b/tests/browser/features/reply.feature
index 0ca71e3..61a4458 100644
--- a/tests/browser/features/reply.feature
+++ b/tests/browser/features/reply.feature
@@ -15,3 +15,11 @@
And I am not watching my new Flow topic
When I reply with comment "I want to watch this title"
Then I should see an unwatch link on the topic
+
+ Scenario: Canceling reply leaves usable form
+ Given I have created a Flow topic with title "Reply watch test"
+ And I start a reply with comment "my form lies over the ocean"
+ And I click the Preview button
+ And I click the Cancel button and confirm the dialog
+ And I start a reply with comment "bring back my form to me"
+ Then I should see the topic reply form
diff --git a/tests/browser/features/step_definitions/reply_steps.rb
b/tests/browser/features/step_definitions/reply_steps.rb
index 3fdc2e5..a8e77be 100644
--- a/tests/browser/features/step_definitions/reply_steps.rb
+++ b/tests/browser/features/step_definitions/reply_steps.rb
@@ -29,3 +29,32 @@
page.first_topic_unwatch_link_element.should be_visible
end
end
+
+Then(/^I start a reply with comment "(.*?)"$/) do |content|
+ on(FlowPage) do |page|
+ page.new_reply_save_element.when_not_present
+ page.new_reply_input_element.when_present.click
+ page.new_reply_input_element.send_keys(content)
+ end
+end
+
+Then(/^I click the Preview button$/) do
+ on(FlowPage) do |page|
+ page.new_reply_preview_element.when_present.click
+ page.wait_until { page.new_reply_preview_warning_element.visible? }
+ end
+end
+
+Then(/^I click the Cancel button and confirm the dialog$/) do
+ on(FlowPage) do |page|
+ page.confirm(true) do
+ page.new_reply_cancel_element.when_present.click
+ end
+ end
+end
+
+Then(/^I should see the topic reply form$/) do
+ on(FlowPage) do |page|
+ page.wait_until { page.new_reply_input_element.visible? }
+ end
+end
diff --git a/tests/browser/features/support/pages/flow_page.rb
b/tests/browser/features/support/pages/flow_page.rb
index 3450f1c..59c8567 100644
--- a/tests/browser/features/support/pages/flow_page.rb
+++ b/tests/browser/features/support/pages/flow_page.rb
@@ -186,6 +186,7 @@
button(:new_reply_cancel, css: ".flow-reply-form .mw-ui-destructive")
button(:new_reply_preview, css: ".flow-reply-form .mw-ui-progressive")
button(:new_reply_save, css: ".flow-reply-form .mw-ui-constructive")
+ div(:new_reply_preview_warning, css: ".flow-reply-form
.flow-preview-warning")
# Editing post workflow
text_area(:post_edit, css: ".flow-edit-post-form textarea")
--
To view, visit https://gerrit.wikimedia.org/r/149919
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0490e1ac47a6e1e828d6293983015ba4756673ee
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[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