Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve e2e-kitchensink and Jest coverage #1484

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/react-scripts/fixtures/kitchensink/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ class BuiltEmitter extends React.Component {
componentDidMount() {
const { feature } = this.props
if (!Component.isPrototypeOf(feature)) {
this.notifyRendered();
this.handleReady();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment here.

// Class components must call this.props.onReady when they're ready for the test.
// We will assume functional components are ready immediately after mounting.

}
}

notifyRendered() {
handleReady() {
document.dispatchEvent(new Event('ReactFeatureDidMount'));
}

render() {
const {
props: { feature },
notifyRendered
handleReady
} = this;
return (
<div>
{createElement(feature, {
notifyRendered
onReady: handleReady
})}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import load from 'absoluteLoad'

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -17,7 +17,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('NODE_PATH', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<NodePath notifyRendered={resolve} />, div);
ReactDOM.render(<NodePath onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('array destructuring', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ArrayDestructuring notifyRendered={resolve} />, div);
ReactDOM.render(<ArrayDestructuring onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load(users) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('array spread', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ArraySpread notifyRendered={resolve} />, div);
ReactDOM.render(<ArraySpread onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('async/await', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<AsyncAwait notifyRendered={resolve} />, div);
ReactDOM.render(<AsyncAwait onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component, PropTypes } from 'react'

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

users = [
Expand All @@ -13,7 +13,7 @@ export default class extends Component {
];

componentDidMount() {
this.props.notifyRendered()
this.props.onReady()
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('class properties', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ClassProperties notifyRendered={resolve} />, div);
ReactDOM.render(<ClassProperties onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load(prefix) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('computed properties', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ComputedProperties notifyRendered={resolve} />, div);
ReactDOM.render(<ComputedProperties onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -30,7 +30,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('custom interpolation', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<CustomInterpolation notifyRendered={resolve} />, div);
ReactDOM.render(<CustomInterpolation onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load(id = 0) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('default parameters', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<DefaultParameters notifyRendered={resolve} />, div);
ReactDOM.render(<DefaultParameters onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('destructuring and await', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<DestructuringAndAwait notifyRendered={resolve} />, div);
ReactDOM.render(<DestructuringAndAwait onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function * load(limit) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -27,7 +27,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('generators', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<Generators notifyRendered={resolve} />, div);
ReactDOM.render(<Generators onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('object destructuring', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ObjectDestructuring notifyRendered={resolve} />, div);
ReactDOM.render(<ObjectDestructuring onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load(baseUser) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('object spread', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<ObjectSpread notifyRendered={resolve} />, div);
ReactDOM.render(<ObjectSpread onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load() {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -26,7 +26,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('promises', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
return new Promise(resolve => {
ReactDOM.render(<Promises notifyRendered={resolve} />, div);
ReactDOM.render(<Promises onReady={resolve} />, div);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function load({ id, ...rest } = { id: 0, user: { id: 42, name: '42' } }) {

export default class extends Component {
static propTypes = {
notifyRendered: PropTypes.func.isRequired
onReady: PropTypes.func.isRequired
}

constructor(props) {
Expand All @@ -25,7 +25,7 @@ export default class extends Component {
}

componentDidUpdate() {
this.props.notifyRendered();
this.props.onReady();
}

render() {
Expand Down
Loading