-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Modes in the component stack (#13240)
* Add a test that StrictMode shows up in the component stack The SSR test passes. The client one doesn't. * Include Modes in component stack * Update other tests to include modes
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
*/ | ||
|
||
'use strict'; | ||
|
||
let React; | ||
let ReactDOM; | ||
let ReactDOMServer; | ||
|
||
describe('ReactStrictMode', () => { | ||
beforeEach(() => { | ||
jest.resetModules(); | ||
React = require('react'); | ||
ReactDOM = require('react-dom'); | ||
ReactDOMServer = require('react-dom/server'); | ||
}); | ||
|
||
it('should appear in the client component stack', () => { | ||
function Foo() { | ||
return <div ariaTypo="" />; | ||
} | ||
|
||
const container = document.createElement('div'); | ||
expect(() => { | ||
ReactDOM.render( | ||
<React.StrictMode> | ||
<Foo /> | ||
</React.StrictMode>, | ||
container, | ||
); | ||
}).toWarnDev( | ||
'Invalid ARIA attribute `ariaTypo`. ' + | ||
'ARIA attributes follow the pattern aria-* and must be lowercase.\n' + | ||
' in div (at **)\n' + | ||
' in Foo (at **)\n' + | ||
' in StrictMode (at **)', | ||
); | ||
}); | ||
|
||
it('should appear in the SSR component stack', () => { | ||
function Foo() { | ||
return <div ariaTypo="" />; | ||
} | ||
|
||
expect(() => { | ||
ReactDOMServer.renderToString( | ||
<React.StrictMode> | ||
<Foo /> | ||
</React.StrictMode>, | ||
); | ||
}).toWarnDev( | ||
'Invalid ARIA attribute `ariaTypo`. ' + | ||
'ARIA attributes follow the pattern aria-* and must be lowercase.\n' + | ||
' in div (at **)\n' + | ||
' in Foo (at **)\n' + | ||
' in StrictMode (at **)', | ||
); | ||
}); | ||
}); |