-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(react-grid): correct changing DataTypeProvider.for property in runtime #2201
fix(react-grid): correct changing DataTypeProvider.for property in runtime #2201
Conversation
FPR |
<DataTypeProvider | ||
for={['test']} | ||
getAvailableFilterOperations={() => {}} | ||
/> | ||
{pluginDepsToComponents({})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is unnecessary
constructor(props) { | ||
super(props); | ||
this.state = { | ||
columnNames: [`${defaultDeps.getter.tableColumns[0].column.name}`], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``${` is redundant here, use simple quotes instead
<Template name="table"> | ||
<div> | ||
<TemplateConnector> | ||
{({ tableColumns }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
div
s are redundant
const defaultDeps = { | ||
getter: { | ||
tableColumns: [ | ||
{ key: `${TABLE_DATA_TYPE}_a`, type: TABLE_DATA_TYPE, column: { name: 'a' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just key: 'a'
is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need type
here. Besides that, TABLE_DATA_TYPE
is undefined since grid-core is mocked
</PluginHost> | ||
)); | ||
expect(getComputedState(tree).getAvailableFilterOperations) | ||
.toEqual(expect.any(Function)); | ||
}); | ||
|
||
it('should re-register templates when "for" property changed in runtime', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a similar test against valueEditor
|
||
const tree = mount(<Test />); | ||
|
||
expect(tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify this: just check a formatterComponent's props
FPR |
|
||
it('should re-register valueFormatter templates', () => { | ||
const DataFormatter = () => null; | ||
const tree = mount(<Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use another formatting:
mount((
<Test ... />
))
FPR |
Fixes #2047