jenkins-bot has submitted this change and it was merged. Change subject: Preview of Summarize displays as empty ......................................................................
Preview of Summarize displays as empty Bug: 70200 Change-Id: Ibf53fdc7f3c67c7259fcc6d761b2bcada728ca03 --- M modules/new/components/flow-board.js M tests/qunit/new/components/test_flow-board.js 2 files changed, 35 insertions(+), 2 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 194b3cf..cdba869 100644 --- a/modules/new/components/flow-board.js +++ b/modules/new/components/flow-board.js @@ -753,12 +753,18 @@ replies: [ id ], isPreview: true }; + templateParams = {}; + + // This is for most previews which expect a "revision" key revision[contentNode] = { content: data['flow-parsoid-utils'].content, format: data['flow-parsoid-utils'].format }; + // This fixes summarize which expects a key "summary" + templateParams[contentNode] = revision[contentNode]; - templateParams = { + $.extend( templateParams, { + // This fixes titlebar which expects a key "content" for title content: { content: $titleField.val() || '', format: 'content' @@ -771,7 +777,7 @@ last_updated: +new Date(), replies: [ id ], revisions: {} - }; + } ); templateParams.posts[id] = { 0: id }; templateParams.revisions[id] = revision; diff --git a/tests/qunit/new/components/test_flow-board.js b/tests/qunit/new/components/test_flow-board.js index 3b71c69..abf78aa 100644 --- a/tests/qunit/new/components/test_flow-board.js +++ b/tests/qunit/new/components/test_flow-board.js @@ -45,4 +45,31 @@ 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 ) { + var $container = this.$el, + $form = $( '<form>' ).appendTo( $container ), + $textarea = $( '<textarea data-flow-preview-template="flow_topic_titlebar_summary" data-flow-preview-node="summary">text</textarea>' ).appendTo( $form ), + $btn = $( '<button name="preview">' ). + appendTo( $form ), + info = { + $target: $textarea, + status: 'done' + }, + data = { + 'flow-parsoid-utils': { + format: 'html', + content: 'hello' + } + }; + + this.UI.events.apiHandlers.preview.call( $btn, info, data ); + + // check all is well. + assert.strictEqual( $container.find( '.flow-preview-warning' ).length, 1, + 'There is a preview warning.' ); + assert.strictEqual( $container.find( '.flow-topic-summary' ).length, 1, 'Summary visible.' ); + assert.strictEqual( $.trim( $container.find( '.flow-topic-summary' ).text() ), + 'hello', 'Check content of summary.' ); +} ); + } ( jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/158142 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibf53fdc7f3c67c7259fcc6d761b2bcada728ca03 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Bsitu <bs...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: SG <shah...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits