// @flow import React from 'react'; import classNames from 'classnames'; import scrollIntoView from 'scroll-into-view'; import highlightElement from './helpers/highlight'; import Variant from './Variant'; type TestProps = { pickedVariants: { [testId: string]: string; }; onChangeVariant: (testId: string, variantId: string) => void; } & TestData; function findTestElementById(id: string) { return document.querySelector(`.ABTestWrapper[data-test=${id}]`); } function Test({ id, title, isEnabled, variants, pickedVariants, onChangeVariant, }: TestProps) { const onHover = () => { const element = findTestElementById(id); if (!element) return; scrollIntoView(element); highlightElement(id, element); }; return (