-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
packages/copy-manager/ui-src/__tests__/NodeKeyInput.spec.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,29 @@ | ||
import { NodeKeyInput } from "../components/NodeKeyInput"; | ||
import { fireEvent, render, screen, waitFor } from "@testing-library/react"; | ||
import userEvents from "@testing-library/user-event"; | ||
import React from "react"; | ||
import { beforeEach, describe, expect, test, vi } from "vitest"; | ||
import { SelectableTextNodeInfo } from "../../shared-src/messages"; | ||
|
||
describe("NodeKeyInput", () => { | ||
test("call onUpdateNodeKey on blur", async () => { | ||
const mockNodeInfo = { | ||
characters: "a", | ||
checked: false, | ||
id: "node1:1", | ||
key: "key", | ||
name: "Frame 1", | ||
} satisfies SelectableTextNodeInfo; | ||
const updateSpy = vi.fn(); | ||
render( | ||
<NodeKeyInput nodeInfo={mockNodeInfo} onUpdateNodeKey={updateSpy} /> | ||
); | ||
await userEvents.type( | ||
screen.getByPlaceholderText(mockNodeInfo.name), | ||
"abc" | ||
); | ||
expect(updateSpy).not.toBeCalled(); | ||
fireEvent.blur(screen.getByPlaceholderText(mockNodeInfo.name)); | ||
expect(updateSpy).toBeCalledWith(mockNodeInfo.id, "keyabc"); | ||
}); | ||
}); |
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
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
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
16 changes: 16 additions & 0 deletions
16
packages/table-generator/ui-src/components/ContentStatus.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 { StackLayout, StatusIndicator, Text } from "@salt-ds/core"; | ||
|
||
// Salt pattern - https://www.saltdesignsystem.com/salt/patterns/content-status | ||
export const ContentStatus = (props: { message: string; title: string }) => { | ||
return ( | ||
<StackLayout> | ||
<StatusIndicator status="info" size={2} /> | ||
<StackLayout gap={1}> | ||
<Text> | ||
<strong>{props.title}</strong> | ||
</Text> | ||
<Text>{props.message}</Text> | ||
</StackLayout> | ||
</StackLayout> | ||
); | ||
}; |
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