Skip to content

Commit

Permalink
add babel-plugin-transform-class-properties to class-properties babel…
Browse files Browse the repository at this point in the history
… 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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"plugins": [
"../../../../../src/babel",
"transform-class-properties",
"syntax-async-functions",
"syntax-class-properties",
"../../../../../src/babel"
]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"plugins": [
"../../../../../src/babel",
"transform-class-properties",
"syntax-async-functions",
"syntax-class-properties",
"../../../../../src/babel"
]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
class Foo {
bar = 2;
constructor() {
this.bar = 2;
}

}
;

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

}
;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"plugins": ["syntax-class-properties", "../../../../../src/babel"]
"plugins": ["../../../../../src/babel", "transform-class-properties"]
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.