mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
commit
7e03085faf
@ -11,6 +11,7 @@ import {makeEnv} from './helper';
|
||||
test('Scoped splitTarget', async () => {
|
||||
expect(splitTarget('abc')).toEqual(['abc']);
|
||||
expect(splitTarget('a,b,c')).toEqual(['a', 'b', 'c']);
|
||||
expect(splitTarget('a, b, c ')).toEqual(['a', 'b', 'c']);
|
||||
expect(splitTarget('a?x=1&y=2,b,c')).toEqual(['a?x=1&y=2', 'b', 'c']);
|
||||
expect(splitTarget('a?x=${[a, b]},b,c')).toEqual(['a?x=${[a, b]}', 'b', 'c']);
|
||||
expect(splitTarget('a?x=${[a, b]}')).toEqual(['a?x=${[a, b]}']);
|
||||
|
@ -68,7 +68,7 @@ export function splitTarget(target: string): Array<string> {
|
||||
let parts: Array<string> = [];
|
||||
|
||||
pos.reduceRight((arr: Array<string>, index) => {
|
||||
arr.unshift(target.slice(index + 1));
|
||||
arr.unshift(target.slice(index + 1)?.trim());
|
||||
target = target.slice(0, index);
|
||||
return arr;
|
||||
}, parts);
|
||||
|
Loading…
Reference in New Issue
Block a user