Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/components/Viewer/ObjectTree/Base/CommonTreeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ function handleNormalClick(item: DisplayItem, index: number | undefined): void {
if (index !== undefined) {
lastActiveIndex.value = index;
}
toggleSelect(item.raw);
emit("click:item", item.raw);
}

Expand Down
1 change: 0 additions & 1 deletion app/components/Viewer/ObjectTree/Views/ModelTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ function getLeafViewerIds(item: CollectionTreeItem): number[] {
:scroll-top="currentView?.scrollTop || 0"
class="transparent-treeview virtual-tree-height"
@update:selected="(val) => onUpdateSelection(val as string[])"
@click:item="onUpdateSelection([$event.id as string, ...visibleComponents])"
@update:scroll-top="treeviewStore.setScrollTop(id, $event)"
@hover:enter="
({ item, immediate }) =>
Expand Down
35 changes: 35 additions & 0 deletions tests/unit/components/ObjectTreeClick.nuxt.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Third party imports
import { describe, expect, test, vi } from "vitest";
import { mountSuspended } from "@nuxt/test-utils/runtime";

// Local imports
import { setupActivePinia, vuetify } from "@ogw_tests/utils";
import CommonTreeView from "@ogw_front/components/Viewer/ObjectTree/Base/CommonTreeView.vue";

vi.setConfig({ testTimeout: 10_000 });

const items = [
{ id: "mesh1", title: "Mesh 1" },
{ id: "mesh2", title: "Mesh 2" },
];

describe("object tree row click", () => {
const pinia = setupActivePinia();

test.each([
{ name: "a hidden item", selected: [] },
{ name: "a visible item", selected: ["mesh2"] },
])("clicking $name activates it without changing its visibility", async ({ selected }) => {
const wrapper = await mountSuspended(CommonTreeView, {
global: { plugins: [vuetify, pinia] },
props: { items, selected },
});
const rows = wrapper.findAll("[data-testid='treeRowWrapper']");
expect(rows).toHaveLength(items.length);

await rows[1]?.trigger("click");

expect(wrapper.emitted("update:active")?.at(-1)).toStrictEqual([["mesh2"]]);
expect(wrapper.emitted("update:selected")).toBeUndefined();
});
});
Loading