"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.editBlockSmartLinkUrlTestCase = exports.editBlockSmartLinkTitleTestCase = void 0;
var _inProductTesting = require("@atlaskit/in-product-testing");
var _inProduct = require("@atlaskit/smart-card/in-product");
var _Editor = require("../../../../page-objects/Editor");
var _EditorSmartLink = require("../../../../page-objects/EditorSmartLink");
var editBlockSmartLinkTitleTestCase = exports.editBlockSmartLinkTitleTestCase = function editBlockSmartLinkTitleTestCase(_ref) {
  var ui = _ref.ui,
    url = _ref.url;
  return new _inProductTesting.InProductTestCase({
    title: 'editing a Block Smart Link renders as Blue Link (title)',
    id: 'block-smart-link-edit-title',
    assertions: function assertions(cy) {
      var editor = new _Editor.EditorPageObject(cy);
      var editorWithSmartLinks = new _EditorSmartLink.EditorSmartLinkPageObject(cy, editor);
      var blockCard = new _inProduct.BlockCardPageObject(cy);
      editorWithSmartLinks.insertSmartLinkByTyping(url);
      editorWithSmartLinks.switchAfterInsert('block');
      (0, _inProduct.blockSmartLinkRendersTestCase)({
        url: url
      }).assertions(cy);
      editorWithSmartLinks.changeLinkLabel('Avocorne is watching you 🥑', 'block');
      blockCard.assertHrefRendered(url);
      blockCard.expectCardNotExists();
      if (ui !== null && ui !== void 0 && ui.publishButton) {
        var renderer = editor.publish(ui);
        renderer.expectContentReady();
        blockCard.assertHrefRendered(url);
        blockCard.expectCardNotExists();
      }
    }
  });
};
var editBlockSmartLinkUrlTestCase = exports.editBlockSmartLinkUrlTestCase = function editBlockSmartLinkUrlTestCase(_ref2) {
  var ui = _ref2.ui,
    url = _ref2.url;
  return new _inProductTesting.InProductTestCase({
    title: 'editing a Block Smart Link renders as Blue Link (URL)',
    id: 'block-smart-link-edit',
    assertions: function assertions(cy) {
      var editor = new _Editor.EditorPageObject(cy);
      var editorWithSmartLinks = new _EditorSmartLink.EditorSmartLinkPageObject(cy, editor);
      var blockCard = new _inProduct.BlockCardPageObject(cy);
      editorWithSmartLinks.insertSmartLinkByTyping(url);
      editorWithSmartLinks.switchAfterInsert('block');
      (0, _inProduct.blockSmartLinkRendersTestCase)({
        url: url
      }).assertions(cy);
      var newUrl = 'https://avo.corne.com';
      editorWithSmartLinks.changeLinkUrl(newUrl, 'block');
      blockCard.expectCardNotExists();
      blockCard.assertHrefRendered(newUrl);
      if (ui !== null && ui !== void 0 && ui.publishButton) {
        var renderer = editor.publish(ui);
        renderer.expectContentReady();
        blockCard.assertHrefRendered(newUrl);
        blockCard.expectCardNotExists();
      }
    }
  });
};