Skip to content

Commit

Permalink
Fixed scroll + Snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Jan 10, 2024
1 parent b134874 commit abaab2d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/code-studio/src/styleguide/SamplesMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,19 @@ export function SamplesMenu(): JSX.Element {
? null
: document.querySelector(window.location.hash);

if (el) {
// Give everything a chance to render before scrolling
setTimeout(() => {
// Give everything a chance to render before scrolling
setTimeout(() => {
if (el) {
el.scrollIntoView();
}, 0);
}
} else {
// NavTabList sample causes auto scrolling to middle of page, so we
// have to explicilty scroll back to the top of the page
window.scrollTo({
top: 0,
behavior: 'auto',
});
}
}, 0);
}, []);

const onAction = useCallback((key: Key) => {
Expand Down
Binary file modified tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/styleguide.spec.ts-snapshots/charts-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit abaab2d

Please sign in to comment.