-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update React examples to match with the new React guidelines (#…
- Loading branch information
Showing
20 changed files
with
97 additions
and
88 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
- `[*]` [**BREAKING**] Drop support for Node v10 and v15 and target first LTS `16.13.0` ([#12220](https://github.com/facebook/jest/pull/12220)) | ||
- `[*]` [**BREAKING**] Drop support for `[email protected]`, minimum version is now `4.2` ([#11142](https://github.com/facebook/jest/pull/11142)) | ||
- `[*]` Bundle all `.d.ts` files into a single `index.d.ts` per module ([#12345](https://github.com/facebook/jest/pull/12345)) | ||
- `[docs, examples]` Update React examples to match with the new React guidelines for code examples ([#12217](https://github.com/facebook/jest/pull/12217)) | ||
- `[expect]` [**BREAKING**] Remove support for importing `build/utils` ([#12323](https://github.com/facebook/jest/pull/12323)) | ||
- `[expect]` [**BREAKING**] Migrate to ESM ([#12344](https://github.com/facebook/jest/pull/12344)) | ||
- `[jest-cli]` Update `yargs` to v17 ([#12357](https://github.com/facebook/jest/pull/12357)) | ||
|
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
|
||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
plugins: ['@babel/plugin-proposal-class-properties'] | ||
presets: [ | ||
'@babel/preset-env', | ||
['@babel/preset-react', {runtime: 'automatic'}], | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,26 +1,28 @@ | ||
// Copyright 2004-present Facebook. All Rights Reserved. | ||
|
||
import React from 'react'; | ||
import {useState} from 'react'; | ||
|
||
export default class CheckboxWithLabel extends React.Component { | ||
state = { | ||
isChecked: false, | ||
}; | ||
export default function CheckboxWithLabel({ | ||
labelRef, | ||
inputRef, | ||
labelOn, | ||
labelOff, | ||
}) { | ||
const [isChecked, setIsChecked] = useState(false); | ||
|
||
onChange = () => { | ||
this.setState({isChecked: !this.state.isChecked}); | ||
const onChange = () => { | ||
setIsChecked(!isChecked); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<label> | ||
<input | ||
type="checkbox" | ||
checked={this.state.isChecked} | ||
onChange={this.onChange} | ||
/> | ||
{this.state.isChecked ? this.props.labelOn : this.props.labelOff} | ||
</label> | ||
); | ||
} | ||
return ( | ||
<label ref={labelRef}> | ||
<input | ||
ref={inputRef} | ||
type="checkbox" | ||
checked={isChecked} | ||
onChange={onChange} | ||
/> | ||
{isChecked ? labelOn : labelOff} | ||
</label> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
|
||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
plugins: ['@babel/plugin-proposal-class-properties'], | ||
presets: [ | ||
'@babel/preset-env', | ||
['@babel/preset-react', {runtime: 'automatic'}], | ||
], | ||
}; |
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
1 change: 0 additions & 1 deletion
1
examples/react-testing-library/__tests__/CheckboxWithLabel-test.js
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
|
||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
presets: [ | ||
'@babel/preset-env', | ||
['@babel/preset-react', {runtime: 'automatic'}], | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
|
||
module.exports = { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
plugins: ['@babel/plugin-proposal-class-properties'], | ||
presets: [ | ||
'@babel/preset-env', | ||
['@babel/preset-react', {runtime: 'automatic'}], | ||
], | ||
}; |
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
Oops, something went wrong.