From 43a81c07bf5ef8126e1e434468e074f40a8cfa67 Mon Sep 17 00:00:00 2001 From: Travis Hoover Date: Fri, 1 Dec 2017 14:29:39 -0800 Subject: [PATCH 1/2] [CLEANUP] Remove {{render}} --- packages/ember-glimmer/lib/syntax.ts | 6 +++++- packages/ember-glimmer/lib/syntax/render.ts | 2 ++ .../tests/integration/helpers/render-test.js | 12 ++++++++++++ .../lib/plugins/deprecate-render-model.js | 4 ++++ .../lib/plugins/deprecate-render.js | 4 ++++ packages/ember/tests/routing/basic_test.js | 7 ++++++- 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/packages/ember-glimmer/lib/syntax.ts b/packages/ember-glimmer/lib/syntax.ts index 1675048a9a9..b760669534a 100644 --- a/packages/ember-glimmer/lib/syntax.ts +++ b/packages/ember-glimmer/lib/syntax.ts @@ -65,7 +65,11 @@ export function registerMacros(macro: any) { export function populateMacros(blocks: any, inlines: any) { inlines.add('outlet', outletMacro); inlines.add('component', inlineComponentMacro); - inlines.add('render', renderMacro); + + if (ENV._ENABLE_RENDER_SUPPORT === true) { + inlines.add('render', renderMacro); + } + inlines.add('mount', mountMacro); inlines.add('input', inputMacro); inlines.add('textarea', textAreaMacro); diff --git a/packages/ember-glimmer/lib/syntax/render.ts b/packages/ember-glimmer/lib/syntax/render.ts index f19dfb608a5..dec5022c922 100644 --- a/packages/ember-glimmer/lib/syntax/render.ts +++ b/packages/ember-glimmer/lib/syntax/render.ts @@ -1,5 +1,7 @@ /** @module ember + +Remove after 3.4 once _ENABLE_RENDER_SUPPORT flag is no longer needed. */ import { ConstReference, isConst } from '@glimmer/reference'; diff --git a/packages/ember-glimmer/tests/integration/helpers/render-test.js b/packages/ember-glimmer/tests/integration/helpers/render-test.js index 31da486eb15..11acc4ac2cb 100644 --- a/packages/ember-glimmer/tests/integration/helpers/render-test.js +++ b/packages/ember-glimmer/tests/integration/helpers/render-test.js @@ -1,8 +1,20 @@ import { observer, set, computed } from 'ember-metal'; import { Controller } from 'ember-runtime'; +import { ENV } from 'ember-environment'; import { RenderingTest, moduleFor } from '../../utils/test-case'; moduleFor('Helpers test: {{render}}', class extends RenderingTest { + constructor() { + super(); + this.originalRenderSupport = ENV._ENABLE_RENDER_SUPPORT; + ENV._ENABLE_RENDER_SUPPORT = true; + } + + teardown() { + super.teardown(); + ENV._ENABLE_RENDER_SUPPORT = this.originalRenderSupport; + } + ['@test should render given template']() { this.registerTemplate('home', '

BYE

'); diff --git a/packages/ember-template-compiler/lib/plugins/deprecate-render-model.js b/packages/ember-template-compiler/lib/plugins/deprecate-render-model.js index 0e84f3651ad..ce3ee9bf5c5 100644 --- a/packages/ember-template-compiler/lib/plugins/deprecate-render-model.js +++ b/packages/ember-template-compiler/lib/plugins/deprecate-render-model.js @@ -2,6 +2,10 @@ import { deprecate } from 'ember-debug'; import calculateLocationDisplay from '../system/calculate-location-display'; +/* + * Remove after 3.4 once _ENABLE_RENDER_SUPPORT flag is no + * longer needed. + */ export default function deprecateRenderModel(env) { let { moduleName } = env.meta; diff --git a/packages/ember-template-compiler/lib/plugins/deprecate-render.js b/packages/ember-template-compiler/lib/plugins/deprecate-render.js index 69cc74e0a24..2be88fc7364 100644 --- a/packages/ember-template-compiler/lib/plugins/deprecate-render.js +++ b/packages/ember-template-compiler/lib/plugins/deprecate-render.js @@ -1,6 +1,10 @@ import { deprecate } from 'ember-debug'; import calculateLocationDisplay from '../system/calculate-location-display'; +/* + * Remove after 3.4 once _ENABLE_RENDER_SUPPORT flag is no + * longer needed. + */ export default function deprecateRender(env) { let { moduleName } = env.meta; diff --git a/packages/ember/tests/routing/basic_test.js b/packages/ember/tests/routing/basic_test.js index e6a6e129649..5b51eadc832 100644 --- a/packages/ember/tests/routing/basic_test.js +++ b/packages/ember/tests/routing/basic_test.js @@ -27,13 +27,14 @@ import { setTemplate } from 'ember-glimmer'; import { jQuery } from 'ember-views'; +import { ENV } from 'ember-environment'; import { compile } from 'ember-template-compiler'; import { Application, Engine } from 'ember-application'; import { Transition } from 'router'; let trim = jQuery.trim; -let Router, App, router, registry, container, originalLoggerError; +let Router, App, router, registry, container, originalLoggerError, originalRenderSupport; function bootApplication() { router = container.lookup('router:main'); @@ -100,6 +101,9 @@ QUnit.module('Basic Routing', { setTemplate('camelot', compile('

Is a silly place

')); originalLoggerError = Logger.error; + originalRenderSupport = ENV._ENABLE_RENDER_SUPPORT; + + ENV._ENABLE_RENDER_SUPPORT = true; }); }, @@ -110,6 +114,7 @@ QUnit.module('Basic Routing', { setTemplates({}); Logger.error = originalLoggerError; + ENV._ENABLE_RENDER_SUPPORT = originalRenderSupport; }); } }); From ce61c5d5eda2a6aee08cd40186ea91f1c2cbaa0c Mon Sep 17 00:00:00 2001 From: Travis Hoover Date: Tue, 12 Dec 2017 16:08:47 -0800 Subject: [PATCH 2/2] Fixing missing import --- packages/ember-glimmer/lib/syntax.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ember-glimmer/lib/syntax.ts b/packages/ember-glimmer/lib/syntax.ts index b760669534a..ce56383fd83 100644 --- a/packages/ember-glimmer/lib/syntax.ts +++ b/packages/ember-glimmer/lib/syntax.ts @@ -1,4 +1,5 @@ import { assert } from 'ember-debug'; +import { ENV } from 'ember-environment'; import { textAreaMacro } from './syntax/-text-area'; import { blockComponentMacro,