From 83ff1c740f62d86b03469e6a95679069e44c19b6 Mon Sep 17 00:00:00 2001 From: Miguel Camba Date: Fri, 17 Jul 2015 15:01:34 +0100 Subject: [PATCH] [CLEANUP beta] Removed deprecated currentWhen of LinkComponent Use `current-when` instead --- .../ember-routing-views/lib/views/link.js | 17 ++++--------- .../ember-routing-views/tests/main_test.js | 6 ----- packages/ember/tests/helpers/link_to_test.js | 24 ------------------- 3 files changed, 4 insertions(+), 43 deletions(-) diff --git a/packages/ember-routing-views/lib/views/link.js b/packages/ember-routing-views/lib/views/link.js index 825498e2c34..18eb87d717a 100644 --- a/packages/ember-routing-views/lib/views/link.js +++ b/packages/ember-routing-views/lib/views/link.js @@ -9,7 +9,6 @@ import isEnabled from 'ember-metal/features'; import { get } from 'ember-metal/property_get'; import { set } from 'ember-metal/property_set'; import { computed } from 'ember-metal/computed'; -import { deprecatingAlias } from 'ember-metal/computed_macros'; import { isSimpleClick } from 'ember-views/system/utils'; import EmberComponent from 'ember-views/views/component'; import inject from 'ember-runtime/inject'; @@ -43,17 +42,10 @@ var LinkComponent = EmberComponent.extend({ tagName: 'a', - /** - @deprecated Use current-when instead. - @property currentWhen - @private - */ - currentWhen: deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }), - /** Used to determine when this LinkComponent is active. - @property currentWhen + @property current-when @private */ 'current-when': null, @@ -247,11 +239,11 @@ var LinkComponent = EmberComponent.extend({ Accessed as a classname binding to apply the `LinkComponent`'s `activeClass` CSS `class` to the element when the link is active. - A `LinkComponent` is considered active when its `currentWhen` property is `true` + A `LinkComponent` is considered active when its `current-when` property is `true` or the application's current route is the route the `LinkComponent` would trigger transitions into. - The `currentWhen` property can match against multiple routes by separating + The `current-when` property can match against multiple routes by separating route names using the ` ` (space) character. @property active @@ -466,8 +458,7 @@ LinkComponent.toString = function() { return 'LinkComponent'; }; function computeActive(view, routerState) { if (get(view, 'loading')) { return false; } - - var currentWhen = get(view, 'current-when'); + var currentWhen = get(view, 'attrs.current-when'); var isCurrentWhenSpecified = !!currentWhen; currentWhen = currentWhen || get(view, 'targetRouteName'); currentWhen = currentWhen.split(' '); diff --git a/packages/ember-routing-views/tests/main_test.js b/packages/ember-routing-views/tests/main_test.js index bf16f8ddc3f..74635975a0d 100644 --- a/packages/ember-routing-views/tests/main_test.js +++ b/packages/ember-routing-views/tests/main_test.js @@ -6,9 +6,3 @@ QUnit.test('exports correctly', function() { ok(Ember.LinkComponent, 'LinkComponent is exported correctly'); ok(Ember.OutletView, 'OutletView is exported correctly'); }); - -QUnit.test('`LinkComponent#currentWhen` is deprecated in favour of `current-when` (DEPRECATED)', function() { - expectDeprecation(/Usage of `currentWhen` is deprecated, use `current-when` instead/); - var link = Ember.LinkComponent.create(); - link.get('currentWhen'); -}); diff --git a/packages/ember/tests/helpers/link_to_test.js b/packages/ember/tests/helpers/link_to_test.js index 02553b01bdc..5f98075447a 100644 --- a/packages/ember/tests/helpers/link_to_test.js +++ b/packages/ember/tests/helpers/link_to_test.js @@ -196,7 +196,6 @@ QUnit.test('the {{link-to}} helper doesn\'t add an href when the tagName isn\'t equal(Ember.$('#about-link').attr('href'), undefined, 'there is no href attribute'); }); - QUnit.test('the {{link-to}} applies a \'disabled\' class when disabled', function () { Ember.TEMPLATES.index = compile('{{#link-to "about" id="about-link" disabledWhen="shouldDisable"}}About{{/link-to}}'); App.IndexController = Ember.Controller.extend({ @@ -304,29 +303,6 @@ QUnit.test('The {{link-to}} helper supports leaving off .index for nested routes equal(normalizeUrl(Ember.$('#item a', '#qunit-fixture').attr('href')), '/about'); }); -QUnit.test('The {{link-to}} helper supports currentWhen (DEPRECATED)', function() { - expectDeprecation('Usage of `currentWhen` is deprecated, use `current-when` instead.'); - - Router.map(function(match) { - this.route('index', { path: '/' }, function() { - this.route('about'); - }); - - this.route('item'); - }); - - Ember.TEMPLATES.index = compile('

Home

{{outlet}}'); - Ember.TEMPLATES['index/about'] = compile('{{#link-to \'item\' id=\'other-link\' currentWhen=\'index\'}}ITEM{{/link-to}}'); - - bootApplication(); - - Ember.run(function() { - router.handleURL('/about'); - }); - - equal(Ember.$('#other-link.active', '#qunit-fixture').length, 1, 'The link is active since current-when is a parent route'); -}); - QUnit.test('The {{link-to}} helper supports custom, nested, current-when', function() { Router.map(function(match) { this.route('index', { path: '/' }, function() {