RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// Background image overlay: signed numeric entry, slider sync, persistence, clamping, both themes, narrow settings, keyboard focus.
|
||||
import assert from 'node:assert/strict';
|
||||
import { writeFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { mockTauri, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
|
||||
|
||||
await runSmoke('appearance/backgroundOverlay', async ({ page: settings }) => {
|
||||
const output = await outputDir('appearance/backgroundOverlay');
|
||||
await settings.setViewportSize({ width: 1100, height: 780 });
|
||||
await mockTauri(settings, {
|
||||
commands: () => ({
|
||||
plugins_snapshot: () => ({ root: 'C:/plugins', plugins: [] }),
|
||||
'plugin:window|is_maximized': () => false,
|
||||
}),
|
||||
});
|
||||
await settings.goto(smokeUrl + '/?settingsWindow=true');
|
||||
await settings.getByRole('button', { name: 'Appearance', exact: true }).click();
|
||||
await settings.getByLabel('Background image file', { exact: true }).setInputFiles({
|
||||
name: 'image.png', mimeType: 'image/png',
|
||||
buffer: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jM1sAAAAASUVORK5CYII=', 'base64'),
|
||||
});
|
||||
const input = settings.getByRole('spinbutton', { name: 'Image overlay percentage' });
|
||||
const slider = settings.getByRole('slider', { name: 'Image overlay', exact: true });
|
||||
const saved = () => settings.evaluate(() => window.__TEST__.settings('appearance').newTabBackground.overlay);
|
||||
await input.fill('-37');
|
||||
assert.equal(await slider.inputValue(), '-37');
|
||||
assert.equal(await saved(), -0.37);
|
||||
await settings.reload();
|
||||
await settings.getByRole('button', { name: 'Appearance', exact: true }).click();
|
||||
assert.equal(await input.inputValue(), '-37');
|
||||
await input.fill('');
|
||||
assert.equal(await saved(), -0.37);
|
||||
await input.blur();
|
||||
assert.equal(await input.inputValue(), '-37');
|
||||
await input.fill('150');
|
||||
await input.blur();
|
||||
assert.equal(await input.inputValue(), '100');
|
||||
assert.equal(await saved(), 1);
|
||||
await slider.fill('24');
|
||||
assert.equal(await input.inputValue(), '24');
|
||||
assert.equal(await saved(), 0.24);
|
||||
for (const mode of ['light', 'dark']) {
|
||||
await settings.evaluate(async mode => {
|
||||
const appearance = await import('/src/lib/theme/appearance.ts');
|
||||
appearance.saveAppearance({ ...appearance.readAppearance(), mode });
|
||||
window.dispatchEvent(new Event('focus'));
|
||||
}, mode);
|
||||
for (const width of [1100, 360]) {
|
||||
await settings.setViewportSize({ width, height: 780 });
|
||||
await input.focus();
|
||||
assert.equal(await input.evaluate(node => node === document.activeElement), true);
|
||||
assert.equal(await settings.locator('.content').evaluate(node => node.scrollWidth <= node.clientWidth + 1), true);
|
||||
await settings.screenshot({ path: path.join(output, `${mode}-${width}.png`) });
|
||||
}
|
||||
}
|
||||
await writeFile(path.join(output, 'report.json'), JSON.stringify({
|
||||
card: '2d1ae11e-8142-4840-bf0a-70f682e90e53',
|
||||
hostChecks: ['Signed numeric entry and slider synchronization', 'Persistence after reload', 'Empty input retains saved value', 'Values clamp to -100 through 100', 'Both themes, keyboard focus, 360px and 1100px settings'],
|
||||
shared: ['--rs-settings-control-height', '--rs-settings-gap', '--rs-control-radius'],
|
||||
screenshotFolder: output,
|
||||
native: 'Native desktop acceptance remains pending.',
|
||||
}, null, 2));
|
||||
console.log('PASS: numeric overlay, slider, persistence, bounds, themes, narrow settings, keyboard focus.');
|
||||
});
|
||||
Reference in New Issue
Block a user