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>
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
const normalize = require('../')
|
|
const t = require('tap')
|
|
|
|
t.test('benign array', async t => {
|
|
const pkg = { name: 'hello', version: 'world', bin: ['./x/y', 'y/z', './a'] }
|
|
const expect = { name: 'hello', version: 'world', bin: {
|
|
y: 'x/y',
|
|
z: 'y/z',
|
|
a: 'a',
|
|
} }
|
|
t.strictSame(normalize(pkg), expect)
|
|
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
|
|
})
|
|
|
|
t.test('conflicting array', async t => {
|
|
const pkg = { name: 'hello', version: 'world', bin: ['./x/y', 'z/y', './a'] }
|
|
const expect = { name: 'hello', version: 'world', bin: {
|
|
y: 'z/y',
|
|
a: 'a',
|
|
} }
|
|
t.strictSame(normalize(pkg), expect)
|
|
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
|
|
})
|
|
|
|
t.test('slashy array', async t => {
|
|
const pkg = { name: 'hello', version: 'world', bin: [ '/etc/passwd' ] }
|
|
const expect = { name: 'hello', version: 'world', bin: { passwd: 'etc/passwd' } }
|
|
t.strictSame(normalize(pkg), expect)
|
|
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
|
|
})
|
|
|
|
t.test('dotty array', async t => {
|
|
const pkg = { name: 'hello', version: 'world', bin: ['../../../../etc/passwd'] }
|
|
const expect = { name: 'hello', version: 'world', bin: { passwd: 'etc/passwd' } }
|
|
t.strictSame(normalize(pkg), expect)
|
|
t.strictSame(normalize(normalize(pkg)), expect, 'double sanitize ok')
|
|
})
|