Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as React from 'react';
import {ClientRenderer, expect, selectDom, simulate, sinon, trigger, waitForDom as gWaitForDom} from 'test-drive-react';
import {AutoCompleteDemo} from '../../demo/components/auto-complete.demo';
import {AutoComplete} from '../../src';
const autoComp = 'AUTO_COMPLETE';
const autoCompDemo = autoComp + '_DEMO';
const autoCompInput = autoComp + '_INPUT';
const items = ['Muffins', 'Pancakes', 'Cupcakes', 'Souffles', 'Pasta', 'Soup', 'Caramel', 'Avazim', 'Moses'];
const bodySelect = selectDom(document.body);
const bodyWaitForDom = gWaitForDom.bind(null, document.body);
describe('', () => {
const clientRenderer = new ClientRenderer();
afterEach(() => clientRenderer.cleanup());
describe('The autocomplete user', () => {
it('types in the input and selects a value', async () => {
const {select, waitForDom} = clientRenderer.render();
const prefix = 'P';
const filteredItems = items.filter(item => item.startsWith(prefix)).join('');
simulate.click(select(autoComp + '_CARET'));
const itemList = bodySelect('LIST')!;
await bodyWaitForDom(() => {
expect(itemList).to.be.present();