Apply the supplied inquiry layout to the list and native write/detail dialogs while preserving existing API requests, author controls, attachments, comments and search. Keep legacy entry links and confirm before discarding drafts. Validation: 98 tests and syntax checks pass; mocked Chromium desktop/mobile and six author/session visibility scenarios pass.
23 lines
1.1 KiB
JavaScript
23 lines
1.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import vm from 'node:vm';
|
|
|
|
const script = readFileSync(new URL('../assets/inquiry/entry.js', import.meta.url), 'utf8');
|
|
|
|
for (const [name, source, expected] of [
|
|
['write link', '/egbim/write.html', '/egbim/?view=write'],
|
|
['detail link preserves its feedback ID', '/egbim/detail.html?id=feedback-uuid', '/egbim/?id=feedback-uuid&view=detail'],
|
|
['write link cannot inherit a detail ID', '/egbim/write.html?view=detail&id=old&check=1#form', '/egbim/?view=write&check=1#form'],
|
|
['detail link preserves encoded IDs and query values', '/egbim/detail.html?id=a%26b&check=x%20y', '/egbim/?id=a%26b&check=x+y&view=detail']
|
|
]) {
|
|
test(name + ' opens the matching list modal using replace navigation', () => {
|
|
const navigations = [];
|
|
vm.runInNewContext(script, {
|
|
URL,
|
|
window: { location: { href: 'https://qa.example.test' + source, replace: value => navigations.push(value) } }
|
|
});
|
|
assert.deepEqual(navigations, ['https://qa.example.test' + expected]);
|
|
});
|
|
}
|