Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
71 lines
1.0 KiB
TypeScript
71 lines
1.0 KiB
TypeScript
import crlf, { Ending } from '../../src/transforms/crlf.js';
|
|
import getParser, { Parser } from '../../src/parser/index.js';
|
|
import getStringifier, { Stringifier } from '../../src/stringifier/index.js';
|
|
|
|
const tests = [
|
|
[
|
|
'no CR',
|
|
'CRLF',
|
|
`
|
|
/**
|
|
* description
|
|
*
|
|
*/`,
|
|
`
|
|
/**\r
|
|
* description\r
|
|
*\r
|
|
*/\r`,
|
|
],
|
|
[
|
|
'mixed',
|
|
'CRLF',
|
|
`
|
|
/**
|
|
* description
|
|
*\r
|
|
*/`,
|
|
`
|
|
/**\r
|
|
* description\r
|
|
*\r
|
|
*/\r`,
|
|
],
|
|
[
|
|
'no CR',
|
|
'LF',
|
|
`
|
|
/**
|
|
* description
|
|
*
|
|
*/`,
|
|
`
|
|
/**
|
|
* description
|
|
*
|
|
*/`,
|
|
],
|
|
[
|
|
'mixed',
|
|
'LF',
|
|
`
|
|
/**
|
|
* description
|
|
*\r
|
|
*/`,
|
|
`
|
|
/**
|
|
* description
|
|
*
|
|
*/`,
|
|
],
|
|
];
|
|
|
|
test.each(tests)('CRLF - %s to %s', (name, mode, source, expected) => {
|
|
expected = expected.slice(1);
|
|
const parsed = getParser()(source);
|
|
const normalized = crlf(mode as Ending)(parsed[0]);
|
|
const out = getStringifier()(normalized);
|
|
expect(out).toBe(expected);
|
|
});
|