"use strict";

var _FloatingLayer = require("@enact/ui/FloatingLayer");
require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _Drawer = require("../Drawer");
var _jsxRuntime = require("react/jsx-runtime");
var FloatingLayerController = (0, _FloatingLayer.FloatingLayerDecorator)('div');
describe('Drawer specs', function () {
  test('should be rendered opened if open is set to true', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerController, {
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Drawer.Drawer, {
        open: true,
        children: "Hello!"
      })
    }));
    var drawer = _react.screen.getByText('Hello!');
    expect(drawer).toBeInTheDocument();
  });
  test('should not be rendered if open is set to false', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerController, {
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Drawer.Drawer, {
        open: false,
        children: "Hello!"
      })
    }));
    var drawer = _react.screen.queryByRole('Hello!');
    expect(drawer).toBeNull();
  });
  test('should apply `shown` class when visible', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerController, {
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Drawer.DrawerBase, {
        open: true
      })
    }));
    var drawerBase = _react.screen.getByRole('alert').parentElement.parentElement;
    var expected = 'shown';
    expect(drawerBase).toHaveClass(expected);
  });
  test('should apply `ease-in-out` class when noAnimation is false', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(FloatingLayerController, {
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Drawer.DrawerBase, {
        noAnimation: false,
        open: true
      })
    }));
    var drawerBase = _react.screen.getByRole('alert').parentElement.parentElement;
    var expected = 'ease-in-out';
    expect(drawerBase).toHaveClass(expected);
  });
});