Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/ember-application/lib/system/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Ember.Application = Ember.Namespace.extend(
router.get('postsController') // <App.PostsController:ember1234>
router.get('commentsController') // <App.CommentsController:ember1235>

router.getPath('postsController.router') // router
router.get('postsController.router') // router
*/
initialize: function(router) {
var properties = Ember.A(Ember.keys(this)),
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-application/tests/system/action_url_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test("it sets an URL with a context", function() {
router.route("/");
});

equal(router.getPath('currentState.path'), "root.index", "precond - the current stat is root.index");
equal(router.get('currentState.path'), "root.index", "precond - the current stat is root.index");

var view = Ember.View.create({
template: compile('<a {{action showDashboard context="controller.component" href=true}}>test</a>')
Expand Down
28 changes: 14 additions & 14 deletions packages/ember-application/tests/system/application_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

var view;
var application;
var set = Ember.set, get = Ember.get, getPath = Ember.getPath;
var set = Ember.set, get = Ember.get;

module("Ember.Application", {
setup: function() {
Expand Down Expand Up @@ -112,10 +112,10 @@ test("initialize controllers into a state manager", function() {
ok(get(stateManager, 'barController') instanceof app.BarController, "barController was assigned");
ok(get(stateManager, 'foo') === undefined, "foo was not assigned");

equal(getPath(stateManager, 'fooController.target'), stateManager, "the state manager is assigned");
equal(getPath(stateManager, 'barController.target'), stateManager, "the state manager is assigned");
equal(getPath(stateManager, 'fooController.namespace'), app, "the namespace is assigned");
equal(getPath(stateManager, 'fooController.namespace'), app, "the namespace is assigned");
equal(get(stateManager, 'fooController.target'), stateManager, "the state manager is assigned");
equal(get(stateManager, 'barController.target'), stateManager, "the state manager is assigned");
equal(get(stateManager, 'fooController.namespace'), app, "the namespace is assigned");
equal(get(stateManager, 'fooController.namespace'), app, "the namespace is assigned");
});

test('initialized application go to initial route', function() {
Expand Down Expand Up @@ -150,7 +150,7 @@ test('initialized application go to initial route', function() {
app.initialize(app.stateManager);
});

equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
equal(app.get('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("initialize application with stateManager via initialize call", function() {
Expand Down Expand Up @@ -178,9 +178,9 @@ test("initialize application with stateManager via initialize call", function()
app.initialize(app.Router.create());
});

equal(app.getPath('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('router.location') instanceof Ember.NoneLocation, true, "Location was set from location implementation name");
equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
equal(app.get('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.get('router.location') instanceof Ember.NoneLocation, true, "Location was set from location implementation name");
equal(app.get('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("initialize application with stateManager via initialize call from Router class", function() {
Expand Down Expand Up @@ -208,8 +208,8 @@ test("initialize application with stateManager via initialize call from Router c
app.initialize();
});

equal(app.getPath('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.getPath('router.currentState.path'), 'root.index', "The router moved the state into the right place");
equal(app.get('router') instanceof Ember.Router, true, "Router was set from initialize call");
equal(app.get('router.currentState.path'), 'root.index', "The router moved the state into the right place");
});

test("injections can be registered in a specified order", function() {
Expand Down Expand Up @@ -329,7 +329,7 @@ test("ControllerObject class can be initialized with target, controllers and vie
stateManager.get('postController').set('view', Ember.View.create());
});

equal(app.getPath('router.postController.target') instanceof Ember.StateManager, true, "controller has target");
equal(app.getPath('router.postController.controllers') instanceof Ember.StateManager, true, "controller has controllers");
equal(app.getPath('router.postController.view') instanceof Ember.View, true, "controller has view");
equal(app.get('router.postController.target') instanceof Ember.StateManager, true, "controller has target");
equal(app.get('router.postController.controllers') instanceof Ember.StateManager, true, "controller has controllers");
equal(app.get('router.postController.view') instanceof Ember.View, true, "controller has view");
});
18 changes: 9 additions & 9 deletions packages/ember-handlebars/lib/controls/select.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*jshint eqeqeq:false */

var set = Ember.set, get = Ember.get, getPath = Ember.getPath;
var set = Ember.set, get = Ember.get;
var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.indexesOf;

/**
Expand Down Expand Up @@ -152,7 +152,7 @@ Ember.Select = Ember.View.extend(
if (arguments.length === 2) { return value; }

var valuePath = get(this, 'optionValuePath').replace(/^content\.?/, '');
return valuePath ? getPath(this, 'selection.' + valuePath) : get(this, 'selection');
return valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection');
}).property('selection').cacheable(),

/**
Expand Down Expand Up @@ -206,7 +206,7 @@ Ember.Select = Ember.View.extend(
var content = get(this, 'content'),
value = get(this, 'value'),
valuePath = get(this, 'optionValuePath').replace(/^content\.?/, ''),
selectedValue = (valuePath ? getPath(this, 'selection.' + valuePath) : get(this, 'selection')),
selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection')),
selection;

if (value !== selectedValue) {
Expand Down Expand Up @@ -307,8 +307,8 @@ Ember.SelectOption = Ember.View.extend({

selected: Ember.computed(function() {
var content = get(this, 'content'),
selection = getPath(this, 'parentView.selection');
if (getPath(this, 'parentView.multiple')) {
selection = get(this, 'parentView.selection');
if (get(this, 'parentView.multiple')) {
return selection && indexOf(selection, content) > -1;
} else {
// Primitives get passed through bindings as objects... since
Expand All @@ -318,22 +318,22 @@ Ember.SelectOption = Ember.View.extend({
}).property('content', 'parentView.selection').volatile(),

labelPathDidChange: Ember.observer(function() {
var labelPath = getPath(this, 'parentView.optionLabelPath');
var labelPath = get(this, 'parentView.optionLabelPath');

if (!labelPath) { return; }

Ember.defineProperty(this, 'label', Ember.computed(function() {
return getPath(this, labelPath);
return get(this, labelPath);
}).property(labelPath).cacheable());
}, 'parentView.optionLabelPath'),

valuePathDidChange: Ember.observer(function() {
var valuePath = getPath(this, 'parentView.optionValuePath');
var valuePath = get(this, 'parentView.optionValuePath');

if (!valuePath) { return; }

Ember.defineProperty(this, 'value', Ember.computed(function() {
return getPath(this, valuePath);
return get(this, valuePath);
}).property(valuePath).cacheable());
}, 'parentView.optionValuePath')
});
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-handlebars/lib/controls/tabs/tab_pane_view.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
var get = Ember.get, getPath = Ember.getPath;
var get = Ember.get;

Ember.TabPaneView = Ember.View.extend({
tabsContainer: Ember.computed(function() {
return this.nearestInstanceOf(Ember.TabContainerView);
}).property().volatile(),

isVisible: Ember.computed(function() {
return get(this, 'viewName') === getPath(this, 'tabsContainer.currentView');
return get(this, 'viewName') === get(this, 'tabsContainer.currentView');
}).property('tabsContainer.currentView').volatile(),

init: function() {
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-handlebars/lib/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ Ember.Handlebars.getPath = function(root, path, options) {
root = normalizedPath.root;
path = normalizedPath.path;

value = Ember.getPath(root, path);
value = Ember.get(root, path);

if (value === undefined && root !== window && Ember.isGlobalPath(path)) {
value = Ember.getPath(window, path);
value = Ember.get(window, path);
}
return value;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-handlebars/lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
// Users can optionally specify a custom view subclass to use by setting the
// data-view attribute of the script tag.
viewPath = script.attr('data-view');
view = viewPath ? Ember.getPath(viewPath) : Ember.View;
view = viewPath ? Ember.get(viewPath) : Ember.View;

// Get the id of the script, used by Ember.View's elementId property,
// Look for data-element-id attribute.
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-handlebars/lib/views/metamorph_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require("metamorph");
require("ember-views/views/view");

var set = Ember.set, get = Ember.get, getPath = Ember.getPath;
var set = Ember.set, get = Ember.get;

var DOMManager = {
remove: function(view) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-handlebars/tests/controls/select_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function append() {

function selectedOptions() {
var rv = [];
for(var i=0, len = select.getPath('content.length'); i < len; ++i) {
rv.push(select.getPath('childViews.' + i + '.childViews.0.selected'));
for(var i=0, len = select.get('content.length'); i < len; ++i) {
rv.push(select.get('childViews.' + i + '.childViews.0.selected'));
}
return rv;
}
Expand Down
26 changes: 13 additions & 13 deletions packages/ember-handlebars/tests/handlebars_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ==========================================================================
/*globals TemplateTests:true MyApp:true App:true */

var getPath = Ember.getPath, setPath = Ember.setPath, get = Ember.get, set = Ember.set;
var get = Ember.get, set = Ember.set;
var forEach = Ember.EnumerableUtils.forEach;

var firstGrandchild = function(view) {
Expand Down Expand Up @@ -456,11 +456,11 @@ test("should not update when a property is removed from the view", function() {
equal(view.$('#first').text(), 'ninjas', "updates to new content value");

Ember.run(function() {
setPath(oldContent, 'foo.baz', 'rockstars');
set(oldContent, 'foo.baz', 'rockstars');
});

Ember.run(function() {
setPath(oldContent, 'foo.baz', 'ewoks');
set(oldContent, 'foo.baz', 'ewoks');
});

equal(view.$('#first').text(), "ninjas", "does not update removed object");
Expand Down Expand Up @@ -511,7 +511,7 @@ test("Handlebars templates update properties if a content object changes", funct
equal(view.$('#price').text(), "$5.50", "should update price field when content changes");

Ember.run(function() {
setPath(view, 'coffee.price', "$5");
set(view, 'coffee.price', "$5");
});

equal(view.$('#price').text(), "$5", "should update price field when price property is changed");
Expand Down Expand Up @@ -542,7 +542,7 @@ test("Template updates correctly if a path is passed to the bind helper", functi
equal(view.$('h1').text(), "$4", "precond - renders price");

Ember.run(function() {
setPath(view, 'coffee.price', "$5");
set(view, 'coffee.price', "$5");
});

equal(view.$('h1').text(), "$5", "updates when property changes");
Expand Down Expand Up @@ -751,7 +751,7 @@ test("Template views add an elementId to child views created using the view help
});

appendView();
var childView = getPath(view, 'childViews.firstObject');
var childView = get(view, 'childViews.firstObject');
equal(view.$().children().first().children().first().attr('id'), get(childView, 'elementId'));
});

Expand Down Expand Up @@ -1021,13 +1021,13 @@ test("should update boundIf blocks if the conditional changes", function() {
equal(view.$('#first').text(), "bam", "renders block when condition is true");

Ember.run(function() {
setPath(get(view, 'content'), 'myApp.isEnabled', false);
set(get(view, 'content'), 'myApp.isEnabled', false);
});

equal(view.$('#first').text(), "", "re-renders without block when condition is false");

Ember.run(function() {
setPath(get(view, 'content'), 'myApp.isEnabled', true);
set(get(view, 'content'), 'myApp.isEnabled', true);
});

equal(view.$('#first').text(), "bam", "re-renders block when condition changes to true");
Expand Down Expand Up @@ -1317,7 +1317,7 @@ test("should be able to bind element attributes using {{bindAttr}}", function()
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");

Ember.run(function() {
setPath(view, 'content.title', "El logo de Eember");
set(view, 'content.title', "El logo de Eember");
});

equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
Expand Down Expand Up @@ -1419,7 +1419,7 @@ test("should be able to bind use {{bindAttr}} more than once on an element", fun
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");

Ember.run(function() {
setPath(view, 'content.title', "El logo de Eember");
set(view, 'content.title', "El logo de Eember");
});

equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
Expand Down Expand Up @@ -1495,7 +1495,7 @@ test("should be able to bind element attributes using {{bindAttr}} inside a bloc
equal(view.$('img').attr('alt'), "The SproutCore Logo", "sets alt attribute");

Ember.run(function() {
setPath(view, 'content.title', "El logo de Eember");
set(view, 'content.title', "El logo de Eember");
});

equal(view.$('img').attr('alt'), "El logo de Eember", "updates alt attribute when content's title attribute changes");
Expand Down Expand Up @@ -1844,7 +1844,7 @@ test("should expose a controller keyword that persists through Ember.ContainerVi
view.appendTo("#qunit-fixture");
});

var containerView = getPath(view, 'childViews.firstObject');
var containerView = get(view, 'childViews.firstObject');
var viewInstanceToBeInserted = Ember.View.create({
template: Ember.Handlebars.compile('{{controller.foo}}')
});
Expand Down Expand Up @@ -1983,7 +1983,7 @@ test("should be able to update when bound property updates", function(){
template: Ember.Handlebars.compile('<i>{{value.name}}, {{computed}}</i>'),
valueBinding: 'MyApp.controller',
computed: Ember.computed(function(){
return this.getPath('value.name') + ' - computed';
return this.get('value.name') + ' - computed';
}).property('value').volatile()
});

Expand Down
8 changes: 4 additions & 4 deletions packages/ember-handlebars/tests/helpers/with_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test("updating the context should update the alias", function() {

test("updating a property on the context should update the HTML", function() {
Ember.run(function() {
Ember.setPath(view, 'person.name', "Yehuda Katz");
Ember.set(view, 'person.name', "Yehuda Katz");
});

equal(view.$().text(), "Señor Engineer: Yehuda Katz", "should be properly scoped after updating");
Expand Down Expand Up @@ -94,7 +94,7 @@ test("it should support #with view as foo", function() {
equal(view.$().text(), "Sonics", "should be properly scoped");

Ember.run(function() {
Ember.setPath(view, 'name', "Thunder");
Ember.set(view, 'name', "Thunder");
});

equal(view.$().text(), "Thunder", "should update");
Expand All @@ -110,7 +110,7 @@ test("it should support #with foo as bar, then #with bar as qux", function() {
equal(view.$().text(), "caterpillar", "should be properly scoped");

Ember.run(function() {
Ember.setPath(view, 'name', "butterfly");
Ember.set(view, 'name', "butterfly");
});

equal(view.$().text(), "butterfly", "should update");
Expand All @@ -129,7 +129,7 @@ if (Ember.VIEW_PRESERVES_CONTEXT) {
equal(view.$().text(), "Los Pivots", "should be properly scoped");

Ember.run(function() {
Ember.setPath(view, 'controller.name', "l'Pivots");
Ember.set(view, 'controller.name', "l'Pivots");
});

equal(view.$().text(), "l'Pivots", "should update");
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-handlebars/tests/helpers/yield_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ==========================================================================
/*global TemplateTests*/

var set = Ember.set, get = Ember.get, setPath = Ember.setPath, getPath = Ember.getPath;
var set = Ember.set, get = Ember.get;

var view;

Expand Down
4 changes: 2 additions & 2 deletions packages/ember-handlebars/tests/views/collection_view_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ==========================================================================
/*globals TemplateTests:true App:true */

var set = Ember.set, get = Ember.get, setPath = Ember.setPath;
var set = Ember.set, get = Ember.get;
var firstGrandchild = function(view) {
return get(get(view, 'childViews').objectAt(0), 'childViews').objectAt(0);
};
Expand Down Expand Up @@ -286,7 +286,7 @@ test("should give its item views the property specified by itemPropertyBinding",
});

Ember.run(function() {
setPath(view, 'baz', "yobaz");
set(view, 'baz', "yobaz");
});

equal(view.$('ul li:first').text(), "yobaz", "change property of sub view");
Expand Down
Loading