Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add babel-plugin-transform-class-properties to class-properties babel…
… fixtures

- using only babel-plugin-syntax-class-properties produces invalid output
  • Loading branch information
nfcampos authored and calesce committed Oct 9, 2016
1 parent 4e91299 commit 8fab49e
Show file tree
Hide file tree
Showing 28 changed files with 83 additions and 66 deletions.
2 changes: 1 addition & 1 deletion test/babel/fixtures/class-properties/arguments/.babelrc
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
12 changes: 7 additions & 5 deletions test/babel/fixtures/class-properties/arguments/expected.js
@@ -1,10 +1,12 @@
var _arguments = arguments;
class Foo {
bar = (a, b) => {
_arguments;
constructor() {
this.bar = (a, b) => {
arguments;

return a(b);
};
}

return a(b);
};
}
;

Expand Down
@@ -1,7 +1,7 @@
{
"plugins": [
"../../../../../src/babel",
"transform-class-properties",
"syntax-async-functions",
"syntax-class-properties",
"../../../../../src/babel"
]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = async (...params) => await _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = async (...params) => await this.__bar__REACT_HOT_LOADER__(...params);
}

async __bar__REACT_HOT_LOADER__(a, b) {
return await b(a);
Expand Down
4 changes: 2 additions & 2 deletions test/babel/fixtures/class-properties/async-functions/.babelrc
@@ -1,7 +1,7 @@
{
"plugins": [
"../../../../../src/babel",
"transform-class-properties",
"syntax-async-functions",
"syntax-class-properties",
"../../../../../src/babel"
]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = async (...params) => await _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = async (...params) => await this.__bar__REACT_HOT_LOADER__(...params);
}

async __bar__REACT_HOT_LOADER__(a, b) {
return await a(b);
Expand Down
2 changes: 1 addition & 1 deletion test/babel/fixtures/class-properties/block-body/.babelrc
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
6 changes: 3 additions & 3 deletions test/babel/fixtures/class-properties/block-body/expected.js
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = (...params) => _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = (...params) => this.__bar__REACT_HOT_LOADER__(...params);
}

__bar__REACT_HOT_LOADER__(a, b) {
return a(b);
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = (...params) => _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = (...params) => this.__bar__REACT_HOT_LOADER__(...params);
}

__bar__REACT_HOT_LOADER__(a = "foo") {
return `${ a }bar`;
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = (...params) => _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = (...params) => this.__bar__REACT_HOT_LOADER__(...params);
}

__bar__REACT_HOT_LOADER__({ a }, { b }) {
return `${ a }${ b }`;
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
onClick = (...params) => _this.__onClick__REACT_HOT_LOADER__(...params);
constructor() {
this.onClick = (...params) => this.__onClick__REACT_HOT_LOADER__(...params);
}

__onClick__REACT_HOT_LOADER__(e) {
return e.target.value;
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,12 +1,14 @@
var _arguments = arguments;
class Foo {
bar = (a, b) => {
() => {
_arguments;
constructor() {
this.bar = (a, b) => {
() => {
arguments;
};

return a(b);
};
}

return a(b);
};
}
;

Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,11 +1,14 @@
class Foo {
bar = (a, b) => {
() => {
new.target;
constructor() {
this.bar = (a, b) => {
() => {
new.target;
};

return a(b);
};
}

return a(b);
};
}
;

Expand Down
2 changes: 1 addition & 1 deletion test/babel/fixtures/class-properties/new.target/.babelrc
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
11 changes: 7 additions & 4 deletions test/babel/fixtures/class-properties/new.target/expected.js
@@ -1,9 +1,12 @@
class Foo {
bar = (a, b) => {
new.target;
constructor() {
this.bar = (a, b) => {
new.target;

return a(b);
};
}

return a(b);
};
}
;

Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,5 +1,8 @@
class Foo {
bar = 2;
constructor() {
this.bar = 2;
}

}
;

Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,7 +1,10 @@
class Foo {
bar = function (a, b) {
return a(b);
};
constructor() {
this.bar = function (a, b) {
return a(b);
};
}

}
;

Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
@@ -1,7 +1,7 @@
var _this = this;

class Foo {
bar = (...params) => _this.__bar__REACT_HOT_LOADER__(...params);
constructor() {
this.bar = (...params) => this.__bar__REACT_HOT_LOADER__(...params);
}

__bar__REACT_HOT_LOADER__(a, b) {
return a(b);
Expand Down
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
11 changes: 6 additions & 5 deletions test/babel/fixtures/class-properties/static-property/expected.js
@@ -1,8 +1,9 @@
class Foo {
static bar = (a, b) => {
return a(b);
};
}
class Foo {}

Foo.bar = (a, b) => {
return a(b);
};

;

var _temp = function () {
Expand Down

0 comments on commit 8fab49e

Please sign in to comment.