Skip to content

Commit

Permalink
Added a few more test cases to the inline error test harness
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Dec 16, 2020
1 parent a4f0059 commit 5719f31
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/react-devtools-shell/src/app/InlineWarnings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,30 @@ function ErrorWithMultipleArgs({children = null}) {
}

function ErrorWithStringSubstitutions({children = null}) {
console.error('This error uses %s substitutions', 'string');
console.error('This error uses "%s" substitutions', 'string');
return children;
}

function ReactErrorOnHostComponent({children = null}) {
return <div data-camelCasedAttribute="should-lower-case">{children}</div>;
}

function DuplicateWarningsAndErrors({children = null}) {
console.warn('this warning is logged twice per render');
console.warn('this warning is logged twice per render');
console.error('this error is logged twice per render');
console.error('this error is logged twice per render');
return <div data-camelCasedAttribute="should-lower-case">{children}</div>;
}

function MultipleWarningsAndErrors({children = null}) {
console.warn('this is the first warning logged');
console.warn('this is the second warning logged');
console.error('this is the first error logged');
console.error('this is the second error logged');
return <div data-camelCasedAttribute="should-lower-case">{children}</div>;
}

export default function ErrorsAndWarnings() {
const [count, setCount] = useState(0);
const handleClick = () => setCount(count + 1);
Expand All @@ -153,6 +169,8 @@ export default function ErrorsAndWarnings() {
<ErrorWithStringSubstitutions />
<ReactErrorOnHostComponent />
<ReallyLongErrorMessageThatWillCauseTextToBeTruncated />
<DuplicateWarningsAndErrors />
<MultipleWarningsAndErrors />
</Fragment>
);
}

0 comments on commit 5719f31

Please sign in to comment.