FIX: Show share popup only for valid buttons.

This commit is contained in:
Guo Xiang Tan 2017-05-04 10:30:16 +08:00 committed by Robin Ward
parent 790acfd99f
commit 989d52a854
2 changed files with 12 additions and 2 deletions

View File

@ -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; }

View File

@ -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', '<h2><div data-share-url="something">Click</button><h2>');
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", () => {