1
私は四つの成分とのラッパを持っているので、私はconsole.log(wrapper.find(LabeledInput).debug());
を行うとき、これが記録されます。Enzymeを使用してPhantomJSの2番目の要素を取得するには?
<LabeledInput label="Tenant ID" placeholder="Add a tenant" value="infor" onEnter={[Function]} updateValue={[Function]} />
<LabeledInput label="Store ID" placeholder="Add a store" value="12345" onEnter={[Function]} updateValue={[Function]} />
<LabeledInput label="Server" placeholder="Add account endpoint" value="test" onEnter={[Function]} updateValue={[Function]} />
<LabeledInput label="test Link" placeholder="Add OCH link" value="http://www.test.com/" onEnter={[Function]} updateValue={[Function]} />
は、どのように私は上記のログから三番目の要素を取得することができますか?私はconsole.log(wrapper.find(LabeledInput).childAt(2));
を試しましたが、失敗しました。Error: Method “childAt” is only meant to be run on a single node. 4 found instead.
私はEnzyme's Shallow Rendering APIを使用しています。