Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: add space to class string of iterator objects and updated tests accordingly #17558

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }');
4 changes: 2 additions & 2 deletions test/parallel/test-whatwg-url-tostringtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down