From f7a4121cd09c04d88860d9ae4a2067d4bd3ec5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=A0=E7=BC=AA?= Date: Fri, 20 Mar 2015 17:31:27 +0800 Subject: [PATCH] add test --- tests/Select.spec.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/Select.spec.js b/tests/Select.spec.js index a8def07ed..95ab4508f 100644 --- a/tests/Select.spec.js +++ b/tests/Select.spec.js @@ -119,6 +119,47 @@ describe('Select', function () { done(); }, 100); }); + + }); + + describe('when use option tags', function () { + var div; + + this.timeout(400000); + + beforeEach(function () { + div = document.createElement('div'); + div.tabIndex = 0; + document.body.appendChild(div); + instance = React.render( + , + div); + }); + + afterEach(function () { + React.unmountComponentAtNode(div); + }); + + it('should allow user input as tags', function (done) { + if (navigator.userAgent.indexOf(' Chrome') === -1) { + done(); + return; + } + + var node = React.findDOMNode(instance.refs.input); + React.addons.TestUtils.Simulate.keyDown( node, {key:"A"} ) + + setTimeout(function () { + React.addons.TestUtils.Simulate.keyDown( node, {key:"Enter"} ) + setTimeout(function () { + expect(instance.state.value).to.contain("A"); + }, 100); + done(); + }, 100); + }); }); });