A Capture → Map → Bind strip with each step's count opens its tab. The tabs follow that order, sit left-aligned at their own width and carry count chips; a count that could not be read stays blank. The Inspector splits into list and detail only when there is a capture to show, and an empty event-types list explains where proposals come from.
87 lines
2.2 KiB
TypeScript
87 lines
2.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
const { EVENTS_TABS, activeTab, availableTabs } =
|
|
await import("../src/events/tab-selection.ts");
|
|
|
|
test("every tab stays when the composition reports nothing", () => {
|
|
assert.deepEqual(
|
|
availableTabs(null).map((t) => t.id),
|
|
["inspector", "mappings", "bindings"],
|
|
);
|
|
assert.deepEqual(
|
|
availableTabs(undefined).map((t) => t.id),
|
|
["inspector", "mappings", "bindings"],
|
|
);
|
|
});
|
|
|
|
test("a tab is offered only when its own capability is backed", () => {
|
|
const ids = availableTabs({
|
|
captures: true,
|
|
bindings: false,
|
|
mappings: true,
|
|
}).map((t) => t.id);
|
|
assert.deepEqual(
|
|
ids,
|
|
["inspector", "mappings"],
|
|
"a capability the server refuses still shows its tab",
|
|
);
|
|
});
|
|
|
|
test("a section the server never mentioned stays visible", () => {
|
|
const ids = availableTabs({ captures: true }).map((t) => t.id);
|
|
assert.deepEqual(
|
|
ids,
|
|
["inspector", "mappings", "bindings"],
|
|
"an unreported section hid its tab",
|
|
);
|
|
});
|
|
|
|
test("the requested tab wins when it is available", () => {
|
|
const available = availableTabs({
|
|
captures: true,
|
|
bindings: true,
|
|
mappings: true,
|
|
});
|
|
assert.equal(activeTab("mappings", available), "mappings");
|
|
});
|
|
|
|
test("a tab this composition cannot back falls back to the first it can", () => {
|
|
const available = availableTabs({
|
|
captures: false,
|
|
bindings: true,
|
|
mappings: false,
|
|
});
|
|
assert.equal(
|
|
activeTab("inspector", available),
|
|
"bindings",
|
|
"a bookmark from a fuller deployment showed nothing",
|
|
);
|
|
assert.equal(
|
|
activeTab("", available),
|
|
"bindings",
|
|
"no tab named did not land on the first available one",
|
|
);
|
|
});
|
|
|
|
test("nothing backed reports no tab rather than guessing one", () => {
|
|
const available = availableTabs({
|
|
captures: false,
|
|
bindings: false,
|
|
mappings: false,
|
|
});
|
|
assert.equal(available.length, 0);
|
|
assert.equal(activeTab("bindings", available), "");
|
|
});
|
|
|
|
test("the tabs are the three Events surfaces, in reading order", () => {
|
|
assert.deepEqual(
|
|
EVENTS_TABS.map(({ id, section }) => [id, section]),
|
|
[
|
|
["inspector", "captures"],
|
|
["mappings", "mappings"],
|
|
["bindings", "bindings"],
|
|
],
|
|
);
|
|
});
|