blob: d68f930fd9a9f802408ed0ab7d0da73467687082 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
describe('Object.setPrototypeOf(o, p)', function() {
it('changes prototype to regular objects', function() {
var obj = {a: 123};
expect(obj instanceof Object).to.equal(true);
// sham requires assignment to work cross browser
obj = Object.setPrototypeOf(obj, null);
expect(obj instanceof Object).to.equal(false);
expect(obj.a).to.equal(123);
});
it('changes prototype to null objects', function() {
var obj = Object.create(null);
obj.a = 456;
expect(obj instanceof Object).to.equal(false);
expect(obj.a).to.equal(456);
// sham requires assignment to work cross browser
obj = Object.setPrototypeOf(obj, {});
expect(obj instanceof Object).to.equal(true);
expect(obj.a).to.equal(456);
});
});
|