"use strict";

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _maybeChildMenu = _interopRequireDefault(require("../maybe-child-menu.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*
Copyright (c) 2018 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
describe('MaybeChildMenu', function () {
  it('does not render popover if getChildMenu is undefined', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_maybeChildMenu.default, {
      getChildMenu: null,
      item: {
        label: 'item'
      }
    }, _react.default.createElement("div", null, "child")));
    expect(wrapper.children().first().name()).toBe('div');
  });
  it('renders popover if getChildMenu is provided', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_maybeChildMenu.default, {
      getChildMenu: function getChildMenu() {
        return _react.default.createElement("button", null, "child menu");
      },
      item: {
        label: 'item'
      }
    }, _react.default.createElement("div", null, "child")));
    expect(wrapper.children().first().name()).toBe('StatefulPopover');
  });
});