MCPcopy Index your code
hub / github.com/remix-run/react-router / runTests

Function runTests

integration/scroll-test.ts:84–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82});
83
84function runTests() {
85 test("page scroll should be at the top on the new page", async ({ page }) => {
86 let app = new PlaywrightFixture(appFixture, page);
87 await app.goto("/");
88
89 // Scroll to the bottom and submit
90 await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
91 let scroll = await page.evaluate(() => window.scrollY);
92 expect(scroll).toBeGreaterThan(0);
93 await app.clickSubmitButton("/?index");
94 await page.waitForSelector("#redirected");
95
96 // Ensure we scrolled back to the top
97 scroll = await page.evaluate(() => window.scrollY);
98 expect(scroll).toBe(0);
99 });
100
101 test("should scroll to hash locations", async ({ page }) => {
102 let app = new PlaywrightFixture(appFixture, page);
103 await app.goto("/hash");
104 let scroll = await page.evaluate(() => window.scrollY);
105 expect(scroll).toBe(0);
106 await app.clickLink("/hash#hello-world");
107 await expect
108 .poll(() => page.evaluate(() => window.scrollY))
109 .toBeGreaterThan(0);
110 });
111
112 test("should scroll to hash locations with URL encoded characters", async ({
113 page,
114 }) => {
115 let app = new PlaywrightFixture(appFixture, page);
116 await app.goto("/hash");
117 let scroll = await page.evaluate(() => window.scrollY);
118 expect(scroll).toBe(0);
119 await app.clickLink("/hash#hello 🌎");
120 await expect
121 .poll(() => page.evaluate(() => window.scrollY))
122 .toBeGreaterThan(0);
123 });
124}

Callers 1

scroll-test.tsFile · 0.70

Calls 3

gotoMethod · 0.95
clickSubmitButtonMethod · 0.95
clickLinkMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…