-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into FIO-8414/5x_validation_on_required_datagrid
- Loading branch information
Showing
15 changed files
with
356 additions
and
120 deletions.
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
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
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
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
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
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 |
---|---|---|
@@ -1,73 +1,116 @@ | ||
import { expect } from 'chai'; | ||
import { expect } from "chai"; | ||
|
||
import { filterProcessSync } from '../'; | ||
import { generateProcessorContext } from '../../__tests__/fixtures/util'; | ||
import { filterProcessSync } from "../"; | ||
import { generateProcessorContext } from "../../__tests__/fixtures/util"; | ||
import { FilterScope, ProcessorContext } from "types"; | ||
|
||
it('Should not filter empty array value for dataGrid component', async () => { | ||
const dataGridComp = { | ||
type: 'datagrid', | ||
key: 'dataGrid', | ||
it("Should not filter empty array value for dataGrid component", async () => { | ||
const dataGridComp = { | ||
type: "datagrid", | ||
key: "dataGrid", | ||
input: true, | ||
path: "dataGrid", | ||
components: [ | ||
{ | ||
type: "textfield", | ||
key: "textField", | ||
input: true, | ||
path: 'dataGrid', | ||
components: [ | ||
{ | ||
type: 'textfield', | ||
key: 'textField', | ||
input: true, | ||
label: 'Text Field' | ||
} | ||
] | ||
}; | ||
const data = { | ||
dataGrid: [] | ||
}; | ||
const context: any = generateProcessorContext(dataGridComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({'dataGrid': {'compModelType': 'array', 'include': true, value: []}}); | ||
label: "Text Field", | ||
}, | ||
], | ||
}; | ||
const data = { | ||
dataGrid: [], | ||
}; | ||
const context: any = generateProcessorContext(dataGridComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({ | ||
dataGrid: { compModelType: "array", include: true, value: [] }, | ||
}); | ||
}); | ||
|
||
it('Should not filter empty array value for editGrid component', async () => { | ||
const editGridComp = { | ||
type: 'editgrid', | ||
key: 'editGrid', | ||
it("Should not filter empty array value for editGrid component", async () => { | ||
const editGridComp = { | ||
type: "editgrid", | ||
key: "editGrid", | ||
input: true, | ||
path: "editGrid", | ||
components: [ | ||
{ | ||
type: "textfield", | ||
key: "textField", | ||
input: true, | ||
path: 'editGrid', | ||
components: [ | ||
{ | ||
type: 'textfield', | ||
key: 'textField', | ||
input: true, | ||
label: 'Text Field' | ||
} | ||
] | ||
}; | ||
const data = { | ||
editGrid: [] | ||
}; | ||
const context: any = generateProcessorContext(editGridComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({'editGrid': {'compModelType': 'array', 'include': true, value: []}}); | ||
label: "Text Field", | ||
}, | ||
], | ||
}; | ||
const data = { | ||
editGrid: [], | ||
}; | ||
const context: any = generateProcessorContext(editGridComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({ | ||
editGrid: { compModelType: "array", include: true, value: [] }, | ||
}); | ||
}); | ||
|
||
it('Should not filter empty array value for datTable component', async () => { | ||
const dataTableComp = { | ||
type: 'datatable', | ||
key: 'dataTable', | ||
it("Should not filter empty array value for dataTable component", async () => { | ||
const dataTableComp = { | ||
type: "datatable", | ||
key: "dataTable", | ||
input: true, | ||
path: "dataTable", | ||
components: [ | ||
{ | ||
type: "textfield", | ||
key: "textField", | ||
input: true, | ||
path: 'dataTable', | ||
components: [ | ||
{ | ||
type: 'textfield', | ||
key: 'textField', | ||
input: true, | ||
label: 'Text Field' | ||
} | ||
] | ||
}; | ||
const data = { | ||
dataTable: [] | ||
}; | ||
const context: any = generateProcessorContext(dataTableComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({'dataTable': {'compModelType': 'array', 'include': true, value: []}}); | ||
label: "Text Field", | ||
}, | ||
], | ||
}; | ||
const data = { | ||
dataTable: [], | ||
}; | ||
const context: any = generateProcessorContext(dataTableComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({ | ||
dataTable: { compModelType: "array", include: true, value: [] }, | ||
}); | ||
}); | ||
|
||
it("Should not filter the datamap component", async () => { | ||
const dataMapComp = { | ||
label: "Data Map", | ||
tableView: false, | ||
validateWhenHidden: false, | ||
key: "dataMap", | ||
type: "datamap", | ||
path: "dataMap", | ||
input: true, | ||
valueComponent: { | ||
type: "textfield", | ||
key: "value", | ||
label: "Value", | ||
input: true, | ||
hideLabel: true, | ||
tableView: true, | ||
}, | ||
}; | ||
|
||
const data = { | ||
dataMap: { | ||
foo: "bar", | ||
baz: "biz" | ||
}, | ||
}; | ||
|
||
const context: ProcessorContext<FilterScope> = generateProcessorContext(dataMapComp, data); | ||
filterProcessSync(context); | ||
expect(context.scope.filter).to.deep.equal({ | ||
dataMap: { | ||
compModelType: "map", | ||
include: true, | ||
} | ||
}); | ||
}); |
Oops, something went wrong.