Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP beta] Removed deprecated currentWhen of LinkComponent #11793

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions packages/ember-routing-views/lib/views/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(' ');
Expand Down
6 changes: 0 additions & 6 deletions packages/ember-routing-views/tests/main_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
24 changes: 0 additions & 24 deletions packages/ember/tests/helpers/link_to_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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('<h3>Home</h3>{{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() {
Expand Down