import { dataHook } from "./../wix-rich-content-common/index.js";
import { TOOLBAR_VISIBLE } from "./../toolbars-v3/components/Toolbar/index.js";
import { createNewColorPickerUniDriver } from "./../ui-components/testkit.js";
import {
  BACKGROUND_COLOR,
  FOREGROUND_COLOR,
  TEXT_BUTTON_TEXT_COLOR,
  TEXT_BUTTON_TEXT_HIGHLIGHT
} from "./data-hooks.js";
const createTextColorTestkit = (getBase) => {
  const getBackground = async (index) => getBase().$$(dataHook(BACKGROUND_COLOR)).get(index);
  const getForeground = async (index) => getBase().$$(dataHook(FOREGROUND_COLOR)).get(index);
  return {
    content: {
      atIndex: (index) => ({
        backgroundExists: async () => (await getBackground(index)).exists(),
        foregroundExists: async () => (await getForeground(index)).exists(),
        getBackgroundColor: async () => {
          const background = await getBackground(index);
          const el = await background.getNative();
          return el.style.backgroundColor;
        },
        getForegroundColor: async () => {
          const foreground = await getForeground(index);
          const el = await foreground.getNative();
          return el.style.color;
        }
      })
    },
    toolbars: {
      createTextButtonToolbars: (getTextButtonToolbarBase) => {
        const getVisibleToolbar = () => getTextButtonToolbarBase().$(dataHook(TOOLBAR_VISIBLE));
        return {
          clickTextColor: async () => {
            await getVisibleToolbar().$(dataHook(TEXT_BUTTON_TEXT_COLOR)).click();
          },
          clickTextHighlight: async () => {
            await getVisibleToolbar().$(dataHook(TEXT_BUTTON_TEXT_HIGHLIGHT)).click();
          },
          colorSwatchesModal: createNewColorPickerUniDriver(getBase)
        };
      }
    }
  };
};
export {
  createTextColorTestkit
};
//# sourceMappingURL=testkit.js.map
