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
[ACA-3368] Update datatable columns when presetColumn schema changes #5732
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5732 +/- ##
===========================================
+ Coverage 83.73% 83.79% +0.05%
===========================================
Files 943 943
Lines 26759 26774 +15
Branches 3765 3768 +3
===========================================
+ Hits 22407 22434 +27
+ Misses 3229 3214 -15
- Partials 1123 1126 +3
Continue to review full report at Codecov.
|
479059f
to
0ec5648
Compare
it('should update data columns when columns input changes', () => { | ||
dataTable.data = new ObjectDataTableAdapter( | ||
[{ id: 'fake-data' }], | ||
[new ObjectDataColumn({ key: 'id' })] |
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.
can we use column-1 column-2 to make clear what we are testing?
@@ -244,6 +245,15 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, | |||
return; | |||
} | |||
|
|||
if (this.isPropertyChanged(changes['columns'])) { |
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.
can we rewrite it like
if (this.isPropertyChanged(changes['rows'] || this.isPropertyChanged(changes['columns'])) {
if (this.isTableEmpty()) {
this.initTable();
}
if (this.isPropertyChanged(changes['rows']) {
this.setTableRows(changes['rows'].currentValue);
} else {
this.setTableColumns(changes['columns'].currentValue);
}
return;
}
component.columns = []; | ||
const presetColumnChange = new SimpleChange(null, 'fakeProcessCustomSchema', false); | ||
component.ngOnChanges({ 'presetColumn': presetColumnChange }); | ||
expect(component.columns).toEqual(component.mergeJsonAndHtmlSchema()); |
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.
don't get it.
can we have a column preset, i.e. col-1 col-2
we change it and we expect to have col-3 col-4 ?
component.columns = []; | ||
const presetColumnChange = new SimpleChange(null, 'fakeCustomSchema', false); | ||
component.ngOnChanges({ 'presetColumn': presetColumnChange }); | ||
expect(component.columns).toEqual(component.mergeJsonAndHtmlSchema()); |
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.
same as before
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.
comments
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behaviour? (You can also link to an open issue here)
https://issues.alfresco.com/jira/browse/ACA-3368
What is the new behaviour?
The columns are updating when the schema changes
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: