-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add remaining examples to InputSearch docs and additional testi…
…ng examples and validation
- Loading branch information
Showing
22 changed files
with
646 additions
and
148 deletions.
There are no files selected for viewing
361 changes: 281 additions & 80 deletions
361
build.washingtonpost.com/docs/components/input-search.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchEmptyState } from "./InputSearchEmptyState"; | ||
|
||
describe("InputSearchEmptyState", () => { | ||
test("renders visibly into the document", () => { | ||
render(<InputSearchEmptyState />); | ||
expect(screen.getByText("No results found")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchInput } from "./InputSearchInput"; | ||
import { InputSearchRoot } from "./InputSearchRoot"; | ||
import { InputSearchPopover } from "./InputSearchPopover"; | ||
|
||
describe("InputSearchInput", () => { | ||
const customRender = (ui, contextProps) => { | ||
return render( | ||
<InputSearchRoot> | ||
{ui} | ||
<InputSearchPopover {...contextProps} /> | ||
</InputSearchRoot> | ||
); | ||
}; | ||
test("renders visibly into the document", () => { | ||
customRender(<InputSearchInput name="test" id="test" label="Test" />, {}); | ||
expect(screen.getByLabelText("Test")).toBeInTheDocument(); | ||
}); | ||
test("uses contexts portal prop", () => { | ||
customRender(<InputSearchInput name="test" id="test" label="Test" />, { | ||
portal: false, | ||
}); | ||
expect(screen.getByTestId("border-style-override")).toHaveStyle( | ||
"--wpds-colors-signal: var(--wpds-colors-subtle)" | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchItemText } from "./InputSearchItemText"; | ||
import { InputSearchRoot } from "./InputSearchRoot"; | ||
import { InputSearchListItem } from "./InputSearchListItem"; | ||
import { InputSearchList } from "./InputSearchList"; | ||
|
||
describe("InputSearchItemText", () => { | ||
const customRender = (ui, contextProps) => { | ||
return render( | ||
<InputSearchRoot> | ||
<InputSearchList> | ||
<InputSearchListItem {...contextProps}>{ui}</InputSearchListItem> | ||
</InputSearchList> | ||
</InputSearchRoot> | ||
); | ||
}; | ||
test("renders visibly into the document", () => { | ||
customRender(<InputSearchItemText>❦</InputSearchItemText>, { | ||
value: "test", | ||
}); | ||
expect(screen.getByText("test")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchList } from "./InputSearchList"; | ||
import { InputSearchRoot } from "./InputSearchRoot"; | ||
|
||
describe("InputSearchList", () => { | ||
const customRender = (ui, contextProps) => { | ||
return render(<InputSearchRoot {...contextProps}>{ui}</InputSearchRoot>); | ||
}; | ||
|
||
test("renders visibly into the document", () => { | ||
customRender(<InputSearchList />, {}); | ||
expect(screen.getByRole("listbox")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchListHeading } from "./InputSearchListHeading"; | ||
|
||
describe("InputSearchListHeading", () => { | ||
test("renders visibly into the document", () => { | ||
render(<InputSearchListHeading>test</InputSearchListHeading>); | ||
expect(screen.getByText("test")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchListItem } from "./InputSearchListItem"; | ||
import { InputSearchRoot } from "./InputSearchRoot"; | ||
import { InputSearchList } from "./InputSearchList"; | ||
|
||
describe("InputSearchItemText", () => { | ||
const customRender = (ui, contextProps) => { | ||
return render( | ||
<InputSearchRoot> | ||
<InputSearchList {...contextProps}>{ui}</InputSearchList> | ||
</InputSearchRoot> | ||
); | ||
}; | ||
test("renders visibly into the document", () => { | ||
customRender(<InputSearchListItem value="test" />, {}); | ||
expect(screen.getByRole("option")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchLoadingState } from "./InputSearchLoadingState"; | ||
|
||
describe("InputSearchLoadingState", () => { | ||
test("renders visibly into the document", () => { | ||
render(<InputSearchLoadingState />); | ||
expect(screen.getByText("Loading")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { InputSearchOtherState } from "./InputSearchOtherState"; | ||
import { Icon } from "@washingtonpost/wpds-icon"; | ||
import { Settings } from "@washingtonpost/wpds-assets"; | ||
|
||
describe("InputSearchOtherState", () => { | ||
test("renders visibly into the document", () => { | ||
render( | ||
<InputSearchOtherState | ||
icon={ | ||
<Icon label="test"> | ||
<Settings /> | ||
</Icon> | ||
} | ||
/> | ||
); | ||
expect(screen.getByText("test")).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.
e527dd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wpds-ui-kit-vitejs-v2-example – ./apps/vite-v2-project
wpds-ui-kit-vitejs-v2-example-git-main.preview.now.washingtonpost.com
wpds-ui-kit-vitejs-v2-example.preview.now.washingtonpost.com
wpds-ui-kit-viteks-v2-example.preview.now.washingtonpost.com
e527dd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wpds-ui-kit-vitejs-example – ./apps/vite-project
wpds-ui-kit-vitejs-example-git-main.preview.now.washingtonpost.com
wpds-ui-kit-vitejs-example.preview.now.washingtonpost.com
e527dd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wpds-ui-kit – ./build.washingtonpost.com
wpds-ui-kit.preview.now.washingtonpost.com
wpds-ui-kit-git-main.preview.now.washingtonpost.com
build.washingtonpost.com
e527dd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wpds-ui-kit-storybook – ./
wpds-ui-kit-storybook-git-main.preview.now.washingtonpost.com
wpds-ui-kit-storybook.preview.now.washingtonpost.com