Template Upload
This commit is contained in:
8
node_modules/es6-shim/test-sham/.eslintrc
generated
vendored
Normal file
8
node_modules/es6-shim/test-sham/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"globals": {
|
||||
"expect": false
|
||||
}
|
||||
}
|
54
node_modules/es6-shim/test-sham/function.js
generated
vendored
Normal file
54
node_modules/es6-shim/test-sham/function.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
var identity = function (x) { return x; };
|
||||
|
||||
describe('Function', function () {
|
||||
describe('#name', function () {
|
||||
it('returns the name for named functions', function () {
|
||||
var foo = function bar() {};
|
||||
expect(foo.name).to.equal('bar');
|
||||
|
||||
// pre-ES6, this property is nonconfigurable.
|
||||
var configurable = Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(foo, 'name').configurable : false;
|
||||
|
||||
expect(foo).to.have.ownPropertyDescriptor('name', {
|
||||
configurable: !!configurable,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: 'bar'
|
||||
});
|
||||
});
|
||||
|
||||
it('returns empty string for anonymous functions', function () {
|
||||
var anon = identity(function () {});
|
||||
expect(anon.name).to.equal('');
|
||||
|
||||
// pre-ES6, this property is nonconfigurable.
|
||||
var configurable = Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(anon, 'name').configurable : false;
|
||||
|
||||
expect(anon).to.have.ownPropertyDescriptor('name', {
|
||||
configurable: !!configurable,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: ''
|
||||
});
|
||||
});
|
||||
|
||||
it('returns "anomymous" for Function functions', function () {
|
||||
/* eslint no-new-func: 1 */
|
||||
/* jshint evil: true */
|
||||
var func = identity(Function(''));
|
||||
/* jshint evil: false */
|
||||
expect(typeof func.name).to.equal('string');
|
||||
expect(func.name === 'anonymous' || func.name === '').to.equal(true);
|
||||
|
||||
// pre-ES6, this property is nonconfigurable.
|
||||
var configurable = Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(func, 'name').configurable : false;
|
||||
|
||||
expect(func).to.have.ownPropertyDescriptor('name', {
|
||||
configurable: !!configurable,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: func.name
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
23
node_modules/es6-shim/test-sham/index.html
generated
vendored
Normal file
23
node_modules/es6-shim/test-sham/index.html
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<!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="function.js"></script>
|
||||
<script src="../test/browser-onload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
26
node_modules/es6-shim/test-sham/set-prototype-of.js
generated
vendored
Normal file
26
node_modules/es6-shim/test-sham/set-prototype-of.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/* global expect, describe, it */
|
||||
|
||||
describe('Object.setPrototypeOf(o, p)', function () {
|
||||
'use strict';
|
||||
|
||||
it('changes prototype to regular objects', function () {
|
||||
var obj = { a: 123 };
|
||||
expect(obj).to.be.an.instanceOf(Object);
|
||||
// sham requires assignment to work cross browser
|
||||
obj = Object.setPrototypeOf(obj, null);
|
||||
expect(obj).not.to.be.an.instanceOf(Object);
|
||||
expect(obj.a).to.equal(123);
|
||||
});
|
||||
|
||||
it('changes prototype to null objects', function () {
|
||||
var obj = Object.create(null);
|
||||
obj.a = 456;
|
||||
expect(obj).not.to.be.an.instanceOf(Object);
|
||||
expect(obj.a).to.equal(456);
|
||||
// sham requires assignment to work cross browser
|
||||
obj = Object.setPrototypeOf(obj, {});
|
||||
expect(obj).to.be.an.instanceOf(Object);
|
||||
expect(obj.a).to.equal(456);
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user