fix: separate hover and use ASCII glitch transitions
Reference site / build (push) Canceled after 0s
Reference site / build (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { glitchText } from '../src/lib/landing-ascii.mjs';
|
||||
|
||||
const text = '┌────────┐\n│ object │\n└────────┘\n 本文: "sample";';
|
||||
test('ASCII glitch preserves cells, whitespace and Japanese prose', () => {
|
||||
const output = glitchText(text, .2, 9, 2);
|
||||
assert.equal(output.length, text.length);
|
||||
assert.equal(output.match(/\s/g).join(''), text.match(/\s/g).join(''));
|
||||
assert.ok(output.includes('本文'));
|
||||
assert.notEqual(output, text);
|
||||
});
|
||||
test('noise is reproducible and changes only with its explicit clock', () => {
|
||||
assert.equal(glitchText(text, .3, 1, 7), glitchText(text, .3, 1, 7));
|
||||
assert.notEqual(glitchText(text, .3, 1, 7), glitchText(text, .3, 2, 7));
|
||||
});
|
||||
test('transition restores the exact source text at its boundary', () => {
|
||||
assert.equal(glitchText(text, 1, 99), text);
|
||||
assert.equal(glitchText(text, 2, 99), text);
|
||||
assert.equal(glitchText('', .5, 1), '');
|
||||
});
|
||||
Reference in New Issue
Block a user