From 989d52a8547d5bde0a7528f622394e46c84bcbd5 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 4 May 2017 10:30:16 +0800 Subject: [PATCH] FIX: Show share popup only for valid buttons. --- .../discourse/components/share-popup.js.es6 | 2 +- test/javascripts/acceptance/topic-test.js.es6 | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/components/share-popup.js.es6 b/app/assets/javascripts/discourse/components/share-popup.js.es6 index a2857927175..24f64262c36 100644 --- a/app/assets/javascripts/discourse/components/share-popup.js.es6 +++ b/app/assets/javascripts/discourse/components/share-popup.js.es6 @@ -93,7 +93,7 @@ export default Ember.Component.extend({ return true; }); - $html.on('click.discoure-share-link', '[data-share-url]', e => { + $html.on('click.discoure-share-link', 'button[data-share-url]', e => { // if they want to open in a new tab, let it so if (wantsNewWindow(e)) { return true; } diff --git a/test/javascripts/acceptance/topic-test.js.es6 b/test/javascripts/acceptance/topic-test.js.es6 index ea8471d71c5..698240b3e54 100644 --- a/test/javascripts/acceptance/topic-test.js.es6 +++ b/test/javascripts/acceptance/topic-test.js.es6 @@ -7,7 +7,7 @@ test("Share Popup", () => { ok(!exists('#share-link.visible'), 'it is not visible'); }); - click("[data-share-url]:eq(0)"); + click("button[data-share-url]"); andThen(() => { ok(exists('#share-link.visible'), 'it shows the popup'); }); @@ -16,6 +16,16 @@ test("Share Popup", () => { andThen(() => { ok(!exists('#share-link.visible'), 'it closes the popup'); }); + + click('#topic-footer-buttons .btn.create'); + fillIn('.d-editor-input', '

Click

'); + + click('#reply-control .btn.create'); + click('h2 div[data-share-url]'); + + andThen(() => { + ok(!exists('#share-link.visible'), 'it does not show the popup'); + }); }); test("Showing and hiding the edit controls", () => {