Skip to content

Commit

Permalink
Merge pull request #46 from JakeChampion/patch-1
Browse files Browse the repository at this point in the history
Add correct name, argument length and context validation to the polyfill
  • Loading branch information
walling authored Jul 5, 2019
2 parents 41a157f + 85ba067 commit 61626bd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/unorm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions test/es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ describe("es6-shim", function () {

myit("length property of the normalize method is 0.", function () {
assert("foo".normalize.length, 0, "length property of the normalize method is 0.");
assert(String.prototype.normalize.length, 0, "length property of the normalize method is 0.");
});

it("throws TypeError if `this` is null", function () {
assert.throws(function () {
String.prototype.normalize.call(null);
}, TypeError);
});

it("throws TypeError if `this` is undefined", function () {
assert.throws(function () {
String.prototype.normalize.call(undefined);
}, TypeError);
});

myit("If f is not one of \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", then throw a RangeError Exception.", function () {
Expand Down

0 comments on commit 61626bd

Please sign in to comment.