Loading client/src/components/Page/PageList.test.js +20 −22 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import flushPromises from "flush-promises"; import { PiniaVuePlugin } from "pinia"; import { createTestingPinia } from "@pinia/testing"; import { parseISO, formatDistanceToNow } from "date-fns"; import { useUserStore } from "stores/userStore"; jest.mock("app"); Loading Loading @@ -95,13 +96,26 @@ describe("PgeList.vue", () => { const mockPublishedPageData = [publishedPage]; const mockTwoPageData = [privatePage, pageA]; function mountPersonalGrid() { function mountGrid(propsData) { const pinia = createTestingPinia(); const userStore = useUserStore(); userStore.currentUser = { username: "jimmyPage", tags_used: [] }; wrapper = mount(PageList, { propsData: propsDataPersonalGrid, propsData, localVue, pinia, }); } function mountPersonalGrid() { mountGrid(propsDataPersonalGrid); } function mountPublishedGrid() { mountGrid(propsDataPublishedGrid); } describe(" with empty page list", () => { beforeEach(async () => { axiosMock.onAny().reply(200, [], { total_matches: "0" }); Loading Loading @@ -135,11 +149,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPersonalGrid, localVue, pinia: createTestingPinia(), }); mountPersonalGrid(); await flushPromises(); }); Loading Loading @@ -202,11 +212,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = true; }); wrapper = mount(PageList, { propsData: propsDataPersonalGrid, localVue, pinia: createTestingPinia(), }); mountPersonalGrid(); await flushPromises(); }); it("updates filter when published icon is clicked", async () => { Loading Loading @@ -241,11 +247,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPublishedGrid, localVue, pinia: createTestingPinia(), }); mountPublishedGrid(); await flushPromises(); }); Loading Loading @@ -282,11 +284,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPublishedGrid, localVue, pinia: createTestingPinia(), }); mountPublishedGrid(); await flushPromises(); }); Loading client/src/components/Page/PageList.vue +9 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ <StatelessTags :value="row.item.tags" :index="row.index" :disabled="published" :disabled="published || !currentUserOwnsItem(row.item)" @input="(tags) => onTags(tags, row.index)" @tag-click="onTagClick" /> </template> Loading Loading @@ -80,6 +80,7 @@ <script> import _l from "utils/localization"; import { getAppRoot } from "onload/loadConfig"; import { storeToRefs } from "pinia"; import { updateTags } from "./services"; import { pagesProvider } from "components/providers/PageProvider"; import StatelessTags from "components/TagsMultiselect/StatelessTags"; Loading @@ -94,6 +95,8 @@ import { absPath } from "@/utils/redirect"; import { useRouter } from "vue-router/composables"; import { getGalaxyInstance } from "app"; import { useUserStore } from "@/stores/userStore"; import SharingIndicators from "components/Indices/SharingIndicators"; const helpHtml = `<div> Loading Loading @@ -155,8 +158,10 @@ export default { }, setup() { const router = useRouter(); const { currentUser } = storeToRefs(useUserStore()); return { router, currentUser, }; }, data() { Loading Loading @@ -229,6 +234,9 @@ export default { shareLink: function (item) { this.router.push(`sharing?id=${item.id}`); }, currentUserOwnsItem: function (item) { return item.username === this.currentUser.username; }, decorateData(page) { const Galaxy = getGalaxyInstance(); page.shared = page.username !== Galaxy.user.attributes.username; Loading Loading
client/src/components/Page/PageList.test.js +20 −22 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import flushPromises from "flush-promises"; import { PiniaVuePlugin } from "pinia"; import { createTestingPinia } from "@pinia/testing"; import { parseISO, formatDistanceToNow } from "date-fns"; import { useUserStore } from "stores/userStore"; jest.mock("app"); Loading Loading @@ -95,13 +96,26 @@ describe("PgeList.vue", () => { const mockPublishedPageData = [publishedPage]; const mockTwoPageData = [privatePage, pageA]; function mountPersonalGrid() { function mountGrid(propsData) { const pinia = createTestingPinia(); const userStore = useUserStore(); userStore.currentUser = { username: "jimmyPage", tags_used: [] }; wrapper = mount(PageList, { propsData: propsDataPersonalGrid, propsData, localVue, pinia, }); } function mountPersonalGrid() { mountGrid(propsDataPersonalGrid); } function mountPublishedGrid() { mountGrid(propsDataPublishedGrid); } describe(" with empty page list", () => { beforeEach(async () => { axiosMock.onAny().reply(200, [], { total_matches: "0" }); Loading Loading @@ -135,11 +149,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPersonalGrid, localVue, pinia: createTestingPinia(), }); mountPersonalGrid(); await flushPromises(); }); Loading Loading @@ -202,11 +212,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = true; }); wrapper = mount(PageList, { propsData: propsDataPersonalGrid, localVue, pinia: createTestingPinia(), }); mountPersonalGrid(); await flushPromises(); }); it("updates filter when published icon is clicked", async () => { Loading Loading @@ -241,11 +247,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPublishedGrid, localVue, pinia: createTestingPinia(), }); mountPublishedGrid(); await flushPromises(); }); Loading Loading @@ -282,11 +284,7 @@ describe("PgeList.vue", () => { jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => { page.shared = false; }); wrapper = mount(PageList, { propsData: propsDataPublishedGrid, localVue, pinia: createTestingPinia(), }); mountPublishedGrid(); await flushPromises(); }); Loading
client/src/components/Page/PageList.vue +9 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ <StatelessTags :value="row.item.tags" :index="row.index" :disabled="published" :disabled="published || !currentUserOwnsItem(row.item)" @input="(tags) => onTags(tags, row.index)" @tag-click="onTagClick" /> </template> Loading Loading @@ -80,6 +80,7 @@ <script> import _l from "utils/localization"; import { getAppRoot } from "onload/loadConfig"; import { storeToRefs } from "pinia"; import { updateTags } from "./services"; import { pagesProvider } from "components/providers/PageProvider"; import StatelessTags from "components/TagsMultiselect/StatelessTags"; Loading @@ -94,6 +95,8 @@ import { absPath } from "@/utils/redirect"; import { useRouter } from "vue-router/composables"; import { getGalaxyInstance } from "app"; import { useUserStore } from "@/stores/userStore"; import SharingIndicators from "components/Indices/SharingIndicators"; const helpHtml = `<div> Loading Loading @@ -155,8 +158,10 @@ export default { }, setup() { const router = useRouter(); const { currentUser } = storeToRefs(useUserStore()); return { router, currentUser, }; }, data() { Loading Loading @@ -229,6 +234,9 @@ export default { shareLink: function (item) { this.router.push(`sharing?id=${item.id}`); }, currentUserOwnsItem: function (item) { return item.username === this.currentUser.username; }, decorateData(page) { const Galaxy = getGalaxyInstance(); page.shared = page.username !== Galaxy.user.attributes.username; Loading