From 5bad458b094db5224d38d503b112b03d8bea8df7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 5 Dec 2014 23:05:20 +1100 Subject: [PATCH] Fix tests --- .../transformation/errors/syntax/actual.js | 2 +- .../transformation/errors/syntax/options.json | 2 +- .../accessing-super-class/expected.js | 35 ++++++------------- .../calling-super-properties/expected.js | 16 ++------- .../es6-classes/instance-method/expected.js | 16 ++------- .../es6-classes/statement/expected.js | 16 ++------- .../es6-classes/static/expected.js | 6 ++-- .../method/actual.js | 2 +- .../method/expected.js | 1 + .../exports-default/expected.js | 2 ++ .../exports-default/expected.js | 2 ++ .../exports-default/expected.js | 2 ++ .../exports-default/expected.js | 2 ++ 13 files changed, 34 insertions(+), 70 deletions(-) diff --git a/test/fixtures/transformation/errors/syntax/actual.js b/test/fixtures/transformation/errors/syntax/actual.js index 36651f967c..1ef7cb5d40 100644 --- a/test/fixtures/transformation/errors/syntax/actual.js +++ b/test/fixtures/transformation/errors/syntax/actual.js @@ -1,3 +1,3 @@ arr.map(function () { - return $@!@#; + return $#!; }); diff --git a/test/fixtures/transformation/errors/syntax/options.json b/test/fixtures/transformation/errors/syntax/options.json index ff732a8c5d..72ad0f0daf 100644 --- a/test/fixtures/transformation/errors/syntax/options.json +++ b/test/fixtures/transformation/errors/syntax/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected character '@'" + "throws": "Unexpected character '#'" } diff --git a/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js b/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js index d49fffb74e..0c54fbc4e6 100644 --- a/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js +++ b/test/fixtures/transformation/es6-classes/accessing-super-class/expected.js @@ -1,11 +1,6 @@ "use strict"; var _slice = Array.prototype.slice; -var _classProps = function (child, staticProps, instanceProps) { - if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); -}; - var _extends = function (child, parent) { child.prototype = Object.create(parent.prototype, { constructor: { @@ -34,25 +29,17 @@ var Test = (function (Foo) { _extends(Test, Foo); - _classProps(Test, { - foo: { - writable: true, - value: function () { - Foo.foo.call(this); - Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments))); - Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments))); - } - } - }, { - test: { - writable: true, - value: function () { - Foo.prototype.test.call(this); - Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(_slice.call(arguments))); - Foo.prototype.test.call.apply(Foo.prototype.test, [this, "test"].concat(_slice.call(arguments))); - } - } - }); + Test.prototype.test = function () { + Foo.prototype.test.call(this); + Foo.prototype.test.call.apply(Foo.prototype.test, [this].concat(_slice.call(arguments))); + Foo.prototype.test.call.apply(Foo.prototype.test, [this, "test"].concat(_slice.call(arguments))); + }; + + Test.foo = function () { + Foo.foo.call(this); + Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments))); + Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments))); + }; return Test; })(Foo); diff --git a/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js b/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js index 9cf6de3d54..28aa2cb0ea 100644 --- a/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js +++ b/test/fixtures/transformation/es6-classes/calling-super-properties/expected.js @@ -1,10 +1,5 @@ "use strict"; -var _classProps = function (child, staticProps, instanceProps) { - if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); -}; - var _extends = function (child, parent) { child.prototype = Object.create(parent.prototype, { constructor: { @@ -25,14 +20,9 @@ var Test = (function (Foo) { _extends(Test, Foo); - _classProps(Test, { - test: { - writable: true, - value: function () { - return Foo.wow.call(this); - } - } - }); + Test.test = function () { + return Foo.wow.call(this); + }; return Test; })(Foo); diff --git a/test/fixtures/transformation/es6-classes/instance-method/expected.js b/test/fixtures/transformation/es6-classes/instance-method/expected.js index 6511e20db4..bedd164fe5 100644 --- a/test/fixtures/transformation/es6-classes/instance-method/expected.js +++ b/test/fixtures/transformation/es6-classes/instance-method/expected.js @@ -1,21 +1,11 @@ "use strict"; -var _classProps = function (child, staticProps, instanceProps) { - if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); -}; - var Test = (function () { var Test = function Test() {}; - _classProps(Test, null, { - test: { - writable: true, - value: function () { - return 5 + 5; - } - } - }); + Test.prototype.test = function () { + return 5 + 5; + }; return Test; })(); diff --git a/test/fixtures/transformation/es6-classes/statement/expected.js b/test/fixtures/transformation/es6-classes/statement/expected.js index 9186ca15be..7b2a8a13d1 100644 --- a/test/fixtures/transformation/es6-classes/statement/expected.js +++ b/test/fixtures/transformation/es6-classes/statement/expected.js @@ -1,10 +1,5 @@ "use strict"; -var _classProps = function (child, staticProps, instanceProps) { - if (staticProps) Object.defineProperties(child, staticProps); - if (instanceProps) Object.defineProperties(child.prototype, instanceProps); -}; - var BaseView = function BaseView() { this.autoRender = true; }; @@ -16,14 +11,9 @@ var BaseView = function () { var BaseView = (function () { var _class2 = function () {}; - _classProps(_class2, null, { - foo: { - writable: true, - value: function () { - this.autoRender = true; - } - } - }); + _class2.prototype.foo = function () { + this.autoRender = true; + }; return _class2; })(); diff --git a/test/fixtures/transformation/es6-classes/static/expected.js b/test/fixtures/transformation/es6-classes/static/expected.js index a50fd266e8..1ef2108334 100644 --- a/test/fixtures/transformation/es6-classes/static/expected.js +++ b/test/fixtures/transformation/es6-classes/static/expected.js @@ -8,11 +8,9 @@ var _classProps = function (child, staticProps, instanceProps) { var A = (function () { var A = function A() {}; + A.a = function () {}; + _classProps(A, { - a: { - writable: true, - value: function () {} - }, b: { get: function () {}, set: function (b) {} diff --git a/test/fixtures/transformation/es6-computed-property-names/method/actual.js b/test/fixtures/transformation/es6-computed-property-names/method/actual.js index 139554efc3..068edebd55 100644 --- a/test/fixtures/transformation/es6-computed-property-names/method/actual.js +++ b/test/fixtures/transformation/es6-computed-property-names/method/actual.js @@ -1,5 +1,5 @@ var obj = { [foobar]() { - return "foobar"; + return "foobar"; } }; diff --git a/test/fixtures/transformation/es6-computed-property-names/method/expected.js b/test/fixtures/transformation/es6-computed-property-names/method/expected.js index 914ff52608..ce553158fa 100644 --- a/test/fixtures/transformation/es6-computed-property-names/method/expected.js +++ b/test/fixtures/transformation/es6-computed-property-names/method/expected.js @@ -4,5 +4,6 @@ var obj = (function (_obj) { _obj[foobar] = function () { return "foobar"; }; + return _obj; })({}); diff --git a/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js b/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js index 9d46b7b13b..1bd8fd5ca9 100644 --- a/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-amd/exports-default/expected.js @@ -6,7 +6,9 @@ define(["exports"], function (exports) { exports["default"] = []; exports["default"] = foo; exports["default"] = function () {}; + exports["default"] = function () {}; + function foo() {} exports["default"] = foo; var Foo = function Foo() {}; diff --git a/test/fixtures/transformation/es6-modules-common-interop/exports-default/expected.js b/test/fixtures/transformation/es6-modules-common-interop/exports-default/expected.js index a73e640e16..ef8ba56786 100644 --- a/test/fixtures/transformation/es6-modules-common-interop/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-common-interop/exports-default/expected.js @@ -6,7 +6,9 @@ module.exports = {}; module.exports = []; module.exports = foo; module.exports = function () {}; + module.exports = function () {}; + function foo() {} var Foo = function Foo() {}; diff --git a/test/fixtures/transformation/es6-modules-common/exports-default/expected.js b/test/fixtures/transformation/es6-modules-common/exports-default/expected.js index 9a3b8194a0..8c68ab4224 100644 --- a/test/fixtures/transformation/es6-modules-common/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-common/exports-default/expected.js @@ -5,7 +5,9 @@ exports["default"] = {}; exports["default"] = []; exports["default"] = foo; exports["default"] = function () {}; + exports["default"] = function () {}; + function foo() {} exports["default"] = foo; var Foo = function Foo() {}; diff --git a/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js b/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js index 6bf0a88c3f..4a4269a21b 100644 --- a/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-umd/exports-default/expected.js @@ -12,7 +12,9 @@ exports["default"] = []; exports["default"] = foo; exports["default"] = function () {}; + exports["default"] = function () {}; + function foo() {} exports["default"] = foo; var Foo = function Foo() {};