"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _ImageItem = require("../ImageItem");
var _jsxRuntime = require("react/jsx-runtime");
describe('ImageItem', function () {
  var children = 'caption';
  test('should render ImageItem with children', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "https://placehold.co/300x400/9037ab/ffffff/png?text=Image0",
      children: children
    }));
    var actual = _react.screen.getByText(children);
    expect(actual).toBeInTheDocument();
  });
  test('should omit caption node when `children` is unset', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "https://placehold.co/300x400/9037ab/ffffff/png?text=Image0"
    }));
    var actual = _react.screen.getAllByRole('img')[0];
    expect(actual.nextElementSibling).toBeNull();
  });
  test('should apply `captionOverlay` className when given `captionPosition=captionOverlay`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "https://placehold.co/300x400/9037ab/ffffff/png?text=Image0",
      captionPosition: "overlay",
      children: children
    }));
    var expected = 'captionOverlay';
    var actual = _react.screen.getByText('caption').parentElement;
    expect(actual).toHaveClass(expected);
  });
  test('should apply horizontal className when given `orientation=horizontal`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "https://placehold.co/300x400/9037ab/ffffff/png?text=Image0",
      orientation: "horizontal",
      children: children
    }));
    var expected = 'horizontal';
    var actual = _react.screen.getAllByRole('img')[0].parentElement;
    expect(actual).toHaveClass(expected);
  });
  test('should display an image when given `src` prop', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItem, {
      src: "https://placehold.co/300x400/9037ab/ffffff/png?text=Image0",
      children: children
    }));
    var expected = 'image';
    var actual = _react.screen.getAllByRole('img')[0];
    expect(actual).toHaveClass(expected);
  });
});