import { dataHook } from "./../../../../wix-rich-content-common/index.js";
import { TOOLBAR_VISIBLE } from "../../../components/Toolbar/index.js";
import { FLOATING_PLUGIN_TOOLBAR } from "../index.js";
const createPluginToolbarTestkit = (getBase, createPluginToolbarPluginTestkits) => {
  const getPluginToolbar = () => getBase().$(dataHook([FLOATING_PLUGIN_TOOLBAR])).$(dataHook(TOOLBAR_VISIBLE));
  const getPluginToolbarByType = (pluginType) => getBase().$(dataHook([FLOATING_PLUGIN_TOOLBAR, pluginType])).$(dataHook(TOOLBAR_VISIBLE));
  return {
    waitForElement: async () => {
      const pluginToolbar = getPluginToolbar();
      await pluginToolbar.wait();
      return pluginToolbar;
    },
    getButtonsAmount: async () => {
      const pluginToolbar = getPluginToolbar();
      const buttons = pluginToolbar.$$("button");
      return await buttons.count();
    },
    scrollToElementByIndex: async (index) => {
      const pluginToolbar = getPluginToolbar();
      const button = pluginToolbar.$$("button").get(index);
      if (!button) {
        throw new Error(`Plugin toolbar doesn't have a button at index ${index}`);
      }
      await button.scrollIntoView?.();
    },
    plugins: createPluginToolbarPluginTestkits(getPluginToolbarByType)
  };
};
export {
  createPluginToolbarTestkit
};
//# sourceMappingURL=plugin.testkit.js.map
