Sha256: 35d585df2bc3d800695d8cdc49143b019a52c438e33329029a4c9e1af92a13eb

Contents?: true

Size: 1.32 KB

Versions: 56

Compression:

Stored size: 1.32 KB

Contents

'use strict';

require('../auto');

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

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

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

	t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
		et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd 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 String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object');
		st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object');
		st.end();
	});

	runTests(callBind(String.prototype.trimEnd), t);

	t.end();
});

Version data entries

56 entries across 55 versions & 4 rubygems

Version Path
immosquare-cleaner-0.1.62 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.61 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.60 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.59 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.58 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.57 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.56 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.55 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.54 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.53 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.52 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.51 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.50 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.49 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.48 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.47 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.46 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.45 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.44 node_modules/string.prototype.trimend/test/shimmed.js
immosquare-cleaner-0.1.43 node_modules/string.prototype.trimend/test/shimmed.js