MCPcopy Create free account
hub / github.com/angular/components / assertNextButtonScrolling

Function assertNextButtonScrolling

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

* Asserts that auto scrolling using the next 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

507 * @param endEventName Name of the event that is supposed to end the scrolling.
508 */
509 async function assertNextButtonScrolling(startEventName: string, endEventName: string) {
510 expect(header.scrollDistance).withContext('Expected to start off not scrolled.').toBe(0);
511
512 dispatchFakeEvent(nextButton, startEventName);
513 fixture.detectChanges();
514 await wait(300);
515
516 expect(header.scrollDistance)
517 .withContext('Expected not to scroll after short amount of time.')
518 .toBe(0);
519
520 await wait(600);
521
522 expect(header.scrollDistance)
523 .withContext('Expected to scroll after some time.')
524 .toBeGreaterThan(0);
525
526 let previousDistance = header.scrollDistance;
527
528 // Wait for interval (100ms)
529 await wait(200);
530
531 expect(header.scrollDistance)
532 .withContext('Expected to scroll again after some more time.')
533 .toBeGreaterThan(previousDistance);
534
535 dispatchFakeEvent(nextButton, endEventName);
536 await wait(100);
537 }
538
539 /**
540 * Asserts that auto scrolling using the previous button works.

Callers 1

tab-header.spec.tsFile · 0.85

Calls 2

dispatchFakeEventFunction · 0.85
waitFunction · 0.70

Tested by

no test coverage detected