Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix Ember.setPath when used on Ember.Namespaces
  • Loading branch information
ebryn committed Jun 7, 2012
1 parent 63a3215 commit 7049d29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/accessors.js
Expand Up @@ -248,7 +248,7 @@ Ember.getPath = function(root, path) {
Ember.setPath = function(root, path, value, tolerant) {
var keyName;

if (IS_GLOBAL.test(root)) {
if (typeof root === 'string' && IS_GLOBAL.test(root)) {
value = path;
path = root;
root = null;
Expand Down
7 changes: 7 additions & 0 deletions packages/ember-metal/tests/accessors/setPath_test.js
Expand Up @@ -38,6 +38,13 @@ var obj, moduleOpts = {

module('Ember.setPath', moduleOpts);

test('[Foo, bar] -> Foo.bar', function() {
window.Foo = {toString: function() { return 'Foo'; }}; // Behave like an Ember.Namespace
Ember.setPath(Foo, 'bar', 'baz');
equal(Ember.getPath(Foo, 'bar'), 'baz');
delete window.Foo;

This comment has been minimized.

Copy link
@krisselden

krisselden Jun 7, 2012

Member

delete window.Foo doesn't work in IE

});

// ..........................................................
// LOCAL PATHS
//
Expand Down

0 comments on commit 7049d29

Please sign in to comment.