mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #5405 from yangshun/inconsistent-error-messages
More consistent error message for findRenderedDOMComponentWithX
This commit is contained in:
@@ -207,8 +207,9 @@ var ReactTestUtils = {
|
||||
var all =
|
||||
ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
|
||||
if (all.length !== 1) {
|
||||
throw new Error('Did not find exactly one match ' +
|
||||
'(found: ' + all.length + ') for class:' + className
|
||||
throw new Error(
|
||||
'Did not find exactly one match (found: ' + all.length + ') ' +
|
||||
'for class:' + className
|
||||
);
|
||||
}
|
||||
return all[0];
|
||||
@@ -236,8 +237,9 @@ var ReactTestUtils = {
|
||||
findRenderedDOMComponentWithTag: function(root, tagName) {
|
||||
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
|
||||
if (all.length !== 1) {
|
||||
throw new Error('Did not find exactly one match ' +
|
||||
'(found ' + all.length + ') for tag:' + tagName
|
||||
throw new Error(
|
||||
'Did not find exactly one match (found: ' + all.length + ') ' +
|
||||
'for tag:' + tagName
|
||||
);
|
||||
}
|
||||
return all[0];
|
||||
@@ -270,8 +272,8 @@ var ReactTestUtils = {
|
||||
);
|
||||
if (all.length !== 1) {
|
||||
throw new Error(
|
||||
'Did not find exactly one match for componentType:' + componentType +
|
||||
' (found ' + all.length + ')'
|
||||
'Did not find exactly one match (found: ' + all.length + ') ' +
|
||||
'for componentType:' + componentType
|
||||
);
|
||||
}
|
||||
return all[0];
|
||||
|
||||
Reference in New Issue
Block a user