GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: fix the unit test failure problem caused by thisRequiredInJSE mo… · zfhstudy/lowcode-engine@c2c59b7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/renderer-core
    • src
      • hoc
        • leaf.tsx
      • utils
        • common.ts
    • tests
      • hoc
        • leaf.test.tsx
      • renderer
        • renderer.test.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/renderer-core/src/hoc/leaf.tsx‎

Copy file name to clipboardExpand all lines: packages/renderer-core/src/hoc/leaf.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
226226
nodeChildren: null,
227227
childrenInState: false,
228228
visible: !hidden,
229-
condition: __parseData(condition, scope),
229+
condition: __parseData?.(condition, scope),
230230
nodeCacheProps: {},
231231
nodeProps: {},
232232
};
@@ -396,7 +396,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
396396

397397
if (key === '___condition___') {
398398
const { condition = true } = this.leaf?.export(TransformStage.Render) || {};
399-
const conditionValue = __parseData(condition, scope);
399+
const conditionValue = __parseData?.(condition, scope);
400400
__debug(`key is ___condition___, change condition value to [${condition}]`);
401401
// 条件表达式改变
402402
this.setState({
Collapse file

‎packages/renderer-core/src/utils/common.ts‎

Copy file name to clipboardExpand all lines: packages/renderer-core/src/utils/common.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ export function forEach(targetObj: any, fn: any, context?: any) {
330330
Object.keys(targetObj).forEach((key) => fn.call(context, targetObj[key], key));
331331
}
332332

333-
export function parseData(schema: unknown, self: any, options: any): any {
333+
interface IParseOptions {
334+
thisRequiredInJSE?: boolean;
335+
}
336+
337+
export function parseData(schema: unknown, self: any, options: IParseOptions = {}): any {
334338
if (isJSExpression(schema)) {
335339
return parseExpression(schema, self, options.thisRequiredInJSE);
336340
} else if (isI18nData(schema)) {
Collapse file

‎packages/renderer-core/tests/hoc/leaf.test.tsx‎

Copy file name to clipboardExpand all lines: packages/renderer-core/tests/hoc/leaf.test.tsx
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import '../utils/react-env-init';
55
import { leafWrapper } from '../../src/hoc/leaf';
66
import components from '../utils/components';
77
import Node from '../utils/node';
8+
import { parseData } from '../../src/utils';
89

910
let rerenderCount = 0;
1011

@@ -37,6 +38,9 @@ const baseRenderer: any = {
3738
}
3839
},
3940
documentId: '01'
41+
},
42+
__parseData (data, scope) {
43+
return parseData(data, scope, {});
4044
}
4145
}
4246

Collapse file

‎packages/renderer-core/tests/renderer/renderer.test.tsx‎

Copy file name to clipboardExpand all lines: packages/renderer-core/tests/renderer/renderer.test.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ describe('JSExpression', () => {
329329
],
330330
loop: {
331331
type: "JSExpression",
332-
value: "state.content"
332+
value: "this.state.content"
333333
},
334334
loopArgs: [
335335
"item",

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.