在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ 測試工具集
顯示數(shù)據(jù)
組件的引用
Controlled Input 值為 null 的情況
Reconciliation
子 props 的類型
組件的詳細(xì)說明和生命周期
傳遞 Props
特殊的非 DOM 屬性
組件 API
PureRenderMixin
雙向綁定輔助工具
瀏覽器中的工作原理
深入 JSX
表單組件
Dangerously Set innerHTML
入門
JSX 中的 If-Else
克隆組件
教程
更多的關(guān)于Refs
JSX 的 false 處理
高級性能
Mounting 后 componentWillReceiveProps 未被觸發(fā)
簡介
測試工具集
JSX 陷阱
工具集成(ToolingIntegration)
公開組件功能
通過 AJAX 加載初始數(shù)據(jù)
事件系統(tǒng)
可復(fù)用組件
this.props.children undefined
不可變數(shù)據(jù)的輔助工具(Immutability Helpers)
動(dòng)態(tài)交互式用戶界面
組件的 DOM 事件監(jiān)聽
復(fù)合組件
動(dòng)畫
插件
JSX 展開屬性
行內(nèi)樣式
性能分析工具
類名操作
與其他類庫并行使用 React
鍵控的片段
標(biāo)簽和屬性支持
組件間的通信
React (虛擬)DOM 術(shù)語
JSX 根節(jié)點(diǎn)的最大數(shù)量
在樣式props中快速制定像素值
頂層 API
深入理解 React
自閉合標(biāo)簽
為什么使用 React?
getInitialState 里的 Props 是一個(gè)反模式
與 DOM 的差異

測試工具集

React.addons.TestUtils使得在你選擇的測試框架中測試React組件變得簡單(我們使用Jest)。

模擬

Simulate.{eventName}(DOMElement element, object eventData)

模擬事件在DOM節(jié)點(diǎn)上派發(fā),附帶可選的eventData事件數(shù)據(jù)。這可能是在ReactTestUtils中最有用的工具。

使用示例:

var node = this.refs.input.getDOMNode();
React.addons.TestUtils.Simulate.click(node);
React.addons.TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});

Simulate有一個(gè)方法適用于每個(gè)事件,這些事件都是React能識別的。

renderIntoDocument

ReactComponent renderIntoDocument(ReactComponent instance)

把一個(gè)組件渲染成一個(gè)在文檔中分離的DOM節(jié)點(diǎn)。這個(gè)函數(shù)需要DOM。

mockComponent

object mockComponent(function componentClass, string? mockTagName)

傳遞一個(gè)虛擬的組件模塊給這個(gè)方法,給這個(gè)組件擴(kuò)充一些有用的方法,讓組件能夠被當(dāng)成一個(gè)React組件的仿制品來使用。這個(gè)組件將會變成一個(gè)簡單的<div>(或者是其它標(biāo)簽,如果mockTagName提供了的話),包含任何提供的子節(jié)點(diǎn),而不是像往常一樣渲染出來。

isElementOfType

boolean isElementOfType(ReactElement element, function componentClass)

如果element是一個(gè)類型為React componentClass的React元素,則返回true。

isDOMComponent

boolean isDOMComponent(ReactComponent instance)

如果instance是一個(gè)DOM組件(例如<div>或者<span>),則返回true。

isCompositeComponent

boolean isCompositeComponent(ReactComponent instance)`

如果instance是一個(gè)合成的組件(通過React.createClass()創(chuàng)建),則返回true。

isCompositeComponentWithType

boolean isCompositeComponentWithType(ReactComponent instance, function componentClass)

如果instance是一個(gè)合成的組件(通過React.createClass()創(chuàng)建),此組件的類型是React componentClass,則返回true。

findAllInRenderedTree

array findAllInRenderedTree(ReactComponent tree, function test)

遍歷tree中所有組件,搜集test(component)返回true的所有組件。就這個(gè)本身來說不是很有用,但是它可以為其它測試提供原始數(shù)據(jù)。

scryRenderedDOMComponentsWithClass

array scryRenderedDOMComponentsWithClass(ReactComponent tree, string className)

查找組件的所有實(shí)例,這些實(shí)例都在渲染后的樹中,并且是帶有className類名的DOM組件。

findRenderedDOMComponentWithClass

ReactComponent findRenderedDOMComponentWithClass(ReactComponent tree, string className)

類似于scryRenderedDOMComponentsWithClass(),但是它只返回一個(gè)結(jié)果,如果有其它滿足條件的,則會拋出異常。

scryRenderedDOMComponentsWithTag

array scryRenderedDOMComponentsWithTag(ReactComponent tree, string tagName)

在渲染后的樹中找出所有組件實(shí)例,并且是標(biāo)簽名字符合tagName的DOM組件。

findRenderedDOMComponentWithTag

ReactComponent findRenderedDOMComponentWithTag(ReactComponent tree, string tagName)

類似于scryRenderedDOMComponentsWithTag(),但是它只返回一個(gè)結(jié)果,如果有其它滿足條件的,則會拋出異常。

scryRenderedComponentsWithType

array scryRenderedComponentsWithType(ReactComponent tree, function componentClass)

找出所有組件實(shí)例,這些組件的類型為componentClass。

findRenderedComponentWithType

ReactComponent findRenderedComponentWithType(ReactComponent tree, function componentClass)

類似于scryRenderedComponentsWithType(),但是它只返回一個(gè)結(jié)果,如果有其它滿足條件的,則會拋出異常。