mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-08-31 08:39:24 +00:00
c9b8fb7809
* Introduced tsconfig.app.json and tsconfig.base.json * yarn.lock * Introduced tsconfig.app.json, tsconfig.base.jsonfig. * Refactored eslint.config.js to latest structure * Returned previous recommended rules. * More rules * Force import rules * Check * Check * Cleanup ESLint configuration and plugins * Cleanup heap: "writable",DD_RUM: "writable" from ESLint configuration * "scripts" moved to the top of package.json
33 lines
863 B
TypeScript
33 lines
863 B
TypeScript
import { mount } from "cypress/react";
|
|
|
|
import { Button } from "./common/Button/Button";
|
|
|
|
describe("Button component tests", () => {
|
|
const buttonText = "buttonText";
|
|
|
|
it("renders", () => {
|
|
mount(<Button onClick={() => {}} label=""></Button>);
|
|
cy.get("button").should("exist");
|
|
});
|
|
|
|
it("Should have correct text", () => {
|
|
mount(<Button label={buttonText} onClick={() => {}}></Button>);
|
|
cy.get("button").contains(buttonText);
|
|
});
|
|
|
|
it("calls onClick when clicked", () => {
|
|
const onClickStub = cy.stub().as("onClick");
|
|
|
|
mount(<Button onClick={onClickStub} label={""}></Button>);
|
|
|
|
cy.get("button").click();
|
|
cy.get("@onClick").should("have.been.calledOnce");
|
|
});
|
|
|
|
it("should be disabled", () => {
|
|
mount(<Button onClick={() => {}} disabled label={""}></Button>);
|
|
|
|
cy.get("button").should("be.disabled");
|
|
});
|
|
});
|