import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; /** @jsx createElement */ describe('Select', () => { let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scratch); }); it('should set ); } render(, scratch); expect(scratch.firstChild.value).to.equal('B'); }); it('should set value with selected', () => { function App() { return ( ); } render(, scratch); expect(scratch.firstChild.value).to.equal('B'); }); it('should work with multiple selected', () => { function App() { return ( ); } render(, scratch); Array.prototype.slice.call(scratch.firstChild.childNodes).forEach(node => { if (node.value === 'B' || node.value === 'C') { expect(node.selected).to.equal(true); } }); expect(scratch.firstChild.value).to.equal('B'); }); });