forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test state of
react-linked-input
and create-fragment
before fix
**what is the change?:** Setting up the fixtures to enable manual testing of the `react-linked-input` and `create-fragment` UMD builds. This was a painstaking and frustrating process and we need something better before making any more fixes to addons. Here is roughly what I did; - add 'console.log' statements to the add-on to confirm that you've loaded the right build case - copy the add-on into 'build/packages' so that the 'webpack-alias' can find it. - make copies of each of the following three fixtures for each add-on you want to test, renaming them to specify what you are testing: - globals.js - requirejs.js - webpack-alias/* - modify those fixtures to use the add-on you intend to text **why make this change?:** We need to verify the current state of the bug before fixing it, to confirm that the change actually is fixing the bug. **test plan:** `open fixtures/globals-with-create-react-fragment.html` `open fixtures/globals-with-react-linked-input.html` `open fixtures/requirejswith-create-react-fragment.html` `open fixtures/requirejswith-react-linked-input.html` `cd fixtures/webpack-aliaswith-create-react-fragment/ && yarn build && open index.html` `cd fixtures/webpack-aliaswith-react-linked-input/ && yarn build && open index.html` **issue:** facebook#9765
- Loading branch information
Showing
18 changed files
with
3,082 additions
and
2 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
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,57 @@ | ||
<html> | ||
<body> | ||
<script src="../build/react-with-addons.js"></script> | ||
<script src="../build/react-dom.js"></script> | ||
<script src="../addons/react-addons-create-fragment/react-addons-create-fragment.js"></script> | ||
<style> | ||
.example-appear { | ||
opacity: 0.01; | ||
} | ||
.example-appear.example-appear-active { | ||
opacity: 1; | ||
transition: opacity .5s ease-in; | ||
} | ||
</style> | ||
<div id="container"></div> | ||
<script> | ||
var createFragment = React.addons.createFragment; | ||
var CSSTransitionGroup = React.addons.CSSTransitionGroup; | ||
function Swapper(props) { | ||
let children; | ||
if (props.swapped) { | ||
children = createFragment({ | ||
right: props.rightChildren, | ||
left: props.leftChildren | ||
}); | ||
} else { | ||
children = createFragment({ | ||
left: props.leftChildren, | ||
right: props.rightChildren | ||
}); | ||
} | ||
return React.createElement('div', null, children); | ||
} | ||
ReactDOM.render( | ||
React.createElement( | ||
CSSTransitionGroup, | ||
{ | ||
transitionName: 'example', | ||
transitionAppear: true, | ||
transitionAppearTimeout: 500, | ||
transitionEnterTimeout: 0, | ||
transitionLeaveTimeout: 0, | ||
}, | ||
React.createElement( | ||
Swapper, | ||
{ | ||
swapped: true, | ||
leftChildren: 'Hello!', | ||
rightChildren: 'FOO!!!', | ||
}, | ||
), | ||
), | ||
document.getElementById('container') | ||
); | ||
</script> | ||
</body> | ||
</html> |
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,51 @@ | ||
<html> | ||
<body> | ||
<script src="../build/react-with-addons.js"></script> | ||
<script src="../build/react-dom.js"></script> | ||
<script src="../addons/create-react-class/create-react-class.js"></script> | ||
<script src="https://unpkg.com/react-addons-linked-state-mixin/react-addons-linked-state-mixin.js"></script> | ||
<script src="../addons/react-linked-input/react-linked-input.js"></script> | ||
<style> | ||
.example-appear { | ||
opacity: 0.01; | ||
} | ||
.example-appear.example-appear-active { | ||
opacity: 1; | ||
transition: opacity .5s ease-in; | ||
} | ||
</style> | ||
<div id="container"></div> | ||
<script> | ||
var CSSTransitionGroup = React.addons.CSSTransitionGroup; | ||
var LinkedStateMixin = React.addons.LinkedStateMixin; | ||
var WithLink = createReactClass({ | ||
mixins: [LinkedStateMixin], | ||
getInitialState: function() { | ||
return {message: 'Hello!'}; | ||
}, | ||
render: function() { | ||
return React.createElement( | ||
LinkedInput, | ||
{type: 'text', valueLink: this.linkState('message')}, | ||
); | ||
} | ||
}); | ||
ReactDOM.render( | ||
React.createElement( | ||
CSSTransitionGroup, | ||
{ | ||
transitionName: 'example', | ||
transitionAppear: true, | ||
transitionAppearTimeout: 500, | ||
transitionEnterTimeout: 0, | ||
transitionLeaveTimeout: 0, | ||
}, | ||
React.createElement( | ||
WithLink, | ||
), | ||
), | ||
document.getElementById('container') | ||
); | ||
</script> | ||
</body> | ||
</html> |
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,72 @@ | ||
<html> | ||
<body> | ||
<script src="https://unpkg.com/requirejs@2.3.2/require.js"></script> | ||
<style> | ||
.example-appear { | ||
opacity: 0.01; | ||
} | ||
|
||
.example-appear.example-appear-active { | ||
opacity: 1; | ||
transition: opacity .5s ease-in; | ||
} | ||
</style> | ||
<div id="container"></div> | ||
<script> | ||
requirejs.config({ | ||
paths: { | ||
react: '../build/react-with-addons', | ||
'react-dom': '../build/react-dom', | ||
'create-react-fragment': | ||
'../addons/react-addons-create-fragment/react-addons-create-fragment' | ||
} | ||
}); | ||
|
||
require( | ||
['react', 'react-dom', 'create-react-fragment'], | ||
function( | ||
React, | ||
ReactDOM, | ||
createReactFragment | ||
) { | ||
var CSSTransitionGroup = React.addons.CSSTransitionGroup; | ||
function Swapper(props) { | ||
let children; | ||
if (props.swapped) { | ||
children = createReactFragment({ | ||
right: props.rightChildren, | ||
left: props.leftChildren | ||
}); | ||
} else { | ||
children = createReactFragment({ | ||
left: props.leftChildren, | ||
right: props.rightChildren | ||
}); | ||
} | ||
return React.createElement('div', null, children); | ||
} | ||
ReactDOM.render( | ||
React.createElement( | ||
CSSTransitionGroup, | ||
{ | ||
transitionName: 'example', | ||
transitionAppear: true, | ||
transitionAppearTimeout: 500, | ||
transitionEnterTimeout: 0, | ||
transitionLeaveTimeout: 0, | ||
}, | ||
React.createElement( | ||
Swapper, | ||
{ | ||
swapped: true, | ||
leftChildren: 'Hello!', | ||
rightChildren: 'FOO!!!', | ||
}, | ||
), | ||
), | ||
document.getElementById('container') | ||
); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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,69 @@ | ||
<html> | ||
<body> | ||
<script src="https://unpkg.com/requirejs@2.3.2/require.js"></script> | ||
<style> | ||
.example-appear { | ||
opacity: 0.01; | ||
} | ||
|
||
.example-appear.example-appear-active { | ||
opacity: 1; | ||
transition: opacity .5s ease-in; | ||
} | ||
</style> | ||
<div id="container"></div> | ||
<script> | ||
requirejs.config({ | ||
paths: { | ||
react: '../build/react-with-addons', | ||
'react-dom': '../build/react-dom', | ||
'create-react-class': | ||
'../addons/create-react-class/create-react-class', | ||
'linked-state-mixin': | ||
'../addons/react-addons-linked-state-mixin/react-addons-linked-state-mixin', | ||
'linked-input': | ||
'../addons/react-linked-input/react-linked-input', | ||
} | ||
}); | ||
|
||
require( | ||
['react', 'react-dom', 'create-react-class', 'linked-state-mixin', | ||
'linked-input'], | ||
function( | ||
React, | ||
ReactDOM, | ||
createReactClass, | ||
LinkedStateMixin, | ||
LinkedInput, | ||
) { | ||
var CSSTransitionGroup = React.addons.CSSTransitionGroup; | ||
var WithLink = createReactClass({ | ||
mixins: [LinkedStateMixin], | ||
getInitialState: function() { | ||
return {message: 'Hello!'}; | ||
}, | ||
render: function() { | ||
return React.createElement( | ||
LinkedInput, | ||
{type: 'text', valueLink: this.linkState('message')}, | ||
); | ||
} | ||
}); | ||
ReactDOM.render( | ||
React.createElement( | ||
CSSTransitionGroup, | ||
{ | ||
transitionName: 'example', | ||
transitionAppear: true, | ||
transitionAppearTimeout: 500, | ||
transitionEnterTimeout: 0, | ||
transitionLeaveTimeout: 0, | ||
}, | ||
React.createElement(WithLink), | ||
), | ||
document.getElementById('container') | ||
); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
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 @@ | ||
output.js |
15 changes: 15 additions & 0 deletions
15
fixtures/webpack-aliaswith-create-react-fragment/config.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
entry: './input', | ||
output: { | ||
filename: 'output.js', | ||
}, | ||
resolve: { | ||
root: '../../build/packages', | ||
alias: { | ||
'react': 'react/dist/react-with-addons', | ||
'react-dom': 'react-dom/dist/react-dom', | ||
'create-react-fragment': | ||
'react-addons-create-fragment/react-addons-create-fragment' | ||
}, | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
fixtures/webpack-aliaswith-create-react-fragment/index.html
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,16 @@ | ||
<html> | ||
<body> | ||
<style> | ||
.example-appear { | ||
opacity: 0.01; | ||
} | ||
|
||
.example-appear.example-appear-active { | ||
opacity: 1; | ||
transition: opacity .5s ease-in; | ||
} | ||
</style> | ||
<div id="container"></div> | ||
<script src="output.js"></script> | ||
</body> | ||
</html> |
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,41 @@ | ||
var React = require('react'); | ||
var ReactDOM = require('react-dom'); | ||
var createReactFragment = require('create-react-fragment'); | ||
function Swapper(props) { | ||
let children; | ||
if (props.swapped) { | ||
children = createReactFragment({ | ||
right: props.rightChildren, | ||
left: props.leftChildren | ||
}); | ||
} else { | ||
children = createReactFragment({ | ||
left: props.leftChildren, | ||
right: props.rightChildren | ||
}); | ||
} | ||
return React.createElement('div', null, children); | ||
} | ||
|
||
var CSSTransitionGroup = React.addons.CSSTransitionGroup; | ||
ReactDOM.render( | ||
React.createElement( | ||
CSSTransitionGroup, | ||
{ | ||
transitionName: 'example', | ||
transitionAppear: true, | ||
transitionAppearTimeout: 500, | ||
transitionEnterTimeout: 0, | ||
transitionLeaveTimeout: 0 | ||
}, | ||
React.createElement( | ||
Swapper, | ||
{ | ||
swapped: true, | ||
leftChildren: 'Hello!', | ||
rightChildren: 'FOO!!!', | ||
} | ||
) | ||
), | ||
document.getElementById('container') | ||
); |
10 changes: 10 additions & 0 deletions
10
fixtures/webpack-aliaswith-create-react-fragment/package.json
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,10 @@ | ||
{ | ||
"name": "webpack-test", | ||
"private": true, | ||
"dependencies": { | ||
"webpack": "^1.14.0" | ||
}, | ||
"scripts": { | ||
"build": "rm -f output.js && webpack --config config.js" | ||
} | ||
} |
Oops, something went wrong.