UNPKG

@enact/moonstone

Version:

Large-screen/TV support library for Enact, containing a variety of UI components.

49 lines (47 loc) 2.02 kB
"use strict"; require("@testing-library/jest-dom"); var _react = require("@testing-library/react"); var _Header = _interopRequireDefault(require("../Header")); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } describe('Header Specs', function () { test('should render with title text without changing case', function () { var msg = 'cRaZy-cased super Header'; (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Header["default"], { children: /*#__PURE__*/(0, _jsxRuntime.jsx)("title", { children: msg }) })); var titleText = _react.screen.getByText(msg); expect(titleText).toBeInTheDocument(); }); test('should have fullBleed class applied', function () { (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Header["default"], { fullBleed: true, children: /*#__PURE__*/(0, _jsxRuntime.jsx)("title", { children: "Header" }) })); var headerElement = _react.screen.getByLabelText('Header'); expect(headerElement).toHaveClass('fullBleed'); }); test('should inject a custom component when headerInput is used', function () { var Input = function Input() { return /*#__PURE__*/(0, _jsxRuntime.jsx)("input", { "data-testid": "input" }); }; // This just uses an <input> tag for easy discoverability. It should behave the same way // as a moonstone/Input, the standard here, but that would require importing a diffenent // component than what we're testing here. (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Header["default"], { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("title", { children: "Header" }), /*#__PURE__*/(0, _jsxRuntime.jsx)("headerInput", { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {}) })] })); var inputElement = _react.screen.getByTestId('input'); expect(inputElement).toBeInTheDocument(); }); });