import { RicosPluginToolbarNames } from "./../../ricos-types/index.js";
import { PLUGIN_TOOLBAR_DELETE_BUTTON } from "./../../_shared/data-hooks.js";
import { createDropdownModalUniDriver } from "./../../_shared/dropdown-modal/dropdown-modal-uni-driver.js";
import { dataHook } from "./../../wix-rich-content-common/index.js";
import {
  LAYOUT_CELL_HANDLE,
  LAYOUT_CELL_TOOLBAR_ADD_CELL_DROPDOWN_BUTTON,
  LAYOUT_CELL_TOOLBAR_MOVE_LEFT_BUTTON,
  LAYOUT_CELL_TOOLBAR_MOVE_RIGHT_BUTTON
} from "./data-hooks.js";
const createLayoutCellTestkit = (getBase) => {
  const addCellDropdown = createDropdownModalUniDriver(getBase);
  return {
    content: {},
    clickCellHandle: async (cellId) => {
      await (await getBase().get(dataHook(`${LAYOUT_CELL_HANDLE}-${cellId}`))).click();
    },
    toolbars: {
      createPluginToolbar: (getPluginToolbarBase) => ({
        clickAddCellDropdown: async () => {
          await (await getPluginToolbarBase(RicosPluginToolbarNames.LAYOUT_CELL).get(
            dataHook(LAYOUT_CELL_TOOLBAR_ADD_CELL_DROPDOWN_BUTTON)
          )).click();
        },
        clickAddCellBefore: async () => {
          await (await addCellDropdown.optionAtIndex(0)).click();
        },
        clickAddCellAfter: async () => {
          await (await addCellDropdown.optionAtIndex(1)).click();
        },
        clickMoveLeft: async () => {
          await (await getPluginToolbarBase(RicosPluginToolbarNames.LAYOUT_CELL).get(
            dataHook(LAYOUT_CELL_TOOLBAR_MOVE_LEFT_BUTTON)
          )).click();
        },
        clickMoveRight: async () => {
          await (await getPluginToolbarBase(RicosPluginToolbarNames.LAYOUT_CELL).get(
            dataHook(LAYOUT_CELL_TOOLBAR_MOVE_RIGHT_BUTTON)
          )).click();
        },
        clickDelete: async () => {
          await (await getPluginToolbarBase(RicosPluginToolbarNames.LAYOUT_CELL).get(
            dataHook(PLUGIN_TOOLBAR_DELETE_BUTTON)
          )).click();
        },
        exists: async () => {
          try {
            return getPluginToolbarBase(RicosPluginToolbarNames.LAYOUT_CELL).exists();
          } catch {
            return false;
          }
        }
      })
    }
  };
};
export {
  createLayoutCellTestkit
};
//# sourceMappingURL=cell.testkit.js.map
