New Client: stable (#8426)

* try to freeze content object

* deep freeze the content object, start to implement stable

* freeze at the /common level

* go back to freezing content only on the client

* use deep-frezze-strict to support phantomjs

* use own version of deepFreeze

* update comment about deepFreeze
This commit is contained in:
Matteo Pagliazzi
2017-02-15 12:49:57 +01:00
committed by GitHub
parent 6fd509df13
commit 20792f5455
5 changed files with 98 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
import deepFreeze from 'client/libs/deepFreeze';
describe('deepFreeze', () => {
it('works as expected', () => {
let obj = {
a: 1,
b () {
return this.a;
},
nested: {
c: 2,
nestedTwice: {
d: 1,
},
},
};
let result = deepFreeze(obj);
expect(result).to.equal(obj);
expect(Object.isFrozen(obj)).to.equal(true);
expect(Object.isFrozen(obj.nested)).to.equal(true);
expect(Object.isFrozen(obj.nested.nestedTwice)).to.equal(true);
});
});