Skip to content

Commit

Permalink
Merge pull request #18198 from rwjblue/enable-set-component-template
Browse files Browse the repository at this point in the history
[FEATURE ember-glimmer-set-component-template] Enable by default.
  • Loading branch information
chancancode committed Aug 1, 2019
2 parents c4cdae9 + 7a3175d commit a1b5a6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ const OCTANE = process.env.EMBER_VERSION === 'octane';
// TODO: this should be reading from the @ember/canary-features module
// need to refactor broccoli/features.js to be able to work more similarly
// to https://github.com/emberjs/data/pull/6231
const EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = OCTANE;
const EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = true;

// intentionally avoiding use-edition-detector
module.exports = {
EMBER_GLIMMER_SET_COMPONENT_TEMPLATE,

description: 'Generates a component.',

availableOptions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
EMBER_GLIMMER_SET_COMPONENT_TEMPLATE,
EMBER_MODULE_UNIFICATION,
} from '@ember/canary-features';
import { HAS_NATIVE_SYMBOL } from '@ember/-internals/utils';

import { Component, compile } from '../../utils/helpers';
import { setComponentTemplate, getComponentTemplate } from '../../..';
Expand Down Expand Up @@ -74,9 +75,11 @@ if (EMBER_GLIMMER_SET_COMPONENT_TEMPLATE) {
setComponentTemplate(compile('foo'), 'foo');
}, /Cannot call `setComponentTemplate` on `foo`/);

expectAssertion(() => {
setComponentTemplate(compile('foo'), Symbol('foo'));
}, /Cannot call `setComponentTemplate` on `Symbol\(foo\)`/);
if (HAS_NATIVE_SYMBOL) {
expectAssertion(() => {
setComponentTemplate(compile('foo'), Symbol('foo'));
}, /Cannot call `setComponentTemplate` on `Symbol\(foo\)`/);
}
}

'@test calling it twice on the same object asserts'() {
Expand Down
4 changes: 1 addition & 3 deletions packages/@ember/-internals/utils/lib/symbol-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ export const HAS_NATIVE_SYMBOL = (function() {
return false;
}

// use `Object`'s `.toString` directly to prevent us from detecting
// polyfills as native
return Object.prototype.toString.call(Symbol()) === '[object Symbol]';
return typeof Symbol() === 'symbol';
})();
2 changes: 1 addition & 1 deletion packages/@ember/canary-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const DEFAULT_FEATURES = {
EMBER_GLIMMER_FN_HELPER: true,
EMBER_CUSTOM_COMPONENT_ARG_PROXY: true,
EMBER_FRAMEWORK_OBJECT_OWNER_ARGUMENT: true,
EMBER_GLIMMER_SET_COMPONENT_TEMPLATE: null,
EMBER_GLIMMER_SET_COMPONENT_TEMPLATE: true,
};

/**
Expand Down

0 comments on commit a1b5a6b

Please sign in to comment.