-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(material-experimental/mdc-tabs): add default fitInkBarToContent option #17556
Conversation
const tabElement = fixture.nativeElement.querySelector('.mdc-tab'); | ||
const contentElement = tabElement.querySelector('.mdc-tab__content'); | ||
const indicatorElement = tabElement.querySelector('.mdc-tab-indicator'); | ||
expect(indicatorElement.parentElement).toBe(contentElement); |
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.
Might be a good idea to also add assertions that the values here are truthy.
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.
Good point, I added an expectation that the indicator's parent element is truthy
@@ -355,6 +357,35 @@ describe('MatTabNavBar', () => { | |||
}); | |||
}); | |||
|
|||
describe('MatTabNavBar with a default config', () => { | |||
let fixture: ComponentFixture<TabLinkWithTabIndexBinding>; |
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.
The indentation seems off here.
super(elementRef, dir, ngZone, changeDetectorRef, viewportRuler, platform, animationMode); | ||
this.disablePagination = defaultConfig && defaultConfig.disablePagination != null ? |
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.
Isn't this one handled by the base class already?
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.
Unfortunately not, it extends MatPaginatedTabHeader
which doesn't handle the config. You may be thinking of the _MatTabGroupBase
which does handle this
@@ -81,8 +86,13 @@ export class MatTabNav extends _MatTabNavBase implements AfterContentInit { | |||
* @deprecated @breaking-change 9.0.0 `platform` parameter to become required. | |||
*/ | |||
@Optional() platform?: Platform, | |||
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) { | |||
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string, | |||
@Optional() @Inject(MAT_TABS_CONFIG) defaultConfig?: MatTabsConfig) { | |||
super(elementRef, dir, ngZone, changeDetectorRef, viewportRuler, platform, animationMode); |
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.
Should we pass the defaultConfig
into the super class?
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 extends MatPaginatedTabHeader
which doesn't take the config
} | ||
|
||
/** Injection token that can be used to provide the default options the tabs module. */ | ||
export const MAT_TABS_CONFIG = new InjectionToken<MatTabsConfig>('MAT_TABS_CONFIG'); |
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.
I think this name is inconsistent with other components
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.
Based on in-person conversation, we'll file an issue for the inconsistent naming across components and address in the v10 range.
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.
LGTM, just need to update the API golden
} | ||
|
||
/** Injection token that can be used to provide the default options the tabs module. */ | ||
export const MAT_TABS_CONFIG = new InjectionToken<MatTabsConfig>('MAT_TABS_CONFIG'); |
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.
Based on in-person conversation, we'll file an issue for the inconsistent naming across components and address in the v10 range.
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. |
No description provided.