fix(prop): fix prop.export can not correctly export undefined[]

This commit is contained in:
liujuping 2023-04-19 15:39:31 +08:00 committed by 林熠
parent 82cdafe07e
commit dff06e70ac
2 changed files with 2 additions and 6 deletions

View File

@ -336,13 +336,9 @@ export class Prop implements IProp, IPropParent {
if (!this._items) {
return this._value;
}
const values = this.items!.map((prop) => {
return this.items!.map((prop) => {
return prop?.export(stage);
});
if (values.every((val) => val === undefined)) {
return undefined;
}
return values;
}
}

View File

@ -435,7 +435,7 @@ describe('Prop 类测试', () => {
it('should return undefined when all items are undefined', () => {
prop = new Prop(mockPropsInst, [undefined, undefined], '___loopArgs___');
expect(prop.getValue()).toBeUndefined();
expect(prop.getValue()).toEqual([undefined, undefined]);
});
it('迭代器 / map / forEach', () => {