"use strict";

var _jsxRuntime = require("react/jsx-runtime");

var _enzyme = require("enzyme");

var _ImageItem = require("../ImageItem");

var _ImageItemModule = _interopRequireDefault(require("../ImageItem.module.css"));

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

describe('ImageItem', function () {
  test('should render ImageItem with children', function () {
    var children = 'caption';
    var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "http://placehold.it/300x400/9037ab/ffffff&text=Image0",
      children: children
    }));
    var expected = children;
    var actual = subject.text();
    expect(actual).toBe(expected);
  });
  test('should omit caption node when `children` is unset', function () {
    var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "http://placehold.it/300x400/9037ab/ffffff&text=Image0"
    }));
    var actual = subject.find(".".concat(_ImageItemModule["default"].caption));
    expect(actual).toHaveLength(0);
  });
  test('should apply `captionOverlay` className when given `captionPosition=captionOverlay`', function () {
    var children = 'caption';
    var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "http://placehold.it/300x400/9037ab/ffffff&text=Image0",
      captionPosition: "overlay",
      children: children
    }));
    var expected = 'captionOverlay';
    var actual = subject.find(".".concat(_ImageItemModule["default"].captionOverlay)).at(1).prop('className');
    expect(actual).toContain(expected);
  });
  test('should apply horizontal className when given `orientation=horizontal`', function () {
    var children = 'caption';
    var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "http://placehold.it/300x400/9037ab/ffffff&text=Image0",
      orientation: "horizontal",
      children: children
    }));
    var expected = 'horizontal';
    var actual = subject.find(".".concat(_ImageItemModule["default"].horizontal)).at(1).prop('className');
    expect(actual).toContain(expected);
  });
  test('should display an image when given `src` prop', function () {
    var children = 'caption';
    var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "http://placehold.it/300x400/9037ab/ffffff&text=Image0",
      children: children
    }));
    var expected = 'image';
    var actual = subject.find(".".concat(_ImageItemModule["default"].image)).at(1).prop('className');
    expect(actual).toContain(expected);
  });
});