From 0e16c9e0cd0a53d1a6c3a6fc8abd57c8e1a7a7f8 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 31 Jan 2014 15:14:33 -0500 Subject: [PATCH] [BUGFIX beta] Deprecate quoteless action names. This is preparation for enabling the `ember-routing-bound-action-name` feature. --- packages/ember-routing/lib/helpers/action.js | 4 +++ .../tests/helpers/action_test.js | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/packages/ember-routing/lib/helpers/action.js b/packages/ember-routing/lib/helpers/action.js index 37770beb027..dc7101a8ef3 100644 --- a/packages/ember-routing/lib/helpers/action.js +++ b/packages/ember-routing/lib/helpers/action.js @@ -94,6 +94,10 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { actionName = actionNameOrPath; } } + } else { + if (options.boundProperty) { + Ember.deprecate("Using a quoteless parameter with {{action}} is deprecated. Please update to quoted usage '{{action \"" + actionNameOrPath + "\"}}.", false); + } } if (!actionName) { diff --git a/packages/ember-routing/tests/helpers/action_test.js b/packages/ember-routing/tests/helpers/action_test.js index 97b7667d537..7f634ce4b92 100644 --- a/packages/ember-routing/tests/helpers/action_test.js +++ b/packages/ember-routing/tests/helpers/action_test.js @@ -843,6 +843,37 @@ if (Ember.FEATURES.isEnabled("ember-routing-bound-action-name")) { Ember.assert = oldAssert; }); +} else { + test("a quoteless parameter as an action name", function(){ + expect(2); + + expectDeprecation("Using a quoteless parameter with {{action}} is deprecated. Please update to quoted usage '{{action \"ohNoeNotValid\"}}."); + + var triggeredAction; + + view = Ember.View.create({ + template: compile("Hi") + }); + + var controller = Ember.Controller.extend({ + actions: { + ohNoeNotValid: function() { + triggeredAction = true; + } + } + }).create(); + + Ember.run(function() { + view.set('controller', controller); + view.appendTo('#qunit-fixture'); + }); + + Ember.run(function(){ + view.$("#oops-bound-param").click(); + }); + + ok(triggeredAction, 'the action was triggered'); + }); } module("Ember.Handlebars - action helper - deprecated invoking directly on target", {