UNPKG

@enact/sandstone

Version:

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

51 lines (50 loc) 1.89 kB
"use strict"; require("@testing-library/jest-dom"); var _react = require("@testing-library/react"); var _ActionGuide = require("../ActionGuide"); var _jsxRuntime = require("react/jsx-runtime"); describe('ActionGuide', function () { test('should render `icon`', function () { (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionGuide.ActionGuideBase, { "data-testid": "actionGuide", icon: "star" })); var expected = 983080; // decimal converted charCode of Unicode 'star' character var actual = _react.screen.getByTestId('actionGuide').children.item(0).textContent.codePointAt(); expect(actual).toBe(expected); }); test('should render `children`', function () { (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionGuide.ActionGuideBase, { "data-testid": "actionGuide", children: "content" })); var actual = _react.screen.getByText('content'); expect(actual).toBeInTheDocument(); }); test('should set "buttonAriaLabel" to action guide', function () { var label = 'custom aria-label'; (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionGuide.ActionGuideBase, { "data-testid": "actionGuide", buttonAriaLabel: label })); var actual = _react.screen.getByRole('button', { name: label }); expect(actual).toBeInTheDocument(); }); describe('CSS override', function () { test('should allow `actionGuide` to be augmented', function () { var css = { actionGuide: 'test-action-guide' }; (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionGuide.ActionGuideBase, { "data-testid": "actionGuide", css: css, children: "content" })); var expected = css.actionGuide; var actual = _react.screen.getByTestId('actionGuide'); expect(actual).toHaveClass(expected); }); }); });