Files
formipay/node_modules/es-iterator-helpers/test/shimmed.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

71 lines
2.4 KiB
JavaScript

'use strict';
require('../auto');
var test = require('tape');
var forEach = require('for-each');
var shims = require('..');
forEach(shims, function (shim) {
var shimTests;
try {
shimTests = require('./' + shim); // eslint-disable-line global-require, import/no-dynamic-require
} catch (e) {
test(shim + ': shimmed', { todo: true });
}
if (shimTests) {
shimTests.shimmed();
}
});
test('integration', function (t) {
var seenMapEveryMap = [];
var seenMapEveryEvery = [];
var mapEveryResult = Iterator.from([1, 2, 3, 4, 5]).map(function (x) {
seenMapEveryMap.push(x);
return x * x;
}).every(function (x) {
seenMapEveryEvery.push(x);
return x < 10;
});
t.equal(mapEveryResult, false, 'map + every: every predicate returned false nonzero times');
t.deepEqual(seenMapEveryMap, [1, 2, 3, 4], 'map + every, map: all values are seen until after the first one that is > 10 when squared');
t.deepEqual(seenMapEveryEvery, [1, 4, 9, 16], 'map + every, every: all values are seen until after the first one that is > 10 when squared');
var seenMapSomeMap = [];
var seenMapSomeSome = [];
var mapSomeResult = Iterator.from([1, 2, 3, 4, 5]).map(function (x) {
seenMapSomeMap.push(x);
return x * x;
}).some(function (x) {
seenMapSomeSome.push(x);
return x > 10;
});
t.equal(mapSomeResult, true, 'map + some: some predicate returned true nonzero times');
t.deepEqual(seenMapSomeMap, [1, 2, 3, 4], 'map + some, map: all values are seen until after the first one that is > 10 when squared');
t.deepEqual(seenMapSomeSome, [1, 4, 9, 16], 'map + some, some: all values are seen until after the first one that is > 10 when squared');
var seenMapFind = [];
var mapFindResult = Iterator.from([1, 2, 3, 4, 5]).map(function (x) {
seenMapFind.push(x);
return x * x;
}).find(function (x) {
return x > 10;
});
t.equal(mapFindResult, 16, 'map + find: find found the first mapped value over 10');
t.deepEqual(seenMapFind, [1, 2, 3, 4], 'map + find: all values are seen until after the first one that is > 10 when squared');
var seenFilterEvery = [];
var filterEveryResult = Iterator.from([1, 2, 3, 4, 5]).filter(function (x) {
seenFilterEvery.push(x);
return x;
}).every(function (x) {
return x <= 3;
});
t.equal(filterEveryResult, false, 'filter + every: every predicate returned false nonzero times');
t.deepEqual(seenMapFind, [1, 2, 3, 4], 'filter + every: all values are seen until after the first one that is > 10 when squared');
t.end();
});