UX: puts back share-panel as floating pane on post actions (#7066)

This commit is contained in:
Joffrey JAFFEUX
2019-02-26 14:15:25 +01:00
committed by GitHub
parent 6ea9f5c9c5
commit d04c4bf8e7
14 changed files with 367 additions and 186 deletions
@@ -68,34 +68,5 @@ QUnit.test("Post date link", async assert => {
await visit("/t/internationalization-localization/280");
await click("#post_2 .post-info.post-date a");
assert.ok(exists(".share-and-invite.modal"), "it shows the modal");
assert.ok(
exists(".share-and-invite.modal .modal-tab.share"),
"it shows the share tab"
);
assert.ok(
exists(".share-and-invite.modal .modal-tab.share.single-tab"),
"it shows only one tab"
);
assert.ok(
!exists(".share-and-invite.modal .modal-tab.invite"),
"it doesnt show the invite tab"
);
assert.ok(
find(".share-and-invite.modal .modal-panel.share .title")
.text()
.includes("Post #2, Feb"),
"it shows the post number with the date"
);
assert.ok(
find(".share-and-invite.modal .modal-panel.share .topic-share-url")
.val()
.includes("/t/internationalization-localization/280/2?u=eviltrout"),
"it shows the topic sharing url including the post number"
);
assert.ok(exists("#share-link"), "it shows the share modal");
});
@@ -57,20 +57,5 @@ QUnit.test("Post date link", async assert => {
await visit("/t/internationalization-localization/280");
await click("#post_2 .post-info.post-date a");
assert.ok(exists(".share-and-invite.modal"), "it shows the modal");
assert.ok(
exists(".share-and-invite.modal .modal-tab.share"),
"it shows the share tab"
);
assert.ok(
exists(".share-and-invite.modal .modal-tab.share.single-tab"),
"it shows only one tab"
);
assert.ok(
!exists(".share-and-invite.modal .modal-tab.invite"),
"it doesnt show the invite tab"
);
assert.ok(exists("#share-link"), "it shows the share modal");
});
@@ -24,12 +24,9 @@ acceptance("Topic", {
QUnit.test("Share Modal", async assert => {
await visit("/t/internationalization-localization/280");
await click(".topic-post:first-child button.share");
assert.ok(
exists(".modal.share-and-invite"),
"it shows the share and invite modal"
);
assert.ok(exists("#share-link"), "it shows the share modal");
});
QUnit.test("Showing and hiding the edit controls", async assert => {
@@ -0,0 +1,16 @@
import componentTest from "helpers/component-test";
moduleForComponent("share-button", { integration: true });
componentTest("share button", {
template: '{{share-button url="https://eviltrout.com"}}',
test(assert) {
assert.ok(find(`button.share`).length, "it has all the classes");
assert.ok(
find('button[data-share-url="https://eviltrout.com"]').length,
"it has the data attribute for sharing"
);
}
});
@@ -0,0 +1,13 @@
import Button from "discourse/components/d-button";
export default Button.extend({
classNames: ["btn-default", "share"],
icon: "link",
title: "topic.share.help",
label: "topic.share.title",
attributeBindings: ["url:data-share-url"],
click() {
return true;
}
});