-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f661bc
commit 69e8ad0
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { describe, assert, expect, test, beforeEach, beforeAll } from 'vitest' | ||
import { generateIfFilterOptionsData } from '@ER/formEditor/components/Panels/Config/components/generateFilterdata.js' | ||
import _ from 'lodash-es' | ||
import erGeneratorData from '@ER/formEditor/generatorData.js' | ||
import * as erComponentsConfig from '@ER/formEditor/componentsConfig.js' | ||
describe('Generate filter data: Subform', () => { | ||
let testData = {} | ||
beforeAll(() => { | ||
testData = erGeneratorData(_.cloneDeep(erComponentsConfig.fieldsConfig[2].list[5]), false, 'en') | ||
}) | ||
test('default', () => { | ||
expect(generateIfFilterOptionsData('', [testData])).toMatchSnapshot() | ||
}) | ||
}) |
60 changes: 60 additions & 0 deletions
60
test/logic/generateFilterdata/__snapshots__/Subform.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`Generate filter data: Subform > default 1`] = ` | ||
{ | ||
"operators": { | ||
"Text": [ | ||
{ | ||
"en_label": "Equal", | ||
"label": "等于", | ||
"style": "noop", | ||
"value": "equal", | ||
}, | ||
{ | ||
"en_label": "Not equal", | ||
"label": "不等于", | ||
"style": "noop", | ||
"value": "not_equal", | ||
}, | ||
{ | ||
"en_label": "Contains", | ||
"label": "包含", | ||
"style": "tags", | ||
"value": "contains", | ||
}, | ||
{ | ||
"en_label": "Not contain", | ||
"label": "不包含", | ||
"style": "tags", | ||
"value": "not_contain", | ||
}, | ||
{ | ||
"en_label": "Empty", | ||
"label": "为空", | ||
"style": "none", | ||
"value": "empty", | ||
}, | ||
{ | ||
"en_label": "Not empty", | ||
"label": "不为空", | ||
"style": "none", | ||
"value": "not_empty", | ||
}, | ||
], | ||
}, | ||
"options": [ | ||
{ | ||
"includeOperator": { | ||
"operator": [ | ||
"empty", | ||
"not_empty", | ||
], | ||
}, | ||
"label": "Sub-form", | ||
"operatorKey": "Text", | ||
"renderType": "NONE", | ||
"value": "{{test-id-nanoid}}", | ||
}, | ||
], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters