Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Storybook 8 #2687

Merged
merged 28 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c438b49
Create turbo.json
TheSonOfThomp Feb 4, 2025
c8934f9
run sb migration
TheSonOfThomp Feb 4, 2025
0df50bf
bump sb package versions
TheSonOfThomp Feb 4, 2025
b92cd5c
ts fixes
TheSonOfThomp Feb 4, 2025
226b451
replace deprecated packages
TheSonOfThomp Feb 4, 2025
dd06f92
install babel-loader
TheSonOfThomp Feb 4, 2025
6f5e867
update controls in storybookArgTypes.ts
TheSonOfThomp Feb 4, 2025
e6b7a5d
Create upgrade-storybook-eight.md
TheSonOfThomp Feb 4, 2025
0e30f7f
Merge branch 'main' into a/sb
TheSonOfThomp Feb 4, 2025
93fe302
rm getAbsolutePath
TheSonOfThomp Feb 4, 2025
04b9ff2
Merge branch 'a/sb' of https://github.com/mongodb/leafygreen-ui into …
TheSonOfThomp Feb 4, 2025
0cf5591
Merge branch 'main' into a/sb
TheSonOfThomp Feb 5, 2025
c118f08
use latest babel-loader
TheSonOfThomp Feb 5, 2025
bf3a398
rm @sb/jest @sb/testing-lib
TheSonOfThomp Feb 5, 2025
e4cc370
resolve @testing-lib dom & user-event
TheSonOfThomp Feb 5, 2025
bae4480
reset pnpm lock
TheSonOfThomp Feb 5, 2025
ec8150b
Merge branch 'main' into a/sb
TheSonOfThomp Feb 5, 2025
639e686
updates r17 overrides
TheSonOfThomp Feb 5, 2025
fb0d2ea
await waitFor in combobox tests
TheSonOfThomp Feb 5, 2025
872600a
Merge branch 'main' into a/sb
TheSonOfThomp Feb 6, 2025
a8cfbf2
r17: install old lg sb packages
TheSonOfThomp Feb 6, 2025
a6fc50e
Merge branch 'main' into a/sb
TheSonOfThomp Feb 6, 2025
503e25e
rm pnpm cache. add verbose test log
TheSonOfThomp Feb 6, 2025
15f43cf
Merge branch 'a/sb' of https://github.com/mongodb/leafygreen-ui into …
TheSonOfThomp Feb 6, 2025
c049eaf
rm verbose
TheSonOfThomp Feb 6, 2025
a0665b8
Merge branch 'main' into a/sb
TheSonOfThomp Feb 6, 2025
89e698d
Merge branch 'main' into a/sb
TheSonOfThomp Feb 7, 2025
7322089
disable r17 tests
TheSonOfThomp Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/upgrade-storybook-eight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@lg-tools/storybook-decorators': minor
'@lg-tools/storybook-addon': minor
'@lg-tools/storybook-utils': minor
---

Upgrades to Storybook 8.5
4 changes: 3 additions & 1 deletion .github/workflows/react17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
react17:
name: Test in React 17
runs-on: ubuntu-latest
# Disable this job until we can reliably test in React 17
# (or until we can remove the React 17 tests)
if: false
steps:
- uses: actions/checkout@v4

Expand All @@ -25,7 +28,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- name: Install node-gyp
run: pnpm add --global node-gyp
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ scripts/tmp.*
TODO.md

# PR train config (https://github.com/realyze/pr-train)
.pr-train.yml
.pr-train.yml
migration-storybook.log
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
"@lg-tools/storybook-addon": "workspace:^",
"@lg-tools/storybook-utils": "workspace:^",
"@lg-tools/test": "workspace:^",
"@storybook/react": "^7.6.20",
"@testing-library/react": "^12.0.0 || ^13.1.0 || ^14.0.0",
"@testing-library/react-hooks": ">=3.7.0",
"@storybook/react": "^8.5.3",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "13.5.0",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.170",
Expand All @@ -65,15 +64,17 @@
"prettier": "2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.6.20",
"ts-node":"10.9.2",
"storybook": "^8.5.3",
"ts-node": "10.9.2",
"turbo": "^2.0.6",
"typescript": "~4.9.0"
},
"pnpm": {
"overrides": {
"caniuse-lite": "^1.0.30001585",
"jackspeak": "2.1.1"
"jackspeak": "2.1.1",
"@testing-library/dom": "9.3.4",
"@testing-library/user-event": "13.5.0"
Comment on lines +76 to +77
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bruugey @storybook/test was resolving an incompatible version of @testing-library/dom

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok

}
},
"lg": {
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/src/Combobox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
StoryType,
} from '@lg-tools/storybook-utils';
import { StoryFn } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';

import Button from '@leafygreen-ui/button';
import { css } from '@leafygreen-ui/emotion';
Expand Down
14 changes: 7 additions & 7 deletions packages/combobox/src/Combobox/Combobox.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1328,16 +1328,16 @@ describe('packages/combobox', () => {
);
testSingleSelect(
'When cursor is at the beginning of input, Left arrow does nothing',
() => {
async () => {
const { inputEl } = renderCombobox(select);
userEvent.type(inputEl, '{arrowleft}');
waitFor(() => expect(inputEl).toHaveFocus());
await waitFor(() => expect(inputEl).toHaveFocus());
},
);
test('If cursor is NOT at the beginning of input, Left arrow key moves cursor', () => {
test('If cursor is NOT at the beginning of input, Left arrow key moves cursor', async () => {
const { inputEl } = renderCombobox(select);
userEvent.type(inputEl, 'abc{arrowleft}');
waitFor(() => expect(inputEl).toHaveFocus());
await waitFor(() => expect(inputEl).toHaveFocus());
});

test('When focus is on clear button, Left arrow moves focus to input', async () => {
Expand All @@ -1357,8 +1357,8 @@ describe('packages/combobox', () => {
const { queryChipsByIndex, inputEl } = renderCombobox(select, {
initialValue,
});
const secondChip = queryChipsByIndex(1);
userEvent.type(inputEl, '{arrowleft}{arrowleft}');
const secondChip = queryChipsByIndex(1);
expect(secondChip).toContainFocus();
},
);
Expand Down Expand Up @@ -1620,12 +1620,12 @@ describe('packages/combobox', () => {
* onChange
*/
describe('onChange', () => {
test('Selecting an option calls onChange callback', () => {
test('Selecting an option calls onChange callback', async () => {
const onChange = jest.fn();
const { openMenu } = renderCombobox(select, { onChange });
const { optionElements } = openMenu();
userEvent.click(optionElements![0]);
waitFor(() => {
await waitFor(() => {
expect(onChange).toHaveBeenCalled();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useRef, useState } from 'react';
import { type StoryMetaType } from '@lg-tools/storybook-utils';
import { Decorator, StoryFn, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';
import last from 'lodash/last';
import omit from 'lodash/omit';
import MockDate from 'mockdate';
Expand Down
2 changes: 1 addition & 1 deletion packages/menu/src/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
StoryMetaType,
} from '@lg-tools/storybook-utils';
import { StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';

import Button from '@leafygreen-ui/button';
import { css } from '@leafygreen-ui/emotion';
Expand Down
2 changes: 1 addition & 1 deletion packages/search-input/src/SearchInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
StoryMetaType,
} from '@lg-tools/storybook-utils';
import { StoryFn } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';
import kebabCase from 'lodash/kebabCase';
import startCase from 'lodash/startCase';

Expand Down
2 changes: 1 addition & 1 deletion packages/select/src/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StoryMetaType,
} from '@lg-tools/storybook-utils';
import { StoryFn } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within } from '@storybook/test';

import { css, cx } from '@leafygreen-ui/emotion';
import BeakerIcon from '@leafygreen-ui/icon/dist/Beaker';
Expand Down
4 changes: 1 addition & 3 deletions packages/table/src/Table.Interactions.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
storybookExcludedControlParams,
StoryMetaType,
} from '@lg-tools/storybook-utils';
import { expect } from '@storybook/jest';
import { StoryFn } from '@storybook/react';
import { waitFor } from '@storybook/test';
import { within } from '@storybook/testing-library';
import { expect, waitFor, within } from '@storybook/test';

import Badge from '@leafygreen-ui/badge';
import { css } from '@leafygreen-ui/emotion';
Expand Down
Loading
Loading