Improve superuser invoicing and system status views

This commit is contained in:
Jeppe B
2026-07-14 15:41:05 +02:00
parent 0edf8afcaf
commit 4fbb0b98c3
46 changed files with 10065 additions and 199 deletions
+67
View File
@@ -0,0 +1,67 @@
// @vitest-environment jsdom
import { flushPromises, mount } from "@vue/test-utils";
import { describe, expect, it, vi } from "vitest";
import BuefyTree from "@/components/buefy/tree/BuefyTree.vue";
vi.mock("buefy", () => ({
BCheckbox: {
name: "BCheckbox",
props: {
modelValue: Boolean,
indeterminate: Boolean,
disabled: Boolean,
},
emits: ["update:modelValue"],
template: `
<button
class="b-checkbox-stub"
type="button"
:disabled="disabled"
:data-checked="modelValue"
:data-indeterminate="indeterminate"
@click="$emit('update:modelValue', !modelValue)"
></button>
`,
},
}));
describe("BuefyTree checkbox selection", () => {
it("uses non-selectable checkable categories as lazy select-all branch controllers", async () => {
const load = vi.fn(async () => [
{ id: "order:70128", label: "Ordre #70128", selectable: true, isLeaf: true },
{ id: "order:70129", label: "Ordre #70129", selectable: true, isLeaf: true },
]);
const wrapper = mount(BuefyTree, {
props: {
data: [
{
id: "category:orders",
label: "Orders",
selectable: false,
checkable: true,
isLeaf: false,
},
],
selectionMode: "checkbox",
lazy: true,
load,
},
});
await wrapper.find(".b-checkbox-stub").trigger("click");
await flushPromises();
expect(load).toHaveBeenCalledTimes(1);
expect(wrapper.emitted("update:checkedKeys")?.at(-1)?.[0]).toEqual([
"order:70128",
"order:70129",
]);
await wrapper.find(".b-checkbox-stub").trigger("click");
await flushPromises();
expect(load).toHaveBeenCalledTimes(1);
expect(wrapper.emitted("update:checkedKeys")?.at(-1)?.[0]).toEqual([]);
});
});