Improve regression tests for 4759
This commit is contained in:
@@ -1102,7 +1102,7 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
|
|||||||
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [0, 0, 0, 255]);
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [0, 0, 0, 255]);
|
||||||
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 3, 1), [0, 0, 0, 255]);
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 3, 1), [0, 0, 0, 255]);
|
||||||
});
|
});
|
||||||
test.only('#4759: minimum contrast ratio should be respected on inverse text', async () => {
|
test('#4759: minimum contrast ratio should be respected on inverse text', async () => {
|
||||||
const theme: ITheme = {
|
const theme: ITheme = {
|
||||||
foreground: '#aaaaaa',
|
foreground: '#aaaaaa',
|
||||||
background: '#333333'
|
background: '#333333'
|
||||||
@@ -1110,10 +1110,32 @@ export function injectSharedRendererTests(ctx: ISharedRendererTestContext): void
|
|||||||
await ctx.value.page.evaluate(`window.term.options.theme = ${JSON.stringify(theme)};`);
|
await ctx.value.page.evaluate(`window.term.options.theme = ${JSON.stringify(theme)};`);
|
||||||
await ctx.value.proxy.write(`\x1b[7m■■`);
|
await ctx.value.proxy.write(`\x1b[7m■■`);
|
||||||
// Validate before minimumContrastRatio is applied
|
// Validate before minimumContrastRatio is applied
|
||||||
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0x33, 0x33, 0x33, 255]);
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [51, 51, 51, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [51, 51, 51, 255]);
|
||||||
await ctx.value.page.evaluate(`window.term.options.minimumContrastRatio = 10;`);
|
await ctx.value.page.evaluate(`window.term.options.minimumContrastRatio = 10;`);
|
||||||
frameDetails = undefined;
|
frameDetails = undefined;
|
||||||
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [0, 0, 0, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [0, 0, 0, 255]);
|
||||||
|
});
|
||||||
|
test('#4759: minimum contrast ratio should be respected on selected inverse text', async () => {
|
||||||
|
const theme: ITheme = {
|
||||||
|
foreground: '#777777',
|
||||||
|
background: '#555555',
|
||||||
|
selectionBackground: '#666666' // Slightly more contrast needed for selection
|
||||||
|
};
|
||||||
|
await ctx.value.page.evaluate(`window.term.options.theme = ${JSON.stringify(theme)};`);
|
||||||
|
await ctx.value.proxy.write(`\x1b[7m■■`);
|
||||||
|
await ctx.value.proxy.selectAll();
|
||||||
|
// Validate before minimumContrastRatio is applied
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [85, 85, 85, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [85, 85, 85, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 3, 1), [102, 102, 102, 255]);
|
||||||
|
await ctx.value.page.evaluate(`window.term.options.minimumContrastRatio = 10;`);
|
||||||
|
await ctx.value.proxy.selectAll();
|
||||||
|
frameDetails = undefined;
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 1, 1), [255, 255, 255, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 2, 1), [255, 255, 255, 255]);
|
||||||
|
await pollFor(ctx.value.page, () => getCellColor(ctx.value, 3, 1), [102, 102, 102, 255]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user