diff --git a/packages/ember-routing-htmlbars/lib/keywords/link-to.js b/packages/ember-routing-htmlbars/lib/keywords/link-to.js index 6db8fbc37a1..c1b45775e1b 100644 --- a/packages/ember-routing-htmlbars/lib/keywords/link-to.js +++ b/packages/ember-routing-htmlbars/lib/keywords/link-to.js @@ -78,10 +78,10 @@ import merge from "ember-metal/merge"; any passed value to `disabled` will disable it except `undefined`. to ensure that only `true` disable the `link-to` helper you can - override the global behaviour of `Ember.LinkView`. + override the global behaviour of `Ember.LinkComponent`. ```javascript - Ember.LinkView.reopen({ + Ember.LinkComponent.reopen({ disabled: Ember.computed(function(key, value) { if (value !== undefined) { this.set('_isDisabled', value === true); @@ -235,7 +235,7 @@ import merge from "ember-metal/merge"; ``` ### Overriding attributes - You can override any given property of the Ember.LinkView + You can override any given property of the Ember.LinkComponent that is generated by the `{{link-to}}` helper by passing key/value pairs, like so: @@ -245,18 +245,18 @@ import merge from "ember-metal/merge"; {{/link-to}} ``` - See [Ember.LinkView](/api/classes/Ember.LinkView.html) for a + See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a complete list of overrideable properties. Be sure to also - check out inherited properties of `LinkView`. + check out inherited properties of `LinkComponent`. ### Overriding Application-wide Defaults - ``{{link-to}}`` creates an instance of Ember.LinkView + ``{{link-to}}`` creates an instance of Ember.LinkComponent for rendering. To override options for your entire - application, reopen Ember.LinkView and supply the + application, reopen Ember.LinkComponent and supply the desired values: ``` javascript - Ember.LinkView.reopen({ + Ember.LinkComponent.reopen({ activeClass: "is-active", tagName: 'li' }) @@ -266,7 +266,7 @@ import merge from "ember-metal/merge"; this manner: ``` javascript - Ember.LinkView.reopen({ + Ember.LinkComponent.reopen({ eventName: 'customEventName' }); ``` @@ -275,9 +275,9 @@ import merge from "ember-metal/merge"; @for Ember.Handlebars.helpers @param {String} routeName @param {Object} [context]* - @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkView + @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent @return {String} HTML string - @see {Ember.LinkView} + @see {Ember.LinkComponent} @public */ export default { diff --git a/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js b/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js index ef5a695711c..8f6cd7feddd 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js @@ -8,15 +8,15 @@ import { Registry } from "ember-runtime/system/container"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; import EmberObject from "ember-runtime/system/object"; import ComponentLookup from "ember-views/component_lookup"; -import LinkView from "ember-routing-views/views/link"; +import LinkComponent from "ember-routing-views/views/link"; var view; var container; var registry = new Registry(); -// These tests don't rely on the routing service, but LinkView makes +// These tests don't rely on the routing service, but LinkComponent makes // some assumptions that it will exist. This small stub service ensures -// that the LinkView can render without raising an exception. +// that the LinkComponent can render without raising an exception. // // TODO: Add tests that test actual behavior. Currently, all behavior // is tested integration-style in the `ember` package. @@ -28,7 +28,7 @@ registry.register('service:-routing', EmberObject.extend({ })); registry.register('component-lookup:main', ComponentLookup); -registry.register('component:-link-to', LinkView); +registry.register('component:-link-to', LinkComponent); QUnit.module("ember-routing-htmlbars: link-to helper", { setup() { diff --git a/packages/ember-routing-views/lib/main.js b/packages/ember-routing-views/lib/main.js index a89a8ec3506..8bef8ad327d 100644 --- a/packages/ember-routing-views/lib/main.js +++ b/packages/ember-routing-views/lib/main.js @@ -5,13 +5,14 @@ import Ember from "ember-metal/core"; import isEnabled from "ember-metal/features"; -import LinkView from "ember-routing-views/views/link"; +import LinkComponent, { DeprecatedLinkView } from "ember-routing-views/views/link"; import { OutletView, CoreOutletView } from "ember-routing-views/views/outlet"; -Ember.LinkView = LinkView; +Ember.LinkView = DeprecatedLinkView; +Ember.LinkComponent = LinkComponent; Ember.OutletView = OutletView; if (isEnabled('ember-routing-core-outlet')) { Ember.CoreOutletView = CoreOutletView; diff --git a/packages/ember-routing-views/lib/views/link.js b/packages/ember-routing-views/lib/views/link.js index fd8f3134ca3..4964e5c5fa9 100644 --- a/packages/ember-routing-views/lib/views/link.js +++ b/packages/ember-routing-views/lib/views/link.js @@ -17,23 +17,23 @@ import ControllerMixin from "ember-runtime/mixins/controller"; import linkToTemplate from "ember-htmlbars/templates/link-to"; linkToTemplate.meta.revision = 'Ember@VERSION_STRING_PLACEHOLDER'; -var linkViewClassNameBindings = ['active', 'loading', 'disabled']; +var linkComponentClassNameBindings = ['active', 'loading', 'disabled']; if (isEnabled('ember-routing-transitioning-classes')) { - linkViewClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut']; + linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut']; } /** - `Ember.LinkView` renders an element whose `click` event triggers a + `Ember.LinkComponent` renders an element whose `click` event triggers a transition of the application's instance of `Ember.Router` to a supplied route by name. - Instances of `LinkView` will most likely be created through + Instances of `LinkComponent` will most likely be created through the `link-to` Handlebars helper, but properties of this class can be overridden to customize application-wide behavior. - @class LinkView + @class LinkComponent @namespace Ember - @extends Ember.View + @extends Ember.Component @see {Handlebars.helpers.link-to} @private **/ @@ -50,7 +50,7 @@ var LinkComponent = EmberComponent.extend({ currentWhen: null, /** - Used to determine when this LinkView is active. + Used to determine when this LinkComponent is active. @property currentWhen @private @@ -58,7 +58,7 @@ var LinkComponent = EmberComponent.extend({ 'current-when': null, /** - Sets the `title` attribute of the `LinkView`'s HTML element. + Sets the `title` attribute of the `LinkComponent`'s HTML element. @property title @default null @@ -67,7 +67,7 @@ var LinkComponent = EmberComponent.extend({ title: null, /** - Sets the `rel` attribute of the `LinkView`'s HTML element. + Sets the `rel` attribute of the `LinkComponent`'s HTML element. @property rel @default null @@ -76,7 +76,7 @@ var LinkComponent = EmberComponent.extend({ rel: null, /** - Sets the `tabindex` attribute of the `LinkView`'s HTML element. + Sets the `tabindex` attribute of the `LinkComponent`'s HTML element. @property tabindex @default null @@ -85,7 +85,7 @@ var LinkComponent = EmberComponent.extend({ tabindex: null, /** - Sets the `target` attribute of the `LinkView`'s HTML element. + Sets the `target` attribute of the `LinkComponent`'s HTML element. @since 1.8.0 @property target @@ -95,7 +95,7 @@ var LinkComponent = EmberComponent.extend({ target: null, /** - The CSS class to apply to `LinkView`'s element when its `active` + The CSS class to apply to `LinkComponent`'s element when its `active` property is `true`. @property activeClass @@ -106,7 +106,7 @@ var LinkComponent = EmberComponent.extend({ activeClass: 'active', /** - The CSS class to apply to `LinkView`'s element when its `loading` + The CSS class to apply to `LinkComponent`'s element when its `loading` property is `true`. @property loadingClass @@ -117,7 +117,7 @@ var LinkComponent = EmberComponent.extend({ loadingClass: 'loading', /** - The CSS class to apply to a `LinkView`'s element when its `disabled` + The CSS class to apply to a `LinkComponent`'s element when its `disabled` property is `true`. @property disabledClass @@ -129,7 +129,7 @@ var LinkComponent = EmberComponent.extend({ _isDisabled: false, /** - Determines whether the `LinkView` will trigger routing via + Determines whether the `LinkComponent` will trigger routing via the `replaceWith` routing strategy. @property replace @@ -160,7 +160,7 @@ var LinkComponent = EmberComponent.extend({ @default ['active', 'loading', 'disabled'] @private */ - classNameBindings: linkViewClassNameBindings, + classNameBindings: linkComponentClassNameBindings, /** By default the `{{link-to}}` helper responds to the `click` event. You @@ -181,7 +181,7 @@ var LinkComponent = EmberComponent.extend({ // section of the API documentation, which is where // people will likely go looking for it. /** - Triggers the `LinkView`'s routing behavior. If + Triggers the `LinkComponent`'s routing behavior. If `eventName` is changed to a value other than `click` the routing behavior will trigger on that custom event instead. @@ -191,12 +191,12 @@ var LinkComponent = EmberComponent.extend({ */ /** - An overridable method called when LinkView objects are instantiated. + An overridable method called when LinkComponent objects are instantiated. Example: ```javascript - App.MyLinkView = Ember.LinkView.extend({ + App.MyLinkComponent = Ember.LinkComponent.extend({ init: function() { this._super.apply(this, arguments); Ember.Logger.log('Event is ' + this.get('eventName')); @@ -226,7 +226,7 @@ var LinkComponent = EmberComponent.extend({ _routing: inject.service('-routing'), /** - Accessed as a classname binding to apply the `LinkView`'s `disabledClass` + Accessed as a classname binding to apply the `LinkComponent`'s `disabledClass` CSS `class` to the element when the link is disabled. When `true` interactions with the element will not trigger route changes. @@ -245,11 +245,11 @@ var LinkComponent = EmberComponent.extend({ }), /** - Accessed as a classname binding to apply the `LinkView`'s `activeClass` + Accessed as a classname binding to apply the `LinkComponent`'s `activeClass` CSS `class` to the element when the link is active. - A `LinkView` is considered active when its `currentWhen` property is `true` - or the application's current route is the route the `LinkView` would trigger + A `LinkComponent` is considered active when its `currentWhen` 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 @@ -258,7 +258,7 @@ var LinkComponent = EmberComponent.extend({ @property active @private */ - active: computed('attrs.params', '_routing.currentState', function computeLinkViewActive() { + active: computed('attrs.params', '_routing.currentState', function computeLinkComponentActive() { var currentState = get(this, '_routing.currentState'); return computeActive(this, currentState); }), @@ -330,15 +330,15 @@ var LinkComponent = EmberComponent.extend({ /** Sets the element's `href` attribute to the url for - the `LinkView`'s targeted route. + the `LinkComponent`'s targeted route. - If the `LinkView`'s `tagName` is changed to a value other + If the `LinkComponent`'s `tagName` is changed to a value other than `a`, this property will be ignored. @property href @private */ - href: computed('models', 'targetRouteName', '_routing.currentState', function computeLinkViewHref() { + href: computed('models', 'targetRouteName', '_routing.currentState', function computeLinkComponentHref() { if (get(this, 'tagName') !== 'a') { return; } @@ -504,4 +504,20 @@ function getResolvedQueryParams(queryParamsObject, targetRouteName) { return resolvedQueryParams; } +/* DeprecatedLinkView - Start: TODO: Delete in Ember 2.0 */ +var DeprecatedLinkView = LinkComponent.extend({ + init() { + Ember.deprecate('Ember.LinkView is deprecated. Please use Ember.LinkComponent.', false); + this._super.apply(this, arguments); + } +}); +var originalReopen = DeprecatedLinkView.reopen; + +DeprecatedLinkView.reopen = function reopenWithDeprecation() { + Ember.deprecate('Ember.LinkView is deprecated. Please use Ember.LinkComponent.', false); + originalReopen.apply(this, arguments); +}; +export { DeprecatedLinkView }; +/* DeprecatedLinkView - End*/ + export default LinkComponent; diff --git a/packages/ember-routing-views/tests/main_test.js b/packages/ember-routing-views/tests/main_test.js index 5f546412580..0b335daf33a 100644 --- a/packages/ember-routing-views/tests/main_test.js +++ b/packages/ember-routing-views/tests/main_test.js @@ -3,6 +3,16 @@ import Ember from 'ember-routing-views'; QUnit.module("ember-routing-views"); QUnit.test("exports correctly", function() { - ok(Ember.LinkView, "LinkView is exported correctly"); + ok(Ember.LinkComponent, "LinkComponent is exported correctly"); ok(Ember.OutletView, "OutletView is exported correctly"); }); + +QUnit.test("Ember.LinkView throws a deprecation warning when instantiated", function() { + expectDeprecation(/Ember.LinkView is deprecated. Please use Ember.LinkComponent/); + Ember.LinkView.create(); +}); + +QUnit.test("Ember.LinkView throws a deprecation warning when reopened", function() { + expectDeprecation(/Ember.LinkView is deprecated. Please use Ember.LinkComponent/); + Ember.LinkView.reopen({}); +}); diff --git a/packages/ember-routing/lib/services/routing.js b/packages/ember-routing/lib/services/routing.js index cfdfc97777f..5572cb61169 100644 --- a/packages/ember-routing/lib/services/routing.js +++ b/packages/ember-routing/lib/services/routing.js @@ -12,7 +12,7 @@ import keys from "ember-metal/keys"; import merge from "ember-metal/merge"; /** - The Routing service is used by LinkView, and provides facilities for + The Routing service is used by LinkComponent, and provides facilities for the component/view layer to interact with the router. While still private, this service can eventually be opened up, and provides diff --git a/packages/ember/tests/helpers/link_to_test.js b/packages/ember/tests/helpers/link_to_test.js index 834c46d842a..6cceba9dd68 100644 --- a/packages/ember/tests/helpers/link_to_test.js +++ b/packages/ember/tests/helpers/link_to_test.js @@ -754,10 +754,10 @@ QUnit.test("link-to with null/undefined dynamic parameters are put in a loading function assertLinkStatus($link, url) { if (url) { equal(normalizeUrl($link.attr('href')), url, "loaded link-to has expected href"); - ok(!$link.hasClass('i-am-loading'), "loaded linkView has no loadingClass"); + ok(!$link.hasClass('i-am-loading'), "loaded linkComponent has no loadingClass"); } else { equal(normalizeUrl($link.attr('href')), '#', "unloaded link-to has href='#'"); - ok($link.hasClass('i-am-loading'), "loading linkView has loadingClass"); + ok($link.hasClass('i-am-loading'), "loading linkComponent has loadingClass"); } }