MCPcopy Index your code
hub / github.com/angular/components / assertPrevButtonScrolling

Function assertPrevButtonScrolling

src/material/tabs/tab-header.spec.ts:535–568  ·  view source on GitHub ↗

* Asserts that auto scrolling using the previous button works. * @param startEventName Name of the event that is supposed to start the scrolling. * @param endEventName Name of the event that is supposed to end the scrolling.

(startEventName: string, endEventName: string)

Source from the content-addressed store, hash-verified

533 * @param endEventName Name of the event that is supposed to end the scrolling.
534 */
535 async function assertPrevButtonScrolling(startEventName: string, endEventName: string) {
536 header.scrollDistance = Infinity;
537 fixture.detectChanges();
538
539 let currentScroll = header.scrollDistance;
540
541 expect(currentScroll).withContext('Expected to start off scrolled.').toBeGreaterThan(0);
542
543 dispatchFakeEvent(prevButton, startEventName);
544 fixture.detectChanges();
545 await wait(300);
546
547 expect(header.scrollDistance)
548 .withContext('Expected not to scroll after short amount of time.')
549 .toBe(currentScroll);
550
551 // Wait to exceed delay (300 + 500 = 800ms > 650ms)
552 await wait(600);
553
554 expect(header.scrollDistance)
555 .withContext('Expected to scroll after some time.')
556 .toBeLessThan(currentScroll);
557
558 currentScroll = header.scrollDistance;
559 await wait(200);
560
561 expect(header.scrollDistance)
562 .withContext('Expected to scroll again after some more time.')
563 .toBeLessThan(currentScroll);
564
565 dispatchFakeEvent(nextButton, endEventName);
566 // Wait for any cleanup or final events
567 await wait(100);
568 }
569 });
570
571 describe('disabling pagination', () => {

Callers 1

tab-header.spec.tsFile · 0.85

Calls 2

dispatchFakeEventFunction · 0.85
waitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…