summaryrefslogtreecommitdiffstats
path: root/js/vendor/es6-shim/test-sham/set-prototype-of.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/es6-shim/test-sham/set-prototype-of.js')
-rw-r--r--js/vendor/es6-shim/test-sham/set-prototype-of.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/vendor/es6-shim/test-sham/set-prototype-of.js b/js/vendor/es6-shim/test-sham/set-prototype-of.js
new file mode 100644
index 000000000..d68f930fd
--- /dev/null
+++ b/js/vendor/es6-shim/test-sham/set-prototype-of.js
@@ -0,0 +1,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);
+ });
+
+});
+