Loading client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.test.js +12 −11 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ const TASKS_CONFIG = { enable_celery_tasks: true, }; const getMenuSelectorFor = (option) => `[data-description="${option} option"]`; const getPurgedContentSelection = () => new Map([["FAKE_ID", { purged: true }]]); const getNonPurgedContentSelection = () => new Map([["FAKE_ID", { purged: false }]]); Loading Loading @@ -76,48 +77,48 @@ describe("History Selection Operations", () => { }); it("should display 'hide' option only on visible items", async () => { const option = '[data-description="hide option"]'; const option = getMenuSelectorFor("hide"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "visible:false" }); expect(wrapper.find(option).exists()).toBe(false); }); it("should display 'unhide' option on hidden items", async () => { const option = '[data-description="unhide option"]'; const option = getMenuSelectorFor("unhide"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "visible:false" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'unhide' option when hidden and visible items are mixed", async () => { const option = '[data-description="unhide option"]'; const option = getMenuSelectorFor("unhide"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "visible:any" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'delete' option on non-deleted items", async () => { const option = '[data-description="delete option"]'; const option = getMenuSelectorFor("delete"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "deleted:true" }); expect(wrapper.find(option).exists()).toBe(false); }); it("should display 'delete' option when non-deleted and deleted items are mixed", async () => { const option = '[data-description="delete option"]'; const option = getMenuSelectorFor("delete"); await wrapper.setProps({ filterText: "deleted:any" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'permanently delete' option always", async () => { const option = '[data-description="purge option"]'; const option = getMenuSelectorFor("purge"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "deleted:true" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'undelete' option on deleted and non-purged items", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "deleted:true", Loading @@ -127,7 +128,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when non-purged items (deleted or not) are mixed", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); await wrapper.setProps({ filterText: "deleted:any", contentSelection: getNonPurgedContentSelection(), Loading @@ -136,7 +137,7 @@ describe("History Selection Operations", () => { }); it("should not display 'undelete' when is manual selection mode and all selected items are purged", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); await wrapper.setProps({ filterText: "deleted:true", contentSelection: getPurgedContentSelection(), Loading @@ -146,7 +147,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when is query selection mode and filtering by deleted", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); // In query selection mode we don't know if some items may not be purged, so we allow to undelete await wrapper.setProps({ filterText: "deleted:true", Loading @@ -157,7 +158,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when is query selection mode and filtering by any deleted state", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); // In query selection mode we don't know if some items may not be purged, so we allow to undelete await wrapper.setProps({ filterText: "deleted:any", Loading Loading
client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.test.js +12 −11 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ const TASKS_CONFIG = { enable_celery_tasks: true, }; const getMenuSelectorFor = (option) => `[data-description="${option} option"]`; const getPurgedContentSelection = () => new Map([["FAKE_ID", { purged: true }]]); const getNonPurgedContentSelection = () => new Map([["FAKE_ID", { purged: false }]]); Loading Loading @@ -76,48 +77,48 @@ describe("History Selection Operations", () => { }); it("should display 'hide' option only on visible items", async () => { const option = '[data-description="hide option"]'; const option = getMenuSelectorFor("hide"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "visible:false" }); expect(wrapper.find(option).exists()).toBe(false); }); it("should display 'unhide' option on hidden items", async () => { const option = '[data-description="unhide option"]'; const option = getMenuSelectorFor("unhide"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "visible:false" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'unhide' option when hidden and visible items are mixed", async () => { const option = '[data-description="unhide option"]'; const option = getMenuSelectorFor("unhide"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "visible:any" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'delete' option on non-deleted items", async () => { const option = '[data-description="delete option"]'; const option = getMenuSelectorFor("delete"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "deleted:true" }); expect(wrapper.find(option).exists()).toBe(false); }); it("should display 'delete' option when non-deleted and deleted items are mixed", async () => { const option = '[data-description="delete option"]'; const option = getMenuSelectorFor("delete"); await wrapper.setProps({ filterText: "deleted:any" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'permanently delete' option always", async () => { const option = '[data-description="purge option"]'; const option = getMenuSelectorFor("purge"); expect(wrapper.find(option).exists()).toBe(true); await wrapper.setProps({ filterText: "deleted:true" }); expect(wrapper.find(option).exists()).toBe(true); }); it("should display 'undelete' option on deleted and non-purged items", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); expect(wrapper.find(option).exists()).toBe(false); await wrapper.setProps({ filterText: "deleted:true", Loading @@ -127,7 +128,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when non-purged items (deleted or not) are mixed", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); await wrapper.setProps({ filterText: "deleted:any", contentSelection: getNonPurgedContentSelection(), Loading @@ -136,7 +137,7 @@ describe("History Selection Operations", () => { }); it("should not display 'undelete' when is manual selection mode and all selected items are purged", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); await wrapper.setProps({ filterText: "deleted:true", contentSelection: getPurgedContentSelection(), Loading @@ -146,7 +147,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when is query selection mode and filtering by deleted", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); // In query selection mode we don't know if some items may not be purged, so we allow to undelete await wrapper.setProps({ filterText: "deleted:true", Loading @@ -157,7 +158,7 @@ describe("History Selection Operations", () => { }); it("should display 'undelete' option when is query selection mode and filtering by any deleted state", async () => { const option = '[data-description="undelete option"]'; const option = getMenuSelectorFor("undelete"); // In query selection mode we don't know if some items may not be purged, so we allow to undelete await wrapper.setProps({ filterText: "deleted:any", Loading