Merge "Fix talk overlay workflow"

This commit is contained in:
jenkins-bot 2019-02-25 23:12:50 +00:00 committed by Gerrit Code Review
commit a76bd6f9e2
4 changed files with 24 additions and 6 deletions

View File

@ -5,6 +5,8 @@
loadingOverlay = mobile.loadingOverlay,
eventBus = new EventEmitter(),
PageGateway = mobile.PageGateway,
api = new mw.Api(),
gateway = new PageGateway( api ),
// eslint-disable-next-line jquery/no-global-selector
$talk = $( '.talk, [rel="discussion"]' ),
// use the plain return value here - T128273
@ -44,8 +46,6 @@
overlayManager.add( /^\/talk\/?(.*)$/, function ( id ) {
var title = talkTitle.toText(),
api = new mw.Api(),
gateway = new PageGateway( api ),
talkOptions = {
api: api,
title: title,
@ -83,10 +83,23 @@
}
return false;
} );
// After adding a new topic, we need to force a refresh of the talk topics
eventBus.on( 'talk-discussion-added', function () {
// a setTimeout is necessary since talk-discussion-added is fired
// BEFORE the overlay is closed. (FIXME)
window.setTimeout( function () {
// Force a change in the address bar
// This is important is #/talk is the current route
// (e.g. as is the case after the add discussion overlay has closed)
overlayManager.router.navigate( '#/talk/', true );
// We use second parameter to turn on replaceState
// this ensure nobody knows above the route change above!
overlayManager.router.navigate( '#/talk', true );
}, 300 );
} );
}
init();
if ( inTalkNamespace ) {
// reload the page after the new discussion was added
eventBus.on( 'talk-added-wo-overlay', function () {

View File

@ -47,3 +47,8 @@ Then(/^there should be an add discussion button$/) do
# give overlay time to fully load
expect(on(ArticlePage).talkadd_element.when_present(10)).to be_visible
end
Then(/^there should be a save discussion button$/) do
# give overlay time to fully load
expect(on(ArticlePage).talktopic_save_element.when_present(10)).to be_visible
end

View File

@ -191,7 +191,8 @@ class ArticlePage
div(:error_message, css: '.error')
# talk overlay
a(:talkadd, css: '.add.continue')
a(:talkadd, css: '.talk-overlay .continue')
a(:talktopic_save, css: '.overlay .confirm-save')
p(:talk_overlay_content_header, css: '.talk-overlay .content-header')
li(:talk_overlay_first_topic_title, css: '.talk-overlay .topic-title-list li:first-child')
text_field(:talk_overlay_summary, css: '.talk-overlay .summary')

View File

@ -32,9 +32,8 @@ Feature: Talk
Given the page "Talk:Selenium talk test" exists
And I am logged into the mobile website
And I am on the "Talk:Selenium UI test" page
And there should be an add discussion button
When I click the talk button
Then there should be an add discussion button
Then there should be a save discussion button
@integration
Scenario: A newly created topic appears in the list of topics immediately