0
假設我有以下場景進行測試。反應測試組件卸載
觸發關閉按鈕後,我想測試組件是否卸載。所以,我有:如果組件渲染到DOM,否則爲false
component = ReactUtils.renderIntoDocument(....);
closeButton = ReactUtils.findRenderedDOMComponentWithClass(component, 'Close-Button');
ReactUtils.Simulate.click(closeButton);
//Assert if component is mounted?
是的,但我沒有isMounted()方法 component = ReactUtils.renderIntoDocument(....); – user3642381