-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor: Adapt foundations for class-object adapters #6256
base: master
Are you sure you want to change the base?
refactor: Adapt foundations for class-object adapters #6256
Conversation
…ass-object adapters Changes: - adapter is now copied as a field (to resolve undefined adapters failing tests) - adapters are not optional and are expected to implement the full interface, because they are now class objects Now the edited foundation constructors are in the following format: ``` constructor(readonly adapter: MDCAdapter) {...} ```
Importing this PR internally. |
…ter reference, removed defaultAdapter() The base class foundation now more strongly types the adapter (in anticipation of the other components moving to class-based adapters) and stores the adapter reference. Removed defaultAdapter() in the following (since we have class object adapters): mdc-checkbox mdc-chips/chip-set mdc-chips/chip mdc-chips/trailingaction mdc-form-field mdc-radio mdc-slider mdc-switch mdc-tab-bar mdc-tab-indicator
…ject adapters Deletes overridden constructors since the base foundation now expects a fully implemented adapter (except for constructors that initialize other values). Deletes all defaultAdapter() methods.
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.
Let me know when this PR is ready for re-review.
Thanks!
@abhiomkar In case you haven't seen my message, it's ready! |
Re-running global tests. |
Commenting to Rebase internal CL. |
Unit tests are failing internally for most of the MDC foundation code with following error:
You'll need to remove defaultAdapter test case from all foundation unit tests of MDC. Weird that unit tests are passing externally. |
Please let me know when this CL is ready for re-review. Thanks! |
eb642bd
to
c0ad50f
Compare
@abhiomkar Should be ready! Sorry for the delay, experiencing a power outage this week |
Thanks Scott! No problem.. Can you resolve merge conflicts and rebase with base branch? |
553b8dc
to
a91c289
Compare
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.
Seems like test file updates are reverted?
a91c289
to
89ce243
Compare
Hi Scott! Seems like segmented button unit tests are failing. Can you please take a look? Thanks! |
@abhiomkar I've made fixes for that, but it looks like the unit tests are failing with a bunch of errors. My guess is that it's on the components side. Could you re-run the tests on your end? |
Verified unit tests locally. I see many unit tests are failing with following errors:
Unit tests do not run on forked repositories you'll have to manually run |
b5cc98b
to
b692a91
Compare
@abhiomkar Here's an update: the tests pass for me locally, but fail on github. I'm certain that my local repo and GitHub are running the same code. One thing that is suspect was a single failure with announce.test.ts that I somehow suppressed by changing around the order of static fields, although it's not mentioned on GitHub. |
import {setUpFoundationTest} from '../../../testing/helpers/setup'; | ||
import {attributes, cssClasses, SortValue, strings} from '../constants'; | ||
import {MDCDataTableFoundation} from '../foundation'; | ||
|
||
describe('MDCDataTableFoundation', () => { | ||
it('default adapter returns a complete adapter implementation', () => { |
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 removing tests in scope of this PR? Can we remove this tests when we delete default adapters?
This may affect code coverage numbers otherwise.
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.
@abhiomkar Initially, we removed these tests because we assumed defaultAdapter would no longer be used (since now adapters need to implement the full interface).
But another test mocks an adapter using the defaultAdapter, so just to get the tests to pass, @kseamon suggested putting back the defaultAdapter for now (we can delete them in a later PR)
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.
@kseamon Can you please confirm if this is what you intended. http://b/165316767 suggests that unit tests will be cleaned up along with defaultAdapter code.
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.
Sorry - missed this way back when - yes, we need to keep the default adaptors around until the tests are refactored.
The most straightforward thing might be to factor them out into objects that live in the test files.
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.
Got it! Moving objects to live in tests SGTM so that the code coverage numbers will be intact.
Since ngwattcos@ left Google, do you want to take a stab at it? You can directly send a CL to us (Copybara will automatically merge the PR).
Let me know if you've any questions!
@abhiomkar should be ready! |
If this is merged, we should reopen the work in angular/components#19982 |
…ass-object adapters for material-experimental components
This is to resolve test failures (and anticipated breaking changes) with the move to class-based adapters.
Changes:
...For the following components:
Additionally,
Now the base foundation constructor in the following format:
The constructor for individual components have been removed, as a call to super() is sufficient to most. For the components that have initialize additional values in the constructor, the new overridden constructor is in the format: