From 8f30dabbea361616c3d2d2e3e3dc004cd51dc6eb Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Sun, 7 Feb 2016 22:49:57 -0500 Subject: [PATCH] [FEATURE ember-htmlbars-component-generation] Remove feature. --- FEATURES.md | 5 - features.json | 1 - packages/ember-htmlbars/lib/index.js | 6 - .../tests/glimmer-component/render-test.js | 76 --- .../tests/hooks/component_test.js | 50 -- .../integration/component_invocation_test.js | 484 ------------------ .../integration/component_lifecycle_test.js | 9 - .../tests/integration/mutable_binding_test.js | 78 --- .../plugins/transform-top-level-components.js | 5 - .../lib/system/compile_options.js | 4 - tests/node/template-compiler-test.js | 16 - 11 files changed, 734 deletions(-) delete mode 100644 packages/ember-htmlbars/tests/glimmer-component/render-test.js delete mode 100644 packages/ember-htmlbars/tests/hooks/component_test.js diff --git a/FEATURES.md b/FEATURES.md index c262888c3f5..7d6244ea415 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -18,11 +18,6 @@ for a detailed explanation. serially and call `reset()` each time), as well as being critical to for FastBoot. -* `ember-htmlbars-component-generation` - - Enables HTMLBars compiler to interpret `` as a component - invocation (instead of a standard HTML5 style element). - * `ember-debug-handlers` Implements RFC https://github.com/emberjs/rfcs/pull/65, adding support for diff --git a/features.json b/features.json index a07b5837dc6..3da6924a5c9 100644 --- a/features.json +++ b/features.json @@ -1,7 +1,6 @@ { "features": { "features-stripped-test": null, - "ember-htmlbars-component-generation": false, "ember-application-visit": true, "ember-routing-route-configured-query-params": null, "ember-libraries-isregistered": null, diff --git a/packages/ember-htmlbars/lib/index.js b/packages/ember-htmlbars/lib/index.js index 32da4c41657..1dd7aa7f5d8 100644 --- a/packages/ember-htmlbars/lib/index.js +++ b/packages/ember-htmlbars/lib/index.js @@ -127,7 +127,6 @@ import htmlSafeHelper from 'ember-htmlbars/helpers/-html-safe'; import hashHelper from 'ember-htmlbars/helpers/hash'; import DOMHelper from 'ember-htmlbars/system/dom-helper'; import Helper, { helper as makeHelper } from 'ember-htmlbars/helper'; -import GlimmerComponent from 'ember-htmlbars/glimmer-component'; import { getTemplates, setTemplates @@ -171,10 +170,6 @@ Ember.HTMLBars = { DOMHelper }; -if (isEnabled('ember-htmlbars-component-generation')) { - Ember.GlimmerComponent = GlimmerComponent; -} - Helper.helper = makeHelper; Ember.Helper = Helper; @@ -193,4 +188,3 @@ Object.defineProperty(Ember, 'TEMPLATES', { get: getTemplates, set: setTemplates }); - diff --git a/packages/ember-htmlbars/tests/glimmer-component/render-test.js b/packages/ember-htmlbars/tests/glimmer-component/render-test.js deleted file mode 100644 index 8924e116dbb..00000000000 --- a/packages/ember-htmlbars/tests/glimmer-component/render-test.js +++ /dev/null @@ -1,76 +0,0 @@ -import View from 'ember-views/views/view'; -import GlimmerComponent from 'ember-htmlbars/glimmer-component'; -import compile from 'ember-template-compiler/system/compile'; -import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; -import ComponentLookup from 'ember-views/component_lookup'; -import isEnabled from 'ember-metal/features'; -import { OWNER } from 'container/owner'; -import buildOwner from 'container/tests/test-helpers/build-owner'; - -let view; - -if (isEnabled('ember-htmlbars-component-generation')) { - QUnit.module('A basic glimmer component', { - teardown() { - runDestroy(view); - } - }); - - QUnit.test('it renders', function(assert) { - let component; - - let MyComponent = GlimmerComponent.extend({ - init() { - component = this; - this._super(...arguments); - }, - layout: compile(`...{{yield}}...`) - }); - - renderComponent('my-component', { - implementation: MyComponent, - yielded: 'Hello world' - }); - - ok(component instanceof GlimmerComponent, 'the component was instantiated correctly'); - equal(view.childViews[0], component, 'the component was rendered and inserted into child views'); - hasSelector(assert, `my-component.ember-view[id=${component.elementId}]`); - equal(view.$().text(), '...Hello world...'); - }); -} - -function renderComponent(tag, component) { - let { params = [], hash = {}, yielded, implementation } = component; - let stringParams = params.join(' '); - let stringHash = Object.keys(hash) - .map(key => `${key}=${hash[key]}`) - .join(' '); - - let owner = buildOwner(); - owner.register('component-lookup:main', ComponentLookup); - owner.register(`component:${tag}`, implementation); - - view = View.extend({ - [OWNER]: owner, - template: compile(`<${tag} ${stringParams} ${stringHash}>${yielded}`) - }).create(); - - runAppend(view); -} - -function hasSelector(assert, selector) { - assert.ok(document.querySelector(`#qunit-fixture ${selector}`), `${selector} exists`); -} - - -//testForComponent({ - //name: 'my-component', - //params: [], - //hash: {}, - //template: ` - // - //Hello world - // - //`, - //component: MyComponent -//}); diff --git a/packages/ember-htmlbars/tests/hooks/component_test.js b/packages/ember-htmlbars/tests/hooks/component_test.js deleted file mode 100644 index 18d525343a8..00000000000 --- a/packages/ember-htmlbars/tests/hooks/component_test.js +++ /dev/null @@ -1,50 +0,0 @@ -import isEnabled from 'ember-metal/features'; -import ComponentLookup from 'ember-views/component_lookup'; -import EmberView from 'ember-views/views/view'; -import compile from 'ember-template-compiler/system/compile'; -import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; -import { OWNER } from 'container/owner'; -import buildOwner from 'container/tests/test-helpers/build-owner'; - -var view, owner; - -if (isEnabled('ember-htmlbars-component-generation')) { - QUnit.module('ember-htmlbars: dasherized components that are not in the container ("web components")', { - setup() { - owner = buildOwner(); - - owner.registerOptionsForType('template', { instantiate: false }); - owner.register('component-lookup:main', ComponentLookup); - }, - - teardown() { - runDestroy(view); - runDestroy(owner); - owner = view = null; - } - }); - - QUnit.test('non-component dasherized elements can be used as top-level elements', function() { - owner.register('template:components/foo-bar', compile('yippie!')); - - view = EmberView.create({ - [OWNER]: owner, - template: compile('') - }); - - runAppend(view); - - equal(view.$('baz-bat').length, 1, 'regular element fallback occurred'); - }); - - QUnit.test('falls back to web component when invoked with angles', function() { - view = EmberView.create({ - [OWNER]: owner, - template: compile('') - }); - - runAppend(view); - - equal(view.$('foo-bar').length, 1, 'regular element fallback occurred'); - }); -} diff --git a/packages/ember-htmlbars/tests/integration/component_invocation_test.js b/packages/ember-htmlbars/tests/integration/component_invocation_test.js index a9a3f24d94b..4151b1fb555 100644 --- a/packages/ember-htmlbars/tests/integration/component_invocation_test.js +++ b/packages/ember-htmlbars/tests/integration/component_invocation_test.js @@ -1,5 +1,4 @@ import Ember from 'ember-metal/core'; -import isEnabled from 'ember-metal/features'; import EmberView from 'ember-views/views/view'; import jQuery from 'ember-views/system/jquery'; import compile from 'ember-template-compiler/system/compile'; @@ -7,9 +6,7 @@ import ComponentLookup from 'ember-views/component_lookup'; import Component from 'ember-views/components/component'; import GlimmerComponent from 'ember-htmlbars/glimmer-component'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; -import { get } from 'ember-metal/property_get'; import { set } from 'ember-metal/property_set'; -import alias from 'ember-metal/alias'; import run from 'ember-metal/run_loop'; import { A as emberA } from 'ember-runtime/system/native_array'; import buildOwner from 'container/tests/test-helpers/build-owner'; @@ -956,484 +953,3 @@ QUnit.test('specifying custom concatenatedProperties avoids clobbering', functio assert.deepEqual(clickyThing.get('blahzz'), ['blark', 'pory', 'baz'], 'property is properly combined'); }); - -// jscs:disable validateIndentation -if (isEnabled('ember-htmlbars-component-generation')) { - QUnit.module('component - invocation (angle brackets)', { - setup() { - commonSetup(); - }, - - teardown() { - commonTeardown(); - } - }); - - QUnit.test('legacy components cannot be invoked with angle brackets', function() { - owner.register('template:components/non-block', compile('In layout')); - owner.register('component:non-block', Component.extend()); - - expectAssertion(function() { - view = appendViewFor(''); - }, /cannot invoke the 'non-block' component with angle brackets/); - }); - - QUnit.test('using a text-fragment in a GlimmerComponent layout gives an error', function() { - owner.register('template:components/non-block', compile('In layout')); - - expectAssertion(() => { - view = appendViewFor(''); - }, `The template must have a single top-level element because it is a GlimmerComponent.`); - }); - - QUnit.test('having multiple top-level elements in a GlimmerComponent layout gives an error', function() { - owner.register('template:components/non-block', compile('
This is a
fragment
')); - - expectAssertion(() => { - view = appendViewFor(''); - }, `The template must have a single top-level element because it is a GlimmerComponent.`); - }); - - QUnit.test('using a modifier in a GlimmerComponent layout gives an error', function() { - owner.register('template:components/non-block', compile('
')); - - expectAssertion(() => { - view = appendViewFor(''); - }, `You cannot use {{action ...}} in the top-level element of the template because it is a GlimmerComponent.`); - }); - - QUnit.test('using triple-curlies in a GlimmerComponent layout gives an error', function() { - owner.register('template:components/non-block', compile('
This is a
')); - - expectAssertion(() => { - view = appendViewFor(''); - }, `You cannot use triple curlies (e.g. style={{{ ... }}}) in the top-level element of the template because it is a GlimmerComponent.`); - }); - - let styles = [{ - name: 'a div', - tagName: 'div' - }, { - name: 'an identity element', - tagName: 'non-block' - }, { - name: 'a web component', - tagName: 'not-an-ember-component' - }]; - - styles.forEach(style => { - QUnit.test(`non-block without attributes replaced with ${style.name}`, function() { - // The whitespace is added intentionally to verify that the heuristic is not "a single node" but - // rather "a single non-whitespace, non-comment node" - owner.register('template:components/non-block', compile(` <${style.tagName}>In layout `)); - - view = appendViewFor(''); - - let node = view.element.firstElementChild; - equalsElement(node, style.tagName, { class: 'ember-view', id: regex(/^ember\d*$/) }, 'In layout'); - - run(view, 'rerender'); - - strictEqual(node, view.element.firstElementChild, 'The inner element has not changed'); - equalsElement(node, style.tagName, { class: 'ember-view', id: regex(/^ember\d*$/) }, 'In layout'); - }); - - QUnit.test(`non-block with attributes replaced with ${style.name}`, function() { - owner.register('template:components/non-block', compile(` <${style.tagName} such="{{attrs.stability}}">In layout `)); - - view = appendViewFor('', { - stability: 'stability' - }); - - let node = view.element.firstElementChild; - equalsElement(node, style.tagName, { such: 'stability', class: 'ember-view', id: regex(/^ember\d*$/) }, 'In layout'); - - run(() => view.set('stability', 'changed!!!')); - - strictEqual(node, view.element.firstElementChild, 'The inner element has not changed'); - equalsElement(node, style.tagName, { such: 'changed!!!', class: 'ember-view', id: regex(/^ember\d*$/) }, 'In layout'); - }); - - QUnit.test(`non-block replaced with ${style.name} (regression with single element in the root element)`, function() { - owner.register('template:components/non-block', compile(` <${style.tagName} such="{{attrs.stability}}">

In layout

`)); - - view = appendViewFor('', { - stability: 'stability' - }); - - let node = view.element.firstElementChild; - equalsElement(node, style.tagName, { such: 'stability', class: 'ember-view', id: regex(/^ember\d*$/) }, '

In layout

'); - - run(() => view.set('stability', 'changed!!!')); - - strictEqual(node, view.element.firstElementChild, 'The inner element has not changed'); - equalsElement(node, style.tagName, { such: 'changed!!!', class: 'ember-view', id: regex(/^ember\d*$/) }, '

In layout

'); - }); - - QUnit.test(`non-block with class replaced with ${style.name} merges classes`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName} class="inner-class" />`)); - - view = appendViewFor('', { - outer: 'outer' - }); - - equal(view.$(style.tagName).attr('class'), 'inner-class outer ember-view', 'the classes are merged'); - - run(() => view.set('outer', 'new-outer')); - - equal(view.$(style.tagName).attr('class'), 'inner-class new-outer ember-view', 'the classes are merged'); - }); - - QUnit.test(`non-block with outer attributes replaced with ${style.name} shadows inner attributes`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName} data-static="static" data-dynamic="{{internal}}" />`)); - - view = appendViewFor(''); - - equal(view.$(style.tagName).attr('data-static'), 'outer', 'the outer attribute wins'); - equal(view.$(style.tagName).attr('data-dynamic'), 'outer', 'the outer attribute wins'); - - let component = view.childViews[0]; // HAX - - run(() => component.set('internal', 'changed')); - - equal(view.$(style.tagName).attr('data-static'), 'outer', 'the outer attribute wins'); - equal(view.$(style.tagName).attr('data-dynamic'), 'outer', 'the outer attribute wins'); - }); - - // TODO: When un-skipping, fix this so it handles all styles - QUnit.skip('non-block recursive invocations with outer attributes replaced with a div shadows inner attributes', function() { - owner.register('template:components/non-block-wrapper', compile('')); - owner.register('template:components/non-block', compile('
')); - - view = appendViewFor(''); - - equal(view.$('div').attr('data-static'), 'outer', 'the outer-most attribute wins'); - equal(view.$('div').attr('data-dynamic'), 'outer', 'the outer-most attribute wins'); - - let component = view.childViews[0].childViews[0]; // HAX - - run(() => component.set('internal', 'changed')); - - equal(view.$('div').attr('data-static'), 'outer', 'the outer-most attribute wins'); - equal(view.$('div').attr('data-dynamic'), 'outer', 'the outer-most attribute wins'); - }); - - QUnit.test(`non-block replaced with ${style.name} should have correct scope`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName}>{{internal}}`)); - - owner.register('component:non-block', GlimmerComponent.extend({ - init() { - this._super(...arguments); - this.set('internal', 'stuff'); - } - })); - - view = appendViewFor(''); - - equal(view.$().text(), 'stuff'); - }); - - QUnit.test(`non-block replaced with ${style.name} should have correct 'element'`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName} />`)); - - let component; - - owner.register('component:non-block', GlimmerComponent.extend({ - init() { - this._super(...arguments); - component = this; - } - })); - - view = appendViewFor(''); - - equal(component.element, view.$(style.tagName)[0]); - }); - - QUnit.test(`non-block replaced with ${style.name} should have inner attributes`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName} data-static="static" data-dynamic="{{internal}}" />`)); - - owner.register('component:non-block', GlimmerComponent.extend({ - init() { - this._super(...arguments); - this.set('internal', 'stuff'); - } - })); - - view = appendViewFor(''); - - equal(view.$(style.tagName).attr('data-static'), 'static'); - equal(view.$(style.tagName).attr('data-dynamic'), 'stuff'); - }); - - QUnit.test(`only text attributes are reflected on the underlying DOM element (${style.name})`, function() { - owner.register('template:components/non-block', compile(`<${style.tagName}>In layout`)); - - view = appendViewFor('', { - dynamic: 'dynamic' - }); - - let el = view.$(style.tagName); - equal(el.length, 1, 'precond - the view was rendered'); - equal(el.text(), 'In layout'); - equal(el.attr('static-prop'), 'static text'); - equal(el.attr('concat-prop'), 'dynamic text'); - equal(el.attr('dynamic-prop'), undefined); - }); - - QUnit.skip(`partials templates should not be treated like a component layout for ${style.name}`, function() { - owner.register('template:_zomg', compile(`

In partial

`)); - owner.register('template:components/non-block', compile(`<${style.tagName}>{{partial "zomg"}}`)); - - view = appendViewFor(''); - - let el = view.$(style.tagName).find('p'); - equal(el.length, 1, 'precond - the partial was rendered'); - equal(el.text(), 'In partial'); - strictEqual(el.attr('id'), undefined, 'the partial should not get an id'); - strictEqual(el.attr('class'), undefined, 'the partial should not get a class'); - }); - }); - - QUnit.skip('[FRAGMENT] non-block rendering a fragment', function() { - owner.register('template:components/non-block', compile('

{{attrs.first}}

{{attrs.second}}

')); - - view = appendViewFor('', { - first: 'first1', - second: 'second1' - }); - - equal(view.$().html(), '

first1

second1

', 'No wrapping element was created'); - - run(view, 'setProperties', { - first: 'first2', - second: 'second2' - }); - - equal(view.$().html(), '

first2

second2

', 'The fragment was updated'); - }); - - QUnit.test('block without properties', function() { - owner.register('template:components/with-block', compile('In layout - {{yield}}')); - - view = appendViewFor('In template'); - - equal(view.$('with-block.ember-view').text(), 'In layout - In template', 'Both the layout and template are rendered'); - }); - - QUnit.test('attributes are not installed on the top level', function() { - let component; - - owner.register('template:components/non-block', compile('In layout - {{attrs.text}} -- {{text}}')); - owner.register('component:non-block', GlimmerComponent.extend({ - // This is specifically attempting to trigger a 1.x-era heuristic that only copied - // attrs that were present as defined properties on the component. - text: null, - dynamic: null, - - init() { - this._super(...arguments); - component = this; - } - })); - - view = appendViewFor('', { - dynamic: 'dynamic' - }); - - let el = view.$('non-block.ember-view'); - ok(el, 'precond - the view was rendered'); - - equal(el.text(), 'In layout - texting -- '); - equal(component.attrs.text, 'texting'); - equal(component.attrs.dynamic, 'dynamic'); - strictEqual(get(component, 'text'), null); - strictEqual(get(component, 'dynamic'), null); - - run(() => view.rerender()); - - equal(el.text(), 'In layout - texting -- '); - equal(component.attrs.text, 'texting'); - equal(component.attrs.dynamic, 'dynamic'); - strictEqual(get(component, 'text'), null); - strictEqual(get(component, 'dynamic'), null); - }); - - QUnit.test('non-block with properties on attrs and component class', function() { - owner.register('component:non-block', GlimmerComponent.extend()); - owner.register('template:components/non-block', compile('In layout - someProp: {{attrs.someProp}}')); - - view = appendViewFor(''); - - equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: something here'); - }); - - QUnit.test('rerendering component with attrs from parent', function() { - var willUpdate = 0; - var didReceiveAttrs = 0; - - owner.register('component:non-block', GlimmerComponent.extend({ - didReceiveAttrs() { - didReceiveAttrs++; - }, - - willUpdate() { - willUpdate++; - } - })); - - owner.register('template:components/non-block', compile('In layout - someProp: {{attrs.someProp}}')); - - view = appendViewFor('', { - someProp: 'wycats' - }); - - equal(didReceiveAttrs, 1, 'The didReceiveAttrs hook fired'); - - equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: wycats'); - - run(function() { - view.set('someProp', 'tomdale'); - }); - - equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: tomdale'); - equal(didReceiveAttrs, 2, 'The didReceiveAttrs hook fired again'); - equal(willUpdate, 1, 'The willUpdate hook fired once'); - - run(view, 'rerender'); - - equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: tomdale'); - equal(didReceiveAttrs, 3, 'The didReceiveAttrs hook fired again'); - equal(willUpdate, 2, 'The willUpdate hook fired again'); - }); - - QUnit.test('block with properties on attrs', function() { - owner.register('template:components/with-block', compile('In layout - someProp: {{attrs.someProp}} - {{yield}}')); - - view = appendViewFor('In template'); - - equal(jQuery('#qunit-fixture').text(), 'In layout - someProp: something here - In template'); - }); - - QUnit.test('moduleName is available on _renderNode when a layout is present', function() { - expect(1); - - var layoutModuleName = 'my-app-name/templates/components/sample-component'; - var sampleComponentLayout = compile('Sample Component - {{yield}}', { - moduleName: layoutModuleName - }); - owner.register('template:components/sample-component', sampleComponentLayout); - owner.register('component:sample-component', GlimmerComponent.extend({ - didInsertElement: function() { - equal(this._renderNode.lastResult.template.meta.moduleName, layoutModuleName); - } - })); - - view = EmberView.extend({ - [OWNER]: owner, - layout: compile('') - }).create(); - - runAppend(view); - }); - - QUnit.test('moduleName is available on _renderNode when no layout is present', function() { - expect(1); - - var templateModuleName = 'my-app-name/templates/application'; - owner.register('component:sample-component', Component.extend({ - didInsertElement: function() { - equal(this._renderNode.lastResult.template.meta.moduleName, templateModuleName); - } - })); - - view = EmberView.extend({ - [OWNER]: owner, - layout: compile('{{#sample-component}}Derp{{/sample-component}}', { - moduleName: templateModuleName - }) - }).create(); - - runAppend(view); - }); - - QUnit.test('computed property alias on attrs', function() { - owner.register('template:components/computed-alias', compile('{{otherProp}}')); - - owner.register('component:computed-alias', GlimmerComponent.extend({ - otherProp: alias('attrs.someProp') - })); - - view = appendViewFor(''); - - equal(view.$().text(), 'value'); - }); - - QUnit.test('parameterized hasBlock default', function() { - owner.register('template:components/check-block', compile('{{#if (hasBlock)}}Yes{{else}}No{{/if}}')); - - view = appendViewFor(' '); - - equal(view.$('#expect-yes-1').text(), 'Yes'); - equal(view.$('#expect-yes-2').text(), 'Yes'); - }); - - QUnit.test('non-expression hasBlock ', function() { - owner.register('template:components/check-block', compile('{{#if hasBlock}}Yes{{else}}No{{/if}}')); - - view = appendViewFor(' '); - - equal(view.$('#expect-yes-1').text(), 'Yes'); - equal(view.$('#expect-yes-2').text(), 'Yes'); - }); - - QUnit.test('parameterized hasBlockParams', function() { - owner.register('template:components/check-params', compile('{{#if (hasBlockParams)}}Yes{{else}}No{{/if}}')); - - view = appendViewFor(' '); - - equal(view.$('#expect-no').text(), 'No'); - equal(view.$('#expect-yes').text(), 'Yes'); - }); - - QUnit.test('non-expression hasBlockParams', function() { - owner.register('template:components/check-params', compile('{{#if hasBlockParams}}Yes{{else}}No{{/if}}')); - - view = appendViewFor(' '); - - equal(view.$('#expect-no').text(), 'No'); - equal(view.$('#expect-yes').text(), 'Yes'); - }); -} - -function regex(r) { - return { - match(v) { - return r.test(v); - } - }; -} - -function equalsElement(element, tagName, attributes, content) { - QUnit.push(element.tagName === tagName.toUpperCase(), element.tagName.toLowerCase(), tagName, `expect tagName to be ${tagName}`); - - let expectedCount = 0; - for (let prop in attributes) { - expectedCount++; - let expected = attributes[prop]; - if (typeof expected === 'string') { - QUnit.push(element.getAttribute(prop) === attributes[prop], element.getAttribute(prop), attributes[prop], `The element should have ${prop}=${attributes[prop]}`); - } else { - QUnit.push(attributes[prop].match(element.getAttribute(prop)), element.getAttribute(prop), attributes[prop], `The element should have ${prop}=${attributes[prop]}`); - } - } - - let actualAttributes = {}; - for (let i = 0, l = element.attributes.length; i < l; i++) { - actualAttributes[element.attributes[i].name] = element.attributes[i].value; - } - - QUnit.push(element.attributes.length === expectedCount, actualAttributes, attributes, `Expected ${expectedCount} attributes`); - - QUnit.push(element.innerHTML === content, element.innerHTML, content, `The element had '${content}' as its content`); -} diff --git a/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js b/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js index 562c73559c0..1104fd9ac25 100644 --- a/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js +++ b/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js @@ -2,11 +2,9 @@ import jQuery from 'ember-views/system/jquery'; import compile from 'ember-template-compiler/system/compile'; import ComponentLookup from 'ember-views/component_lookup'; import Component from 'ember-views/components/component'; -import GlimmerComponent from 'ember-htmlbars/glimmer-component'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import run from 'ember-metal/run_loop'; import EmberView from 'ember-views/views/view'; -import isEnabled from 'ember-metal/features'; import buildOwner from 'container/tests/test-helpers/build-owner'; import { OWNER } from 'container/owner'; @@ -18,13 +16,6 @@ let styles = [{ class: Component }]; -if (isEnabled('ember-htmlbars-component-generation')) { - styles.push({ - name: 'angle', - class: GlimmerComponent - }); -} - styles.forEach(style => { function invoke(name, hash = {}) { if (style.name === 'curly') { diff --git a/packages/ember-htmlbars/tests/integration/mutable_binding_test.js b/packages/ember-htmlbars/tests/integration/mutable_binding_test.js index e52ceb88a37..08f711ba741 100644 --- a/packages/ember-htmlbars/tests/integration/mutable_binding_test.js +++ b/packages/ember-htmlbars/tests/integration/mutable_binding_test.js @@ -1,10 +1,8 @@ -import isEnabled from 'ember-metal/features'; import EmberView from 'ember-views/views/view'; //import jQuery from "ember-views/system/jquery"; import compile from 'ember-template-compiler/system/compile'; import ComponentLookup from 'ember-views/component_lookup'; import Component from 'ember-views/components/component'; -import GlimmerComponent from 'ember-htmlbars/glimmer-component'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import run from 'ember-metal/run_loop'; import { computed } from 'ember-metal/computed'; @@ -339,79 +337,3 @@ QUnit.test('automatic mutable bindings to constant non-streams tolerate attempts run(() => inner.attrs.model.update(42)); assert.equal(inner.attrs.model.value, 42); }); - - -// jscs:disable validateIndentation -if (isEnabled('ember-htmlbars-component-generation')) { -QUnit.test('mutable bindings work as angle-bracket component attributes', function(assert) { - var middle; - - owner.register('component:middle-mut', GlimmerComponent.extend({ - // no longer mutable - layout: compile(''), - - didInsertElement() { - middle = this; - } - })); - - owner.register('component:bottom-mut', GlimmerComponent.extend({ - layout: compile('

{{attrs.setMe}}

') - })); - - view = EmberView.create({ - [OWNER]: owner, - template: compile(''), - val: 12 - }); - - runAppend(view); - - assert.strictEqual(view.$('p.bottom').text(), '12'); - - run(() => middle.attrs.value.update(13)); - - assert.strictEqual(middle.attrs.value.value, 13, 'precond - the set took effect'); - assert.strictEqual(view.$('p.bottom').text(), '13'); - assert.strictEqual(view.get('val'), 13, 'the set propagated back up'); -}); - -QUnit.test('a simple mutable binding using `mut` can be converted into an immutable binding with angle-bracket components', function(assert) { - var middle, bottom; - - owner.register('component:middle-mut', GlimmerComponent.extend({ - // no longer mutable - layout: compile(''), - - didInsertElement() { - middle = this; - } - })); - - owner.register('component:bottom-mut', GlimmerComponent.extend({ - layout: compile('

{{attrs.setMe}}

'), - - didInsertElement() { - bottom = this; - } - })); - - view = EmberView.create({ - [OWNER]: owner, - template: compile(''), - val: 12 - }); - - runAppend(view); - - assert.strictEqual(view.$('p.bottom').text(), '12'); - - run(() => middle.attrs.value.update(13)); - - assert.strictEqual(middle.attrs.value.value, 13, 'precond - the set took effect'); - assert.strictEqual(bottom.attrs.setMe, 13, 'the mutable binding has been converted to an immutable cell'); - assert.strictEqual(view.$('p.bottom').text(), '13'); - assert.strictEqual(view.get('val'), 13, 'the set propagated back up'); -}); -} -// jscs:enable validateIndentation diff --git a/packages/ember-template-compiler/lib/plugins/transform-top-level-components.js b/packages/ember-template-compiler/lib/plugins/transform-top-level-components.js index 25e65f41d80..d1ec98a5bec 100644 --- a/packages/ember-template-compiler/lib/plugins/transform-top-level-components.js +++ b/packages/ember-template-compiler/lib/plugins/transform-top-level-components.js @@ -1,5 +1,3 @@ -import isEnabled from 'ember-metal/features'; - function TransformTopLevelComponents() { // set later within HTMLBars to the syntax package this.syntax = null; @@ -62,9 +60,6 @@ function hasSingleComponentNode(program, componentCallback, elementCallback) { if (lastComponentNode.type === 'ComponentNode') { componentCallback(lastComponentNode); - } else if (isEnabled('ember-htmlbars-component-generation')) { - let component = elementCallback(lastComponentNode); - body.splice(lastIndex, 1, component); } } diff --git a/packages/ember-template-compiler/lib/system/compile_options.js b/packages/ember-template-compiler/lib/system/compile_options.js index cd67221035e..a7b2141f696 100644 --- a/packages/ember-template-compiler/lib/system/compile_options.js +++ b/packages/ember-template-compiler/lib/system/compile_options.js @@ -3,7 +3,6 @@ @submodule ember-template-compiler */ -import isEnabled from 'ember-metal/features'; import assign from 'ember-metal/assign'; import defaultPlugins from 'ember-template-compiler/plugins'; @@ -13,9 +12,6 @@ import defaultPlugins from 'ember-template-compiler/plugins'; */ export default function(_options) { var disableComponentGeneration = true; - if (isEnabled('ember-htmlbars-component-generation')) { - disableComponentGeneration = false; - } let options; // When calling `Ember.Handlebars.compile()` a second argument of `true` diff --git a/tests/node/template-compiler-test.js b/tests/node/template-compiler-test.js index 857a9d7b43f..4e100a75ed4 100644 --- a/tests/node/template-compiler-test.js +++ b/tests/node/template-compiler-test.js @@ -30,19 +30,3 @@ test('can be required', function(assert) { assert.ok(typeof templateCompiler.compile === 'function', 'compile function is present'); assert.ok(typeof templateCompiler.template === 'function', 'template function is present'); }); - -test('allows enabling of features', function(assert) { - var templateOutput; - var templateCompiler = require(path.join(distPath, 'ember-template-compiler')); - - var featureValue = templateCompiler._Ember.FEATURES['ember-htmlbars-component-generation']; - - if (featureValue || featureValue === null) { - templateCompiler._Ember.FEATURES['ember-htmlbars-component-generation'] = true; - - templateOutput = templateCompiler.precompile(''); - assert.ok(templateOutput.indexOf('["component","@",[],0]') > -1, 'component generation can be enabled'); - } else { - assert.ok(true, 'cannot test features in feature stripped build'); - } -});