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 <timothygu99@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
f96a86cac5
commit
486290b1fe
@ -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) {
|
||||
|
@ -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 { }');
|
||||
|
@ -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]) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user