-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix:(tabs) add call for rechecking tab scroll distance #15173
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -604,6 +604,26 @@ describe('MatTabHeader', () => { | |
| expect(tabHeaderElement.classList).toContain(enabledClass); | ||
| }); | ||
|
|
||
| it('scroll to last tab', () => { | ||
| fixture = TestBed.createComponent(SimpleTabHeaderApp); | ||
| appComponent = fixture.componentInstance; | ||
| appComponent.tabs = [ | ||
| {label: 'tab one'}, | ||
| {label: 'tab two'}, | ||
| {label: 'tab three'}, | ||
| {label: 'tab four'}, | ||
| {label: 'tab five'}, | ||
| {label: 'tab six'}, | ||
| {label: 'tab seven'}, | ||
| {label: 'tab eight'}, | ||
| ]; | ||
| appComponent.tabHeader.selectedIndex = 8; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be 7? Index 8 is out of bounds of the array. |
||
|
|
||
| fixture.componentRef.changeDetectorRef.markForCheck(); | ||
|
|
||
| expect(appComponent.tabHeader.scrollDistance) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that this test is verifying the correct thing. I tried pasting it into master without the fix from this PR and it still passes. This somewhat defeats the purpose of the test, because we won't know if we accidentally introduce a regression. |
||
| .toBe(appComponent.tabHeader._getMaxScrollDistance()); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
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.
nit: we usually start test names with "should".