"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _Image = _interopRequireDefault(require("../Image"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var src = {
  hd: 'https://placehold.co/200x200',
  fhd: 'https://placehold.co/300x300',
  uhd: 'https://placehold.co/600x600'
};
describe('Image', function () {
  test('should select a src', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], {
      src: src
    }));
    var image = _react.screen.getAllByRole('img')[1];

    // dispatching resize event for code coverage purposes
    (0, _react.fireEvent)(window, new Event('resize'));
    var actual = image.getAttribute('src');
    var expected = 'https://placehold.co/300x300';
    expect(actual).toBe(expected);
  });
  test('should render image with sizing `fill`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], {
      src: src
    }));
    var image = _react.screen.getAllByRole('img')[0];
    var expected = "image fill";
    expect(image).toHaveClass(expected);
  });
  test('should render image with sizing `fit`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], {
      sizing: "fit",
      src: src
    }));
    var image = _react.screen.getAllByRole('img')[0];
    var expected = "image fit";
    expect(image).toHaveClass(expected);
  });
  test('should render image with sizing `none`', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], {
      sizing: "none",
      src: src
    }));
    var image = _react.screen.getAllByRole('img')[0];
    var expected = "image";
    expect(image).toHaveClass(expected);
  });
});