-
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
feat(tab): Get tabs by their ID #4149
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4149 +/- ##
=========================================
- Coverage 98.43% 98.4% -0.04%
=========================================
Files 126 126
Lines 5616 5626 +10
Branches 753 755 +2
=========================================
+ Hits 5528 5536 +8
- Misses 88 90 +2
Continue to review full report at Codecov.
|
@@ -63,6 +66,7 @@ class MDCTab extends MDCComponent { | |||
initialize( | |||
rippleFactory = (el, foundation) => new MDCRipple(el, foundation), | |||
tabIndicatorFactory = (el) => new MDCTabIndicator(el)) { | |||
this.id = this.root_.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.
Is the element's id guaranteed to be set by the time this runs?
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.
It is guaranteed to be set. I based this off chips which is working appropriately.
this.id = this.root_.id; |
All 691 screenshot tests passed for commit 1e861da vs. |
All 691 screenshot tests passed for commit f5992c7 vs. |
…ponents/material-components-web into feat/tabs/getIndexOfTabByID
All 691 screenshot tests passed for commit 5df93de vs. |
All 691 screenshot tests passed for commit 93a240e vs. |
Use unique identifiers to reference tabs instead of the object equality comparison. Change the
getIndexOfTab
method togetIndexOfTabByID
. Update tests.This makes it more feasible to wrap MDC Tab Bar for frameworks, which shouldn't need to reference the vanilla component.
BREAKING CHANGE:
MDCTabBar#getIndexOfTab(tab: MDCTab): number
is nowMDCTabBar#getIndexOfTabByID(id: string): number