Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Apr 29, 2021
1 parent 706f7c7 commit 2d068bf
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["@glimmer/babel-preset", { "isDebug": true }]
["@glimmerx/babel-preset", { "isDebug": true }]
]
}
2 changes: 0 additions & 2 deletions packages/@glimmerx/babel-preset/test/fixtures/debug/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ export default class Test extends Component {
#cantTouchThis = 'mc hammer';

#hammerTime() {}


}
38 changes: 21 additions & 17 deletions packages/@glimmerx/babel-preset/test/fixtures/debug/output.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var _class, _descriptor, _cantTouchThis, _hammerTime;

import { setComponentTemplate as _setComponentTemplate } from "@glimmer/core";

function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Expand All @@ -10,8 +8,11 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con

function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

import { setComponentTemplate as _setComponentTemplate } from "@glimmer/core";
import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";
import { assert, deprecate } from '@glimmer/debug';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component from '@glimmerx/component';

if (true
/* DEBUG */
Expand All @@ -23,8 +24,21 @@ if (true
(true && !(false) && deprecate('this is deprecated', false, {
id: 'foo'
}));
let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test {
constructor() {

let Test = _setComponentTemplate(_createTemplateFactory(
/*
Hello World
*/
{
"id": null,
"block": "[[[1,\"Hello World\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
}), (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test extends Component {
constructor(...args) {
super(...args);

_hammerTime.add(this);

_initializerDefineProperty(this, "bar", _descriptor, this);
Expand All @@ -42,18 +56,8 @@ let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(
initializer: function () {
return 123;
}
})), _class);
})), _class));

function _hammerTime2() {}

_setComponentTemplate(Test,
/*
Hello, world!
*/
{
"id": null,
"block": "[[[1,\"Hello, world!\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
});
export { Test as default };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
["@glimmer/babel-preset", { "isDebug": false }]
["@glimmerx/babel-preset", { "isDebug": false }]
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEBUG } from '@glimmer/env';
import { assert, deprecate } from '@glimmer/debug';
import { precompileTemplate } from '@glimmer/core';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component, { hbs } from '@glimmerx/component';

if (DEBUG) {
console.log('DEBUG!');
Expand All @@ -11,12 +11,11 @@ assert(true, 'is true');
deprecate('this is deprecated', false, { id: 'foo' });


class Test {
export default class Test extends Component {
@tracked bar = 123;
static template = hbs`Hello World`;

#cantTouchThis = 'mc hammer';

#hammerTime() {}
}

precompileTemplate('Hello, world!', { strictMode: true, scope: { Test } });
38 changes: 21 additions & 17 deletions packages/@glimmerx/babel-preset/test/fixtures/production/output.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var _class, _descriptor, _cantTouchThis, _hammerTime;

import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";

function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
Expand All @@ -10,8 +8,11 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con

function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

import { setComponentTemplate as _setComponentTemplate } from "@glimmer/core";
import { createTemplateFactory as _createTemplateFactory } from "@glimmer/core";
import { assert, deprecate } from '@glimmer/debug';
import { tracked } from '@glimmer/tracking';
import { tracked } from '@glimmerx/tracking';
import Component from '@glimmerx/component';

if (false
/* DEBUG */
Expand All @@ -23,8 +24,21 @@ if (false
(false && !(false) && deprecate('this is deprecated', false, {
id: 'foo'
}));
let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test {
constructor() {

let Test = _setComponentTemplate(_createTemplateFactory(
/*
Hello World
*/
{
"id": null,
"block": "[[[1,\"Hello World\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
}), (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(), class Test extends Component {
constructor(...args) {
super(...args);

_hammerTime.add(this);

_initializerDefineProperty(this, "bar", _descriptor, this);
Expand All @@ -42,18 +56,8 @@ let Test = (_class = (_cantTouchThis = new WeakMap(), _hammerTime = new WeakSet(
initializer: function () {
return 123;
}
})), _class);
})), _class));

function _hammerTime2() {}

_createTemplateFactory(
/*
Hello, world!
*/
{
"id": null,
"block": "[[[1,\"Hello, world!\"]],[],false,[]]",
"moduleName": "(unknown template module)",
"scope": null,
"isStrictMode": true
});
export { Test as default };

0 comments on commit 2d068bf

Please sign in to comment.