Permalink
Browse files

Remove * as a valid name

  • Loading branch information...
wycats committed May 30, 2012
1 parent 9eb3c66 commit 50d66622e551d0b98dcce80d12a9a8cd0541a873
@@ -145,7 +145,7 @@ function getPath(target, path) {
next = path.indexOf('.', idx);
if (next<0) next = len;
key = path.slice(idx, next);
target = key==='*' ? target : get(target, key);
target = get(target, key);
if (target && target.isDestroyed) { return undefined; }
@@ -46,22 +46,10 @@ test('[obj, foo] -> obj.foo', function() {
deepEqual(Ember.getPath(obj, 'foo'), obj.foo);
});
test('[obj, *] -> obj', function() {
deepEqual(Ember.getPath(obj, '*'), obj);
});
test('[obj, foo.bar] -> obj.foo.bar', function() {
deepEqual(Ember.getPath(obj, 'foo.bar'), obj.foo.bar);
});
test('[obj, foo.*] -> obj.foo', function() {
deepEqual(Ember.getPath(obj, 'foo.*'), obj.foo);
});
test('[obj, foo.*.baz] -> obj.foo.baz', function() {
deepEqual(Ember.getPath(obj, 'foo.*.baz'), obj.foo.baz);
});
test('[obj, this.foo] -> obj.foo', function() {
deepEqual(Ember.getPath(obj, 'this.foo'), obj.foo);
});
@@ -70,10 +58,6 @@ test('[obj, this.foo.bar] -> obj.foo.bar', function() {
deepEqual(Ember.getPath(obj, 'this.foo.bar'), obj.foo.bar);
});
test('[obj, .foo.bar] -> obj.foo.bar', function() {
deepEqual(Ember.getPath(obj, 'this.foo.bar'), obj.foo.bar);
});
test('[obj, this.Foo.bar] -> (null)', function() {
deepEqual(Ember.getPath(obj, 'this.Foo.bar'), undefined);
});
@@ -58,17 +58,6 @@ test('[obj, foo.bar] -> obj.foo.bar', function() {
equal(Ember.getPath(obj, 'foo.bar'), "BAM");
});
test('[obj, foo.*] -> EXCEPTION', function() {
raises(function() {
Ember.setPath(obj, 'foo.*', "BAM");
}, Error);
});
test('[obj, foo.*.baz] -> obj.foo.baz', function() {
Ember.setPath(obj, 'foo.*.baz', "BAM");
equal(Ember.getPath(obj, 'foo.baz'), "BAM");
});
test('[obj, this.foo] -> obj.foo', function() {
Ember.setPath(obj, 'this.foo', "BAM");
equal(Ember.getPath(obj, 'foo'), "BAM");

0 comments on commit 50d6662

Please sign in to comment.