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
|
<button
|
||||||
class="updateButton"
|
class="updateButton"
|
||||||
data-testid="update-button"
|
data-testid="update-button"
|
||||||
|
data-warning-level="light"
|
||||||
id="update-lens-button"
|
id="update-lens-button"
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
|
|||||||
@ -51,19 +51,27 @@ describe("<UpdateButton/>", () => {
|
|||||||
expect(update).toHaveBeenCalled();
|
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 { getByTestId } = render(<UpdateButton update={update} warningLevel="medium" />);
|
||||||
|
|
||||||
const button = getByTestId("update-button");
|
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 { getByTestId } = render(<UpdateButton update={update} warningLevel="high" />);
|
||||||
|
|
||||||
const button = getByTestId("update-button");
|
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
|
<button
|
||||||
data-testid="update-button"
|
data-testid="update-button"
|
||||||
|
data-warning-level={warningLevel}
|
||||||
id={buttonId}
|
id={buttonId}
|
||||||
className={cssNames(styles.updateButton, {
|
className={cssNames(styles.updateButton, {
|
||||||
[styles.warningHigh]: warningLevel === "high",
|
[styles.warningHigh]: warningLevel === "high",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user