From 81a5f785c0bb4f8dfa06090c84f7af0d893c34d4 Mon Sep 17 00:00:00 2001 From: Marten Schilstra Date: Sat, 18 Jul 2015 19:26:15 +0200 Subject: [PATCH] [CLEANUP beta] Remove deprecated Ember.Handlebars.get --- packages/ember-htmlbars/lib/compat.js | 2 - .../lib/compat/handlebars-get.js | 25 ---- .../tests/compat/handlebars_get_test.js | 120 ------------------ 3 files changed, 147 deletions(-) delete mode 100644 packages/ember-htmlbars/lib/compat/handlebars-get.js delete mode 100644 packages/ember-htmlbars/tests/compat/handlebars_get_test.js diff --git a/packages/ember-htmlbars/lib/compat.js b/packages/ember-htmlbars/lib/compat.js index 24496af9b5a..ea895fa4059 100644 --- a/packages/ember-htmlbars/lib/compat.js +++ b/packages/ember-htmlbars/lib/compat.js @@ -4,7 +4,6 @@ import { registerHandlebarsCompatibleHelper as compatRegisterHelper, handlebarsHelper as compatHandlebarsHelper } from 'ember-htmlbars/compat/helper'; -import compatHandlebarsGet from 'ember-htmlbars/compat/handlebars-get'; import compatMakeBoundHelper from 'ember-htmlbars/compat/make-bound-helper'; import compatRegisterBoundHelper from 'ember-htmlbars/compat/register-bound-helper'; import makeViewHelper from 'ember-htmlbars/system/make-view-helper'; @@ -19,7 +18,6 @@ EmberHandlebars.helper = compatHandlebarsHelper; EmberHandlebars.registerHelper = compatRegisterHelper; EmberHandlebars.registerBoundHelper = compatRegisterBoundHelper; EmberHandlebars.makeBoundHelper = compatMakeBoundHelper; -EmberHandlebars.get = compatHandlebarsGet; EmberHandlebars.makeViewHelper = makeViewHelper; EmberHandlebars.SafeString = SafeString; diff --git a/packages/ember-htmlbars/lib/compat/handlebars-get.js b/packages/ember-htmlbars/lib/compat/handlebars-get.js deleted file mode 100644 index eb3536172dc..00000000000 --- a/packages/ember-htmlbars/lib/compat/handlebars-get.js +++ /dev/null @@ -1,25 +0,0 @@ -/** -@module ember -@submodule ember-htmlbars -*/ - -import Ember from 'ember-metal/core'; - -/** - Lookup both on root and on window. If the path starts with - a keyword, the corresponding object will be looked up in the - template's data hash and used to resolve the path. - - @method get - @for Ember.Handlebars - @param {Object} root The object to look up the property on - @param {String} path The path to be lookedup - @param {Object} options The template's option hash - @deprecated - @public -*/ -export default function handlebarsGet(root, path, options) { - Ember.deprecate('Usage of Ember.Handlebars.get is deprecated, use a Component or Ember.Handlebars.makeBoundHelper instead.'); - - return options.legacyGetPath(path); -} diff --git a/packages/ember-htmlbars/tests/compat/handlebars_get_test.js b/packages/ember-htmlbars/tests/compat/handlebars_get_test.js deleted file mode 100644 index f7773d45740..00000000000 --- a/packages/ember-htmlbars/tests/compat/handlebars_get_test.js +++ /dev/null @@ -1,120 +0,0 @@ -import Ember from 'ember-metal/core'; // Ember.lookup -import EmberView from 'ember-views/views/view'; -import handlebarsGet from 'ember-htmlbars/compat/handlebars-get'; -import { Registry } from 'ember-runtime/system/container'; -import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; -import HandlebarsCompatibleHelper from 'ember-htmlbars/compat/helper'; - -import EmberHandlebars from 'ember-htmlbars/compat'; - -var compile = EmberHandlebars.compile; - -var originalLookup = Ember.lookup; -var TemplateTests, registry, container, lookup, view; - -QUnit.module('ember-htmlbars: compat - Ember.Handlebars.get', { - setup() { - Ember.lookup = lookup = {}; - registry = new Registry(); - container = registry.container(); - registry.optionsForType('template', { instantiate: false }); - registry.register('view:toplevel', EmberView.extend()); - }, - - teardown() { - runDestroy(container); - runDestroy(view); - registry = container = view = null; - - Ember.lookup = lookup = originalLookup; - TemplateTests = null; - } -}); - -QUnit.test('it can lookup a path from the current context', function() { - expect(1); - - registry.register('helper:handlebars-get', new HandlebarsCompatibleHelper(function(path, options) { - var context = options.contexts && options.contexts[0] || this; - - ignoreDeprecation(function() { - equal(handlebarsGet(context, path, options), 'bar'); - }); - })); - - view = EmberView.create({ - container: container, - controller: { - foo: 'bar' - }, - template: compile('{{handlebars-get "foo"}}') - }); - - runAppend(view); -}); - -QUnit.test('it can lookup a path from the current keywords', function() { - expect(1); - - registry.register('helper:handlebars-get', new HandlebarsCompatibleHelper(function(path, options) { - var context = options.contexts && options.contexts[0] || this; - - ignoreDeprecation(function() { - equal(handlebarsGet(context, path, options), 'bar'); - }); - })); - - view = EmberView.create({ - container: container, - controller: { - foo: 'bar' - }, - template: compile('{{#with foo as |bar|}}{{handlebars-get "bar"}}{{/with}}') - }); - - runAppend(view); -}); - -QUnit.test('it can lookup a path from globals', function() { - expect(1); - - lookup.Blammo = { foo: 'blah' }; - - registry.register('helper:handlebars-get', new HandlebarsCompatibleHelper(function(path, options) { - var context = options.contexts && options.contexts[0] || this; - - ignoreDeprecation(function() { - equal(handlebarsGet(context, path, options), lookup.Blammo.foo); - }); - })); - - view = EmberView.create({ - container: container, - controller: { }, - template: compile('{{handlebars-get "Blammo.foo"}}') - }); - - runAppend(view); -}); - -QUnit.test('it raises a deprecation warning on use', function() { - expect(1); - - registry.register('helper:handlebars-get', new HandlebarsCompatibleHelper(function(path, options) { - var context = options.contexts && options.contexts[0] || this; - - expectDeprecation(function() { - handlebarsGet(context, path, options); - }, 'Usage of Ember.Handlebars.get is deprecated, use a Component or Ember.Handlebars.makeBoundHelper instead.'); - })); - - view = EmberView.create({ - container: container, - controller: { - foo: 'bar' - }, - template: compile('{{handlebars-get "foo"}}') - }); - - runAppend(view); -});