mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Clean up tests
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
3888e46e2f
commit
4d0e841343
@ -4,6 +4,7 @@ exports[`<UpdateButton/> should render if warning level prop passed 1`] = `
|
||||
<button
|
||||
class="updateButton"
|
||||
data-testid="update-button"
|
||||
data-warning-level="light"
|
||||
id="update-lens-button"
|
||||
>
|
||||
Update
|
||||
|
||||
@ -51,19 +51,27 @@ describe("<UpdateButton/>", () => {
|
||||
expect(update).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should have class name with medium warning level", () => {
|
||||
it("should have light warning level", () => {
|
||||
const { getByTestId } = render(<UpdateButton update={update} warningLevel="light" />);
|
||||
|
||||
const button = getByTestId("update-button");
|
||||
|
||||
expect(button.dataset.warningLevel).toBe("light");
|
||||
});
|
||||
|
||||
it("should have medium warning level", () => {
|
||||
const { getByTestId } = render(<UpdateButton update={update} warningLevel="medium" />);
|
||||
|
||||
const button = getByTestId("update-button");
|
||||
|
||||
expect(button.className.toLowerCase().includes("medium")).toBeTruthy();
|
||||
expect(button.dataset.warningLevel).toBe("medium");
|
||||
});
|
||||
|
||||
it("should have class name with high warning level", () => {
|
||||
it("should have high warning level", () => {
|
||||
const { getByTestId } = render(<UpdateButton update={update} warningLevel="high" />);
|
||||
|
||||
const button = getByTestId("update-button");
|
||||
|
||||
expect(button.className.toLowerCase().includes("high")).toBeTruthy();
|
||||
expect(button.dataset.warningLevel).toBe("high");
|
||||
});
|
||||
});
|
||||
|
||||
@ -34,6 +34,7 @@ export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) {
|
||||
<>
|
||||
<button
|
||||
data-testid="update-button"
|
||||
data-warning-level={warningLevel}
|
||||
id={buttonId}
|
||||
className={cssNames(styles.updateButton, {
|
||||
[styles.warningHigh]: warningLevel === "high",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user