Skip to content

Commit

Permalink
Merge branch 'master' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
simboonlong committed Sep 28, 2023
2 parents b1e6542 + db4c3ec commit d2e9b97
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/components/common/RedactableValue.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,16 @@ describe("redactablevalue component", () => {
render(<RedactableValue value={`foo`} isValueHidden onRedactionRequested={callback} editable />);
expect(screen.queryByTestId("redactable-value")).not.toBeInTheDocument();
});

it("should show redact handler when value exists", () => {
const callback = jest.fn();
render(<RedactableValue value={`foo`} onRedactionRequested={callback} editable />);
expect(screen.queryByTitle("Redact handler")).toBeInTheDocument();
});

it("should not show redact handler when value does not exists (obfuscated)", () => {
const callback = jest.fn();
render(<RedactableValue onRedactionRequested={callback} editable />);
expect(screen.queryByTitle("Redact handler")).not.toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion src/components/common/RedactableValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const RedactableValue: FunctionComponent<RedactValueProps> = ({
{getMessage()}
</span>
)}
{editable && (
{editable && value && (
<span
title="Redact handler"
className={`inline-block cursor-pointer ${className}`}
Expand Down

0 comments on commit d2e9b97

Please sign in to comment.