-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7912033
commit fe231bb
Showing
5 changed files
with
94 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
dependencies = [ | ||
"_ESAbstract.CreateHTML", | ||
"_ESAbstract.CreateMethodProperty", | ||
] | ||
spec = "https://www.ecma-international.org/ecma-262/6.0/#sec-string.prototype.bold" | ||
docs = "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/bold" | ||
|
||
# Browsers which have always supported the feature are commented out. | ||
[browsers] | ||
# android = "*" | ||
bb = "*" | ||
# chrome = "*" | ||
# edge = "*" | ||
# edge_mob = "*" | ||
firefox = "< 4" | ||
# ios_chr = "*" | ||
# ios_saf = "*" | ||
ie = "*" | ||
ie_mob = "*" | ||
# opera = "*" | ||
op_mini = "*" | ||
# op_mob = "*" | ||
# safari = "*" | ||
firefox_mob = "< 4" | ||
# samsung_mob = "*" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'bold' in String.prototype && (function() { | ||
var test = ''.bold('"'); | ||
return test == test.toLowerCase() && test.split('"').length <= 3; | ||
}()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* globals CreateHTML, CreateMethodProperty */ | ||
// B.2.3.5String.prototype.bold ( ) | ||
// When the bold method is called with no arguments, the following steps are taken: | ||
CreateMethodProperty(String.prototype, 'bold', function bold() { | ||
// 1. Let S be the this value. | ||
var S = this; | ||
// 2. Return ? CreateHTML(S, "b", "", ""). | ||
return CreateHTML(S, "b", "", ""); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-env mocha */ | ||
/* globals proclaim */ | ||
|
||
var hasStrictMode = (function () { | ||
return this === null; | ||
}).call(null); | ||
|
||
var ifHasStrictModeIt = hasStrictMode ? it : it.skip; | ||
|
||
it('is a function', function () { | ||
proclaim.isFunction(String.prototype.bold); | ||
}); | ||
|
||
it('has correct arity', function () { | ||
proclaim.arity(String.prototype.bold, 0); | ||
}); | ||
|
||
it('has correct name', function () { | ||
proclaim.hasName(String.prototype.bold, 'bold'); | ||
}); | ||
|
||
it('is not enumerable', function () { | ||
proclaim.isNotEnumerable(String.prototype, 'bold'); | ||
}); | ||
|
||
ifHasStrictModeIt('should throw a TypeError when called with undefined context', function () { | ||
proclaim.throws(function () { | ||
String.prototype.bold.call(undefined); | ||
}, TypeError); | ||
}); | ||
|
||
ifHasStrictModeIt('should throw a TypeError when called with null context', function () { | ||
proclaim.throws(function () { | ||
String.prototype.bold.call(null); | ||
}, TypeError); | ||
}); | ||
|
||
it('works on strings correctly', function() { | ||
proclaim.deepEqual('_'.bold(), '<b>_</b>'); | ||
proclaim.deepEqual('<'.bold(), '<b><</b>'); | ||
proclaim.deepEqual(String.prototype.bold.call(1234), '<b>1234</b>'); | ||
}); |