diff options
Diffstat (limited to 'js/vendor/es6-shim/test-sham')
-rw-r--r-- | js/vendor/es6-shim/test-sham/index.html | 22 | ||||
-rw-r--r-- | js/vendor/es6-shim/test-sham/set-prototype-of.js | 24 |
2 files changed, 46 insertions, 0 deletions
diff --git a/js/vendor/es6-shim/test-sham/index.html b/js/vendor/es6-shim/test-sham/index.html new file mode 100644 index 000000000..e83204d0f --- /dev/null +++ b/js/vendor/es6-shim/test-sham/index.html @@ -0,0 +1,22 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <title>es6-shim tests</title> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script> + <link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> + <script src="../node_modules/es5-shim/es5-shim.js"></script> + <script src="../node_modules/es5-shim/es5-sham.js"></script> + <script src="../node_modules/mocha/mocha.js"></script> + <!-- note that chai uses Object.create() so needs es5-sham to be loaded --> + <script src="../node_modules/chai/chai.js"></script> + <script src="../es6-sham.js"></script> + <script src="../test/browser-setup.js"></script> + <script src="set-prototype-of.js"></script> + <script src="../test/browser-onload.js"></script> +</head> +<body> + <div id="mocha"></div> +</body> +</html> + 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); + }); + +}); + |