Files
formipay/node_modules/find-parent-dir/test/find-parent-dir.js
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
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>
2026-04-18 17:02:14 +07:00

45 lines
1.2 KiB
JavaScript

'use strict';
/*jshint asi: true */
var test = require('tap').test
var path = require('path')
var fs = require('fs')
var findParentDir = require('..')
test('finding .git root relative to the test dir', function (t) {
findParentDir(__dirname, '.git', function (err, dir) {
t.equals(dir, path.resolve(__dirname, '..') + '/')
t.end()
});
})
test('finding this dir relative to the test dir', function (t) {
findParentDir(__dirname, 'find-parent-dir.js', function (err, dir) {
t.equals(dir, path.resolve(__dirname))
t.end()
});
})
test('sync finding .git root relative to the test dir', function (t) {
var dir = findParentDir.sync(__dirname, '.git')
t.equals(dir, path.resolve(__dirname, '..') + '/')
t.end()
})
test('sync finding this dir relative to the test dir', function (t) {
var dir = findParentDir.sync(__dirname, 'find-parent-dir.js')
t.equals(dir, path.resolve(__dirname))
t.end()
})
test('find no dir when file is in the test dir', function(t) {
var filepath = path.join(__dirname, 'shazam.txt')
fs.writeFileSync(filepath, 'shaq attack')
findParentDir('/etc', 'shazam.txt', function (err, dir) {
fs.unlinkSync(filepath)
t.equals(err, null)
t.equals(dir, null)
t.end()
})
})