Skip to content

Commit

Permalink
chore: add story
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Nov 15, 2024
1 parent 537b70d commit 43e9973
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/studio/src/components/Searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ const SearchButton = (props: ButtonProps) => {
rounded="md"
border="1px solid"
borderColor="base.divider.strong"
aria-label="search-button"
{...props}
>
<Box __css={styles.icon}>
Expand Down
14 changes: 14 additions & 0 deletions apps/studio/src/stories/Page/SitePage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { userEvent, waitFor, within } from "@storybook/test"
import { meHandlers } from "tests/msw/handlers/me"
import { pageHandlers } from "tests/msw/handlers/page"
import { resourceHandlers } from "tests/msw/handlers/resource"
import { sitesHandlers } from "tests/msw/handlers/sites"

import SitePage from "~/pages/sites/[siteId]"
import { createBannerGbParameters } from "../utils/growthbook"
Expand All @@ -21,6 +22,7 @@ const meta: Meta<typeof SitePage> = {
pageHandlers.readPage.content(),
pageHandlers.updateSettings.collection(),
pageHandlers.getPermalinkTree.withParent(),
sitesHandlers.getSiteName.default(),
resourceHandlers.getChildrenOf.default(),
resourceHandlers.getRolesFor.default(),
],
Expand All @@ -43,6 +45,18 @@ export const Default: Story = {
args: {},
}

export const SearchModal: Story = {
play: async ({ canvasElement }) => {
await waitFor(async () => {
const screen = within(canvasElement)
const searchButton = screen.getByRole("button", {
name: "search-button",
})
await userEvent.click(searchButton)
})
},
}

export const PageResourceMenu: Story = {
play: async ({ canvasElement }) => {
await waitFor(async () => {
Expand Down
7 changes: 7 additions & 0 deletions apps/studio/tests/msw/handlers/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ export const sitesHandlers = {
loading: () => siteListQuery({ wait: "infinite" }),
empty: () => siteListQuery({ isEmpty: true }),
},
getSiteName: {
default: () => {
return trpcMsw.site.getSiteName.query(async () => {

Check failure on line 46 in apps/studio/tests/msw/handlers/sites.ts

View workflow job for this annotation

GitHub Actions / lint

Async arrow function has no 'await' expression

Check failure on line 46 in apps/studio/tests/msw/handlers/sites.ts

View workflow job for this annotation

GitHub Actions / lint

Async arrow function has no 'await' expression
return { name: "Isomer" }
})
},
},
getTheme: {
default: () => {
return trpcMsw.site.getTheme.query(() => {
Expand Down

0 comments on commit 43e9973

Please sign in to comment.