mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Bookmark removal tweaks (#9635)
* Do not show confirmation modal if deleting bookmark from list unless the bookmark has a reminder * Remove the deleted bookmark from the in-memory array for the user list so a full reload of the list is not needed and scrolling is maintained
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
import pretender from "helpers/create-pretender";
|
||||
import userFixtures from "fixtures/user_fixtures";
|
||||
|
||||
acceptance("User's bookmarks", {
|
||||
loggedIn: true,
|
||||
@@ -20,16 +21,25 @@ test("listing user bookmarks", async assert => {
|
||||
assert.ok(find(".bookmark-list-item").length);
|
||||
});
|
||||
|
||||
test("removing a bookmark", async assert => {
|
||||
test("removing a bookmark with a reminder shows a confirmation", async assert => {
|
||||
let listResponse = _.clone(userFixtures["/u/eviltrout/bookmarks.json"]);
|
||||
listResponse.user_bookmark_list.bookmarks[0].reminder_at = "2028-01-01T08:00";
|
||||
pretender.get("/u/eviltrout/bookmarks.json", () => [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
listResponse
|
||||
]);
|
||||
await visit("/u/eviltrout/activity/bookmarks");
|
||||
|
||||
const dropdown = selectKit(".bookmark-actions-dropdown");
|
||||
await dropdown.expand();
|
||||
await dropdown.selectRowByValue("remove");
|
||||
|
||||
assert.ok(exists(".bootbox.modal"));
|
||||
assert.ok(exists(".bootbox.modal"), "it asks for delete confirmation");
|
||||
|
||||
await click(".bootbox.modal .btn-primary");
|
||||
await click(".bootbox.modal a.btn-primary");
|
||||
assert.not(exists(".bootbox.modal"));
|
||||
listResponse.user_bookmark_list.bookmarks[0].reminder_at = null;
|
||||
});
|
||||
|
||||
test("listing users bookmarks - no bookmarks", async assert => {
|
||||
@@ -48,3 +58,13 @@ test("listing users bookmarks - no bookmarks", async assert => {
|
||||
|
||||
assert.equal(find(".alert.alert-info").text(), "no bookmarks");
|
||||
});
|
||||
|
||||
test("removing a bookmark with no reminder does not show a confirmation", async assert => {
|
||||
await visit("/u/eviltrout/activity/bookmarks");
|
||||
|
||||
const dropdown = selectKit(".bookmark-actions-dropdown");
|
||||
await dropdown.expand();
|
||||
await dropdown.selectRowByValue("remove");
|
||||
|
||||
assert.not(exists(".bootbox.modal"), "it should not show the modal");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user