"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _react = _interopRequireDefault(require("react"));
var _ = _interopRequireDefault(require("."));
var _react2 = require("../utils/test-utils/react");
var _CollapsePrivateUni = require("./test/Collapse.private.uni.driver");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Collapse/Collapse.spec.tsx",
  _this = void 0;
describe('Collapse', () => {
  var render = (0, _react2.createRendererWithUniDriver)(_CollapsePrivateUni.collapsePrivateDriverFactory);
  it('should render', /*#__PURE__*/(0, _asyncToGenerator2.default)(function* () {
    var {
      driver
    } = render(/*#__PURE__*/_react.default.createElement(_.default, {
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 10,
        columnNumber: 31
      }
    }));
    expect(yield driver.exists()).toBe(true);
  }));
  it('should render children', () => {
    var {
      container
    } = render(/*#__PURE__*/_react.default.createElement(_.default, {
      children: "hello",
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 15,
        columnNumber: 34
      }
    }));
    expect(container.textContent).toEqual('hello');
  });
  describe('`open` prop', () => {
    it('should not render children when false', () => {
      var {
        container
      } = render(/*#__PURE__*/_react.default.createElement(_.default, {
        open: false,
        children: "hello",
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 21,
          columnNumber: 36
        }
      }));
      expect(container.textContent).toEqual('');
    });
    it('should be reported as false by testkit`s isOpen() when false', /*#__PURE__*/(0, _asyncToGenerator2.default)(function* () {
      var {
        driver
      } = render(/*#__PURE__*/_react.default.createElement(_.default, {
        open: false,
        children: "hello",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 26,
          columnNumber: 33
        }
      }));
      expect(yield driver.isOpen()).toEqual(false);
    }));
    it('should be reported as true by testkit`s isOpen() when true', /*#__PURE__*/(0, _asyncToGenerator2.default)(function* () {
      var {
        driver
      } = render(/*#__PURE__*/_react.default.createElement(_.default, {
        open: true,
        children: "hello",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 31,
          columnNumber: 33
        }
      }));
      expect(yield driver.isOpen()).toEqual(true);
    }));
  });
  describe('`dataHook` prop', () => {
    it('should be passed to children', () => {
      var hookForRoot = "I'm Hooked!";
      var hookOfChild = 'Leave britney alone!';
      var {
        container
      } = render(/*#__PURE__*/_react.default.createElement(_.default, {
        dataHook: hookForRoot,
        children: /*#__PURE__*/_react.default.createElement("div", {
          "data-hook": hookOfChild,
          __self: void 0,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 44,
            columnNumber: 21
          }
        }, "arbitrary content"),
        __self: void 0,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 42,
          columnNumber: 9
        }
      }));
      expect(!!container.querySelector("[data-hook=\"".concat(hookOfChild, "\"]"))).toBe(true);
    });
  });
});
//# sourceMappingURL=Collapse.spec.js.map