Files
wp-asciiplayer/tests/js/layout.test.js
T
LamGC 85e5ffa0ec
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s
Refresh wp-asciiplayer with native block editor playback (#36)
* Refresh player with native block editor preview and local assets

Preserve shortcode rendering, normalize options, bundle the player locally,
and add reproducible packaging and WordPress integration tests.

* Fix emitted frontend boot and verify bundled runtime initialization

* Record verified WordPress 7.1.3 compatibility

* Use WordPress readme major-version compatibility format

* Add responsive player layout, captions and native terminal sizing

* Keep editor caption geometry stable during block selection

* Respect WordPress editor gutters with border-box sizing

* Improve automatic previews and toolbar terminal sizing (1.2.1)

* Show native cast dimensions and add Media Library recordings (1.2.2)

* Fix Media Library test storage and scope sidebar selectors

* Document bounded temporary-upload stream exceptions

* Move block explanations into collapsed sidebar help (1.2.3)

* Add bundled English and Simplified Chinese UI translations (1.1.0-dev)

* Use native RichText labels and supported Chinese HTML language tags in locale tests
2026-10-14 15:56:05 +08:00

25 lines
1.3 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { normalizeDisplayAlign, normalizePlayerOptions, terminalDimension, normalizeWidth } from '../../src/options.js';
test('display placement and scaling never create terminal grid overrides', () => {
for (const width of ['25%', '480px', '100%']) {
const options = normalizePlayerOptions({ width, displayAlign: 'right', caption: 'Demo' });
assert.equal(options.cols, undefined);
assert.equal(options.rows, undefined);
assert.equal(options.width, undefined);
assert.equal(options.caption, undefined);
}
assert.equal(normalizeDisplayAlign('right'), 'right');
assert.equal(normalizeDisplayAlign('unsafe'), 'center');
assert.equal(normalizeWidth('480px'), '480px');
assert.equal(normalizeWidth('480px;display:none'), '100%');
});
test('terminal overrides are optional bounded integers', () => {
for (const value of ['', '0', '-1', '2.5', '1001', 'Infinity', null]) assert.equal(terminalDimension(value), undefined);
assert.equal(terminalDimension('120'), 120);
assert.equal(terminalDimension(1), 1);
const options = normalizePlayerOptions({ cols: terminalDimension('120'), rows: terminalDimension('') });
assert.equal(options.cols, 120);
assert.equal(options.rows, undefined);
});