From 6f06a13f65a9a9b394994793f29bd7cf96381fcb Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Wed, 29 Nov 2017 20:15:02 +0000 Subject: [PATCH] Remove this.resource from RouterDSL --- packages/ember-routing/lib/system/dsl.js | 11 ------- .../ember-routing/tests/system/dsl_test.js | 33 +------------------ 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/packages/ember-routing/lib/system/dsl.js b/packages/ember-routing/lib/system/dsl.js index d4939c68fb2..319f8cef0ee 100644 --- a/packages/ember-routing/lib/system/dsl.js +++ b/packages/ember-routing/lib/system/dsl.js @@ -66,17 +66,6 @@ class DSL { this.matches.push(url, name, callback); } - resource(name, options = {}, callback) { - if (arguments.length === 2 && typeof options === 'function') { - callback = options; - options = {}; - } - - options.resetNamespace = true; - deprecate('this.resource() is deprecated. Use this.route(\'name\', { resetNamespace: true }, function () {}) instead.', false, { id: 'ember-routing.router-resource', until: '3.0.0' }); - this.route(name, options, callback); - } - generate() { let dslMatches = this.matches; diff --git a/packages/ember-routing/tests/system/dsl_test.js b/packages/ember-routing/tests/system/dsl_test.js index db9b2c6fb0d..d109202fbee 100644 --- a/packages/ember-routing/tests/system/dsl_test.js +++ b/packages/ember-routing/tests/system/dsl_test.js @@ -18,10 +18,9 @@ QUnit.module('Ember Router DSL', { }); QUnit.test('should fail when using a reserved route name', function() { - expectDeprecation('this.resource() is deprecated. Use this.route(\'name\', { resetNamespace: true }, function () {}) instead.'); let reservedNames = ['array', 'basic', 'object', 'application']; - expect((reservedNames.length * 2) + 1); + expect(reservedNames.length); reservedNames.forEach(reservedName => { expectAssertion(() => { @@ -34,37 +33,7 @@ QUnit.test('should fail when using a reserved route name', function() { let router = Router.create(); router._initRouterJs(); }, '\'' + reservedName + '\' cannot be used as a route name.'); - - expectAssertion(() => { - Router = EmberRouter.extend(); - - Router.map(function() { - this.resource(reservedName); - }); - - let router = Router.create(); - router._initRouterJs(); - }, `'${reservedName}' cannot be used as a route name.`); - }); -}); - -QUnit.test('should reset namespace if nested with resource', function() { - expectDeprecation('this.resource() is deprecated. Use this.route(\'name\', { resetNamespace: true }, function () {}) instead.'); - - Router = Router.map(function() { - this.resource('bleep', function() { - this.resource('bloop', function() { - this.resource('blork'); - }); - }); }); - - let router = Router.create(); - router._initRouterJs(); - - ok(router._routerMicrolib.recognizer.names['bleep'], 'nested resources do not contain parent name'); - ok(router._routerMicrolib.recognizer.names['bloop'], 'nested resources do not contain parent name'); - ok(router._routerMicrolib.recognizer.names['blork'], 'nested resources do not contain parent name'); }); QUnit.test('should retain resource namespace if nested with routes', function() {