import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';
import { baseUniDriverFactory } from '../../../../unidriver';

export function MultiDocumentViewUniDriver(base: UniDriver, _body: UniDriver) {
  const tags = () => base.$$('[data-hook="cell-multi-document-tag"]');
  const overflow = () => base.$('[data-hook="tag-list-overflow-chip"]');
  return {
    ...baseUniDriverFactory(base),
    hasTags: async () => (await tags().count()) > 0,
    getTagsCount: () => tags().count(),
    isEmpty: async () => !(await base.$('[data-hook="cell-multi-document-tags"]').exists()),
    hasOverflowChip: () => overflow().exists(),
    getOverflowChipText: async () => (await overflow().text()) ?? '',
  };
}
