-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Card): only capture keys on expandable sections
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/orbit-components/src/Card/CardSection/CardSection.ct-story.tsx
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 RandomIdProvider from "../../OrbitProvider/RandomId/Provider"; | ||
|
||
import CardSection from "."; | ||
|
||
export function CardSectionInput() { | ||
return ( | ||
<RandomIdProvider useId={React.useId}> | ||
<CardSection> | ||
<input type="text" data-test="input" /> | ||
</CardSection> | ||
</RandomIdProvider> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/orbit-components/src/Card/CardSection/CardSection.ct.tsx
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,16 @@ | ||
import * as React from "react"; | ||
import { test, expect } from "@playwright/experimental-ct-react"; | ||
|
||
import { CardSectionInput } from "./CardSection.ct-story"; | ||
|
||
test.describe("interaction", () => { | ||
test("typing spaces works on non-expandable sections", async ({ mount }) => { | ||
const component = await mount(<CardSectionInput />); | ||
const input = component.getByTestId("input"); | ||
|
||
await input.focus(); | ||
await input.press("Space"); | ||
|
||
expect(await input.inputValue()).toBe(" "); | ||
}); | ||
}); |
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