From 654ce4ba17239a34261c2faa037455562983c33c Mon Sep 17 00:00:00 2001 From: Haejin Jo Date: Fri, 8 Dec 2017 18:23:45 -0800 Subject: [PATCH] url: added space to class string of iterator objects PR-URL: https://github.com/nodejs/node/pull/17558 Fixes: https://github.com/nodejs/node/issues/17540 Reviewed-By: Timothy Gu Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell --- lib/internal/url.js | 2 +- .../parallel/test-whatwg-url-searchparams-inspect.js | 12 ++++++------ test/parallel/test-whatwg-url-tostringtag.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index 7543dc2c39afc4..c2805ec19171b3 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1198,7 +1198,7 @@ function createSearchParamsIterator(target, kind) { // https://heycam.github.io/webidl/#dfn-iterator-prototype-object const URLSearchParamsIteratorPrototype = Object.create(IteratorPrototype); -defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParamsIterator', { +defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', { next() { if (!this || Object.getPrototypeOf(this) !== URLSearchParamsIteratorPrototype) { diff --git a/test/parallel/test-whatwg-url-searchparams-inspect.js b/test/parallel/test-whatwg-url-searchparams-inspect.js index 163fa185ede58d..f2493cc6cff176 100644 --- a/test/parallel/test-whatwg-url-searchparams-inspect.js +++ b/test/parallel/test-whatwg-url-searchparams-inspect.js @@ -10,20 +10,20 @@ const sp = new URLSearchParams('?a=a&b=b&b=c'); assert.strictEqual(util.inspect(sp), "URLSearchParams { 'a' => 'a', 'b' => 'b', 'b' => 'c' }"); assert.strictEqual(util.inspect(sp.keys()), - "URLSearchParamsIterator { 'a', 'b', 'b' }"); + "URLSearchParams Iterator { 'a', 'b', 'b' }"); assert.strictEqual(util.inspect(sp.values()), - "URLSearchParamsIterator { 'a', 'b', 'c' }"); + "URLSearchParams Iterator { 'a', 'b', 'c' }"); assert.strictEqual(util.inspect(sp.keys(), { breakLength: 1 }), - "URLSearchParamsIterator {\n 'a',\n 'b',\n 'b' }"); + "URLSearchParams Iterator {\n 'a',\n 'b',\n 'b' }"); const iterator = sp.entries(); assert.strictEqual(util.inspect(iterator), - "URLSearchParamsIterator { [ 'a', 'a' ], [ 'b', 'b' ], " + + "URLSearchParams Iterator { [ 'a', 'a' ], [ 'b', 'b' ], " + "[ 'b', 'c' ] }"); iterator.next(); assert.strictEqual(util.inspect(iterator), - "URLSearchParamsIterator { [ 'b', 'b' ], [ 'b', 'c' ] }"); + "URLSearchParams Iterator { [ 'b', 'b' ], [ 'b', 'c' ] }"); iterator.next(); iterator.next(); assert.strictEqual(util.inspect(iterator), - 'URLSearchParamsIterator { }'); + 'URLSearchParams Iterator { }'); diff --git a/test/parallel/test-whatwg-url-tostringtag.js b/test/parallel/test-whatwg-url-tostringtag.js index 689056fd238dda..c352503fa09a66 100644 --- a/test/parallel/test-whatwg-url-tostringtag.js +++ b/test/parallel/test-whatwg-url-tostringtag.js @@ -14,13 +14,13 @@ const spIterator = sp.entries(); const test = [ [url, 'URL'], [sp, 'URLSearchParams'], - [spIterator, 'URLSearchParamsIterator'], + [spIterator, 'URLSearchParams Iterator'], // Web IDL spec says we have to return 'URLPrototype', but it is too // expensive to implement; therefore, use Chrome's behavior for now, until // spec is changed. [Object.getPrototypeOf(url), 'URL'], [Object.getPrototypeOf(sp), 'URLSearchParams'], - [Object.getPrototypeOf(spIterator), 'URLSearchParamsIterator'], + [Object.getPrototypeOf(spIterator), 'URLSearchParams Iterator'], ]; test.forEach(([obj, expected]) => {