UNPKG

@octopusdeploy/design-system-components

Version:
36 lines (35 loc) 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("@testing-library/react"); const vitest_1 = require("vitest"); const Theme_1 = require("../../../../Theme"); const utils_1 = require("../../../../utils"); const getTheme_1 = require("../../../../utils/getTheme"); const TestDesignSystemProvider_1 = require("../../../TestDesignSystemProvider"); const InlineEmptyStateOnboarding_1 = require("../InlineEmptyStateOnboarding"); (0, vitest_1.describe)("InlineEmptyStateOnboarding", () => { (0, vitest_1.describe)("EntityName", () => { (0, vitest_1.it)("should set default title and description", () => { const interactions = renderComponent({ illustration: "NoEntities", entityName: "Test Entity", actions: { primary: { type: "button", label: "Primary Action", onClick: utils_1.noOp } } }); interactions.assertText(/You don't have any Test Entity yet/i); interactions.assertText(/Start creating by clicking on Primary Action/i); }); }); (0, vitest_1.describe)("Custom title and description", () => { (0, vitest_1.it)("Should use custom title and description", () => { const interactions = renderComponent({ illustration: "NoEntities", title: "My cool title", description: "My cool description", actions: { primary: { type: "button", label: "Primary Action", onClick: utils_1.noOp } } }); interactions.assertText(/My cool description/i); interactions.assertText(/My cool title/i); }); }); }); function renderComponent(props) { (0, react_1.render)((0, jsx_runtime_1.jsx)(Theme_1.DesignSystemThemeProvider, { value: (0, getTheme_1.getTheme)("light"), children: (0, jsx_runtime_1.jsx)(TestDesignSystemProvider_1.TestDesignSystemProvider, { children: (0, jsx_runtime_1.jsx)(InlineEmptyStateOnboarding_1.InlineEmptyStateOnboarding, { ...props }) }) })); return interactions; } const interactions = { assertText(expected) { (0, vitest_1.expect)(react_1.screen.getByText(expected)).toBeInTheDocument(); }, };