Commit 7eff822
committed
test: make CodeInspection scroll-remember test environment-agnostic
The old "should remember scroll positions" spec called
CodeInspection.scrollToProblem(40) and asserted the resulting
scrollTop was non-zero. Both sides of that flaked across
environments:
- scrollToProblem uses Element.scrollIntoView, which picks a
scrollable ancestor that isn't always the .table-container we
asserted on.
- The problems panel's height depends on the window size / user
prefs; on wide windows the table fits all rows and no scroll is
possible, so scrollTop stays 0 regardless of how we invoke it.
Replace the assertion with the round-trip invariant: set
scrollTop(200) on the table, switch away, switch back, and wait
for scrollTop to land back at 200. The remember-scroll feature's
entire contract is this round-trip; verifying it makes the test
robust to panel height, platform, and headless runners.
Also add an awaitsFor gate for row 40 before the scroll is seeded
so the test doesn't race against async lint population.1 parent 8de5a6e commit 7eff822
1 file changed
Lines changed: 22 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
179 | 180 | | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | | - | |
183 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
184 | 192 | | |
185 | | - | |
186 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
187 | 197 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 198 | | |
193 | | - | |
194 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
195 | 202 | | |
196 | 203 | | |
197 | 204 | | |
| |||
0 commit comments