Skip to content

Commit 6722900

Browse files
committed
test(tui): verify active tab ANSI colors
1 parent da69646 commit 6722900

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

‎apps/pythinker-code/test/tui/utils/tab-strip.test.ts‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ function render(labels: readonly string[], width: number, activeIndex = 0): stri
2020
}
2121
}
2222

23-
function renderRaw(labels: readonly string[], width: number, activeIndex = 0): string {
24-
const previousChalkLevel = chalk.level;
25-
chalk.level = 3;
26-
try {
27-
return renderTabStrip({ labels, activeIndex, width, colors: darkColors });
28-
} finally {
29-
chalk.level = previousChalkLevel;
30-
}
31-
}
32-
3323
describe('renderTabStrip', () => {
3424
const labels = ['Installed', 'Official', 'Third-party', 'Custom'];
3525
// Cell widths: ` ${label} ` → 11 / 10 / 13 / 8 = 42, plus 3 separators and a
@@ -59,12 +49,18 @@ describe('renderTabStrip', () => {
5949
});
6050

6151
it('uses the accessible active-tab color pair', () => {
62-
const out = renderRaw(labels, FULL_WIDTH);
63-
const active = chalk
64-
.bgHex(darkColors.selectionBg)
65-
.hex(darkColors.inverseText)
66-
.bold(' Installed ');
52+
const previousChalkLevel = chalk.level;
53+
chalk.level = 3;
54+
try {
55+
const out = renderTabStrip({ labels, activeIndex: 0, width: FULL_WIDTH, colors: darkColors });
56+
const active = chalk
57+
.bgHex(darkColors.selectionBg)
58+
.hex(darkColors.inverseText)
59+
.bold(' Installed ');
6760

68-
expect(out).toContain(active);
61+
expect(out).toContain(active);
62+
} finally {
63+
chalk.level = previousChalkLevel;
64+
}
6965
});
7066
});

0 commit comments

Comments
 (0)