The old share modal used to host both share and invite functionality, under two tabs. The new "Share Topic" modal can be used only for sharing, but has a link to the invite modal. Among the sharing methods, there is also "Notify" which points out that existing users will simply be notified (this was not clear before). Staff members can notify as many users as they want, but regular users are restricted to one at a time, no more than max_topic_invitations_per_day. The user will not receive another notification if they have been notified of the same topic in past hour. The "Create Invite" modal also suffered some changes: the two radio boxes for selecting the type (invite or email) have been replaced by a single checkbox (is email?) and then the two labels about emails have been replaced by a single one, some fields were reordered and the advanced options toggle was moved to the bottom right of the modal.
86 lines
2.4 KiB
JavaScript
86 lines
2.4 KiB
JavaScript
import { click, visit } from "@ember/test-helpers";
|
||
import {
|
||
acceptance,
|
||
exists,
|
||
queryAll,
|
||
} from "discourse/tests/helpers/qunit-helpers";
|
||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||
import { test } from "qunit";
|
||
|
||
acceptance("Share and Invite modal", function (needs) {
|
||
needs.user();
|
||
|
||
test("Topic footer button", async function (assert) {
|
||
await visit("/t/internationalization-localization/280");
|
||
|
||
assert.ok(
|
||
exists("#topic-footer-button-share-and-invite"),
|
||
"the button exists"
|
||
);
|
||
|
||
await click("#topic-footer-button-share-and-invite");
|
||
|
||
assert.ok(exists(".share-topic-modal"), "it shows the modal");
|
||
|
||
assert.ok(
|
||
queryAll("input.invite-link")
|
||
.val()
|
||
.includes("/t/internationalization-localization/280?u=eviltrout"),
|
||
"it shows the topic sharing url"
|
||
);
|
||
|
||
assert.ok(queryAll(".social-link").length > 1, "it shows social sources");
|
||
|
||
assert.ok(
|
||
exists(".btn-primary[aria-label='Notify']"),
|
||
"it shows the notify button"
|
||
);
|
||
|
||
assert.ok(
|
||
exists(".btn-primary[aria-label='Invite']"),
|
||
"it shows the invite button"
|
||
);
|
||
});
|
||
|
||
test("Post date link", async function (assert) {
|
||
await visit("/t/internationalization-localization/280");
|
||
await click("#post_2 .post-info.post-date a");
|
||
|
||
assert.ok(exists("#share-link"), "it shows the share modal");
|
||
});
|
||
});
|
||
|
||
acceptance("Share and Invite modal - mobile", function (needs) {
|
||
needs.user();
|
||
needs.mobileView();
|
||
|
||
test("Topic footer mobile button", async function (assert) {
|
||
await visit("/t/internationalization-localization/280");
|
||
|
||
assert.ok(
|
||
!exists("#topic-footer-button-share-and-invite"),
|
||
"the button doesn’t exist"
|
||
);
|
||
|
||
const subject = selectKit(".topic-footer-mobile-dropdown");
|
||
await subject.expand();
|
||
await subject.selectRowByValue("share-and-invite");
|
||
|
||
assert.ok(exists(".share-topic-modal"), "it shows the modal");
|
||
});
|
||
});
|
||
|
||
acceptance("Share url with badges disabled - desktop", function (needs) {
|
||
needs.user();
|
||
needs.settings({ enable_badges: false });
|
||
test("topic footer button - badges disabled - desktop", async function (assert) {
|
||
await visit("/t/internationalization-localization/280");
|
||
await click("#topic-footer-button-share-and-invite");
|
||
|
||
assert.notOk(
|
||
queryAll("input.invite-link").val().includes("?u=eviltrout"),
|
||
"it doesn't add the username param when badges are disabled"
|
||
);
|
||
});
|
||
});
|