FIX: Show share popup only for valid buttons.

This commit is contained in:
Guo Xiang Tan 2017-05-04 10:30:16 +08:00
parent b3908a1d7f
commit 94c8410521
2 changed files with 12 additions and 2 deletions

View File

@ -93,7 +93,7 @@ export default Ember.Component.extend({
return true; 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 they want to open in a new tab, let it so
if (wantsNewWindow(e)) { return true; } if (wantsNewWindow(e)) { return true; }

View File

@ -7,7 +7,7 @@ test("Share Popup", () => {
ok(!exists('#share-link.visible'), 'it is not visible'); ok(!exists('#share-link.visible'), 'it is not visible');
}); });
click("[data-share-url]:eq(0)"); click("button[data-share-url]");
andThen(() => { andThen(() => {
ok(exists('#share-link.visible'), 'it shows the popup'); ok(exists('#share-link.visible'), 'it shows the popup');
}); });
@ -16,6 +16,16 @@ test("Share Popup", () => {
andThen(() => { andThen(() => {
ok(!exists('#share-link.visible'), 'it closes the popup'); 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", () => { test("Showing and hiding the edit controls", () => {