From 04980d7a1c388be952ed719faa5d93e59db27f18 Mon Sep 17 00:00:00 2001 From: Craig Teegarden Date: Thu, 26 Mar 2015 19:00:38 -0400 Subject: [PATCH] [BUGFIX beta] fix broken query params on ObjectController fixes #10733 --- .../lib/controllers/object_controller.js | 1 + .../ember/tests/routing/query_params_test.js | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/ember-runtime/lib/controllers/object_controller.js b/packages/ember-runtime/lib/controllers/object_controller.js index 9dc9e508c42..dc0ffa36167 100644 --- a/packages/ember-runtime/lib/controllers/object_controller.js +++ b/packages/ember-runtime/lib/controllers/object_controller.js @@ -26,6 +26,7 @@ export var objectControllerDeprecation = 'Ember.ObjectController is deprecated, **/ export default ObjectProxy.extend(ControllerMixin, { init() { + this._super(); Ember.deprecate(objectControllerDeprecation, this.isGenerated); } }); diff --git a/packages/ember/tests/routing/query_params_test.js b/packages/ember/tests/routing/query_params_test.js index 45b48aa6b3f..09fcb222817 100644 --- a/packages/ember/tests/routing/query_params_test.js +++ b/packages/ember/tests/routing/query_params_test.js @@ -120,6 +120,30 @@ QUnit.module("Routing w/ Query Params", { } }); +QUnit.test("Single query params can be set on ObjectController [DEPRECATED]", function() { + expectDeprecation("Ember.ObjectController is deprecated, please use Ember.Controller and use `model.propertyName`."); + + Router.map(function() { + this.route("home", { path: '/' }); + }); + + App.HomeController = Ember.ObjectController.extend({ + queryParams: ['foo'], + foo: "123" + }); + + bootApplication(); + + var controller = container.lookup('controller:home'); + + setAndFlush(controller, 'foo', '456'); + + equal(router.get('location.path'), "/?foo=456"); + + setAndFlush(controller, 'foo', '987'); + equal(router.get('location.path'), "/?foo=987"); +}); + QUnit.test("Single query params can be set", function() { Router.map(function() { this.route("home", { path: '/' });