Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 6, 2021
1 parent 8dacf85 commit 61c0bae
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component({ increment }) {
return () => <Counter onClick={value => value + increment} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
[
"transform-react-constant-elements",
{ "allowMutablePropsOnTags": ["Counter"] }
],
"syntax-jsx"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Component({
increment
}) {
return () => <Counter onClick={value => value + increment} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter onClick={value => value + prompt("Increment:")} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
[
"transform-react-constant-elements",
{ "allowMutablePropsOnTags": ["Counter"] }
],
"syntax-jsx"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter onClick={value => value + prompt("Increment:")} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component({ value }) {
return () => <Counter onClick={value => value + 1} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
[
"transform-react-constant-elements",
{ "allowMutablePropsOnTags": ["Counter"] }
],
"syntax-jsx"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Component({
value
}) {
return () => <Counter onClick={value => value + 1} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter onClick={value => value + 1} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
[
"transform-react-constant-elements",
{ "allowMutablePropsOnTags": ["Counter"] }
],
"syntax-jsx"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter onClick={value => value + 1} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter init={(value => value + prompt("Increment:"))(2)} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": [
[
"transform-react-constant-elements",
{ "allowMutablePropsOnTags": ["Counter"] }
],
"syntax-jsx"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function Component() {
return () => <Counter init={(value => value + prompt("Increment:"))(2)} />;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This is the same as the pure-expression-whitelist test, but 'FormattedMessage' is *not* whitelisted
// so it should not be hoisted.
// This is the same as the basic test, but 'FormattedMessage' is *not* one of the
// allowed tags so it should not be hoisted.
var Foo = React.createClass({
render: function () {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This is the same as the pure-expression-whitelist test, but 'FormattedMessage' is *not* whitelisted
// so it should not be hoisted.
// This is the same as the basic test, but 'FormattedMessage' is *not* one of the
// allowed tags so it should not be hoisted.
var Foo = React.createClass({
render: function () {
return <FormattedMessage id="someMessage.foo" defaultMessage={"Some text, " + "and some more too. {someValue}"} description="A test message for babel." values={{
Expand Down

0 comments on commit 61c0bae

Please sign in to comment.