Make the checks pass on a fresh clone

- build.rs creates the empty browser-engine folder that tauri-build
  requires, so cargo test runs before the browser runtime is staged.
- The Table Formulas tests skip with a reason when the package is not
  built. Before, the missing module failed two whole test files.
- The installer test accepts CRLF checkouts and skips with a reason
  when the NSIS compiler is missing.
- hostTodo.spec.mjs never ran because of its extension. Its two valid
  background tests move to appearance.spec.ts with current defaults.
  The third test repeated an existing export test.
- Remove tsconfig.plugins.json. It checked the plugins/ folder, which
  moved to separate repositories in 0.1.7.
This commit is contained in:
Knotty Wyvern
2026-10-27 19:41:08 -07:00
parent 2d2a146e34
commit 90d1940c73
8 changed files with 50 additions and 53 deletions
+19
View File
@@ -85,3 +85,22 @@ test('Saved image layout restores valid choices and rejects CSS injection', () =
assert.deepEqual(invalid.newTabBackground, { imageId, position: 'center', size: 'cover', overlay: 0 });
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId } }).newTabBackground, { imageId, overlay: 0, position: 'center', size: 'cover' });
});
test('New tab backgrounds keep supported image data and reject active or remote content', () => {
const value = { theme: 'claude', mode: 'light', newTabBackground: { image: 'data:image/png;base64,YQ==', overlay: 0, position: 'center', size: 'cover' } };
assert.deepEqual(parseAppearance(JSON.stringify(value)), value);
for (const image of ['https://example.com/photo.png', 'javascript:alert(1)', 'data:image/svg+xml;base64,YQ==', 'data:image/png;base64,' + 'A'.repeat(3_000_000)]) {
assert.equal(normalizeAppearance({ ...value, newTabBackground: { color: '#224466', image } }).newTabBackground, undefined);
}
assert.equal(normalizeAppearance({ ...value, newTabBackground: { color: 'red' } }).newTabBackground, undefined);
assert.equal(normalizeAppearance({ ...value, newTabBackground: undefined }).newTabBackground, undefined);
});
test('Background image references clamp the overlay and discard obsolete colors', () => {
const imageId = 'd10adda6-a2ec-4d73-a0a6-2cb1ed43bebc';
const layout = { position: 'center', size: 'cover' };
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId, color: '#224466', overlay: 3 } }).newTabBackground, { imageId, overlay: 1, ...layout });
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId, overlay: -3 } }).newTabBackground, { imageId, overlay: -1, ...layout });
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId, overlay: NaN } }).newTabBackground, { imageId, overlay: 0, ...layout });
assert.equal(normalizeAppearance({ newTabBackground: { imageId: 'invalid' } }).newTabBackground, undefined);
});