Sha256: ca42dac4cfcdf3d87b9caa0c57093817e10aeb059d146056316d98594e72ac93

Contents?: true

Size: 1.33 KB

Versions: 14

Compression:

Stored size: 1.33 KB

Contents

'use strict';

var trimLeft = require('../');
trimLeft.shim();

var runTests = require('./tests');

var test = require('tape');
var defineProperties = require('define-properties');
var bind = require('function-bind');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();

test('shimmed', function (t) {
	t.equal(String.prototype.trimLeft.length, 0, 'String#trimLeft has a length of 0');
	t.test('Function name', { skip: !functionsHaveNames }, function (st) {
		st.equal((/^(?:trimLeft|trimStart)$/).test(String.prototype.trimLeft.name), true, 'String#trimLeft has name "trimLeft" or "trimStart"');
		st.end();
	});

	t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
		et.equal(false, isEnumerable.call(String.prototype, 'trimLeft'), 'String#trimLeft is not enumerable');
		et.end();
	});

	var supportsStrictMode = (function () { return typeof this === 'undefined'; }());

	t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) {
		st['throws'](function () { return trimLeft(undefined, 'a'); }, TypeError, 'undefined is not an object');
		st['throws'](function () { return trimLeft(null, 'a'); }, TypeError, 'null is not an object');
		st.end();
	});

	runTests(bind.call(Function.call, String.prototype.trimLeft), t);

	t.end();
});

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.18.2 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.16.1 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.15.2 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.18.4 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.18.1 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.14.0 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
enju_library-0.3.8 spec/dummy/node_modules/string.prototype.trimleft/test/shimmed.js
ilog-0.4.1 node_modules/string.prototype.trimleft/test/shimmed.js
ilog-0.4.0 node_modules/string.prototype.trimleft/test/shimmed.js
ilog-0.3.3 node_modules/string.prototype.trimleft/test/shimmed.js
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/string.prototype.trimleft/test/shimmed.js