fix(material-experimental/mdc-table): error when flexbox-based table is initialized - #21428
Merged
Conversation
…is initialized The MDC-based table tries to add a class to its internal `tbody` element and it assumes that it's always going to find it. The assumption used to be correct since we only supported native `table` elements for the MDC implementation, however as of angular#20994 we also support flexbox-based ones which throw an error, because they don't have a `tbody`. These changes add a check to prevent the error and include a couple of sanity tests to catch issues like this in the future. I've also reworked the tests so that they use the MDC-based `MatPaginator` and `MatTableDataSource`, instead of the base ones.
annieyw
reviewed
Dec 28, 2020
| ng_web_test_suite( | ||
| name = "unit_tests", | ||
| static_files = ["@npm//:node_modules/@material/data-table/dist/mdc.dataTable.js"], | ||
| static_files = [ |
Contributor
There was a problem hiding this comment.
why do the new tests need these?
Member
Author
There was a problem hiding this comment.
Because the tests now use the MDC-based paginator which has an internal form field and button. These are the MDC js files that they depend on.
annieyw
approved these changes
Dec 29, 2020
annieyw
pushed a commit
that referenced
this pull request
Jan 6, 2021
…is initialized (#21428) The MDC-based table tries to add a class to its internal `tbody` element and it assumes that it's always going to find it. The assumption used to be correct since we only supported native `table` elements for the MDC implementation, however as of #20994 we also support flexbox-based ones which throw an error, because they don't have a `tbody`. These changes add a check to prevent the error and include a couple of sanity tests to catch issues like this in the future. I've also reworked the tests so that they use the MDC-based `MatPaginator` and `MatTableDataSource`, instead of the base ones. (cherry picked from commit 2255b66)
mmalerba
added a commit
to mmalerba/components
that referenced
this pull request
Jan 12, 2021
…d table is initialized (angular#21428)" This reverts commit aade5d1.
mmalerba
added a commit
to mmalerba/components
that referenced
this pull request
Jan 12, 2021
…ox-based table is initialized (angular#21428)"
wagnermaciel
pushed a commit
to wagnermaciel/components
that referenced
this pull request
Jan 14, 2021
…is initialized (angular#21428) The MDC-based table tries to add a class to its internal `tbody` element and it assumes that it's always going to find it. The assumption used to be correct since we only supported native `table` elements for the MDC implementation, however as of angular#20994 we also support flexbox-based ones which throw an error, because they don't have a `tbody`. These changes add a check to prevent the error and include a couple of sanity tests to catch issues like this in the future. I've also reworked the tests so that they use the MDC-based `MatPaginator` and `MatTableDataSource`, instead of the base ones.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MDC-based table tries to add a class to its internal
tbodyelement and it assumes that it's always going to find it. The assumption used to be correct since we only supported nativetableelements for the MDC implementation, however as of #20994 we also support flexbox-based ones which throw an error, because they don't have atbody.These changes add a check to prevent the error and include a couple of sanity tests to catch issues like this in the future.
I've also reworked the tests so that they use the MDC-based
MatPaginatorandMatTableDataSource, instead of the base ones.