Skip to content

Commit

Permalink
fix(plugins): removed unnecessary es5 helper support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: If you were using ES5 and used the computed helper on
function, this will affect you as that is no longer present.
  • Loading branch information
EisenbergEffect committed Apr 26, 2015
1 parent 09038c8 commit 710499a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
18 changes: 0 additions & 18 deletions src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,6 @@ export class Plugins {
return this;
}

/**
* Installs special support for ES5 authoring.
*
* @method es5
* @return {Plugins} Returns the current Plugins instance.
*/
es5(){
Function.prototype.computed = function(computedProperties){
for(var key in computedProperties){
if(computedProperties.hasOwnProperty(key)){
Object.defineProperty(this.prototype, key, { get: computedProperties[key], enumerable: true });
}
}
};

return this;
}

_process(){
var aurelia = this.aurelia,
loader = aurelia.loader,
Expand Down
24 changes: 0 additions & 24 deletions test/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,5 @@ describe('the plugin loader', () => {
done();
});
});


});

describe("es5()", () => {
afterEach(() => Function.prototype.computed = undefined);

it("adds the computed function on the Function prototype", () => {
expect(Function.prototype.computed).toBeUndefined();
plugins.es5();
expect(Function.prototype.computed).toEqual(jasmine.any(Function));
});

it("Function.prototype.computed adds read only object keys to a function", () => {
plugins.es5();
function TestFn() {}

var metaData = {intProp: () => 1, boolProp: () => false};
TestFn.computed(metaData);
var testFn = new TestFn();

expect(testFn.intProp).toBe(1);
expect(testFn.boolProp).toBeFalsy();
});
});
});

0 comments on commit 710499a

Please sign in to comment.