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

Reformat URL tests #11492

Merged
merged 9 commits into from
Aug 3, 2018
Merged

Reformat URL tests #11492

merged 9 commits into from
Aug 3, 2018

Conversation

jugglinmike
Copy link
Contributor

Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the WHATWG URL standard such as Node.js [1]. Using WPT's .any.js convention also extends test coverage in browsers by allowing them to be executed within a Web Worker.

This change is in service of gh-11277.

[1] https://nodejs.org/dist/latest-v8.x/docs/api/url.html#url_the_whatwg_url_api

/cc @jorydotcom @mariestaver @mzgoddard @nomadtechie @spectranaut

@domenic
Copy link
Member

domenic commented Jun 13, 2018

This does not appear to touch my precious .json files so this should not disrupt my workflow :). I'll leave reviews of the conversion of the wrappers to others.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! Couple of nits.

@@ -0,0 +1,4 @@
test(() => {
const a = new URL('https://example.com/');
assert_equals(JSON.stringify(a), '"https://example.com/"');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you undo the quoting changes to see if GitHub then recognizes this as a rename + modifications rather than a new resource?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariestaver Undid the quoting changes, but this is still being interpreted as a new file

@@ -67,5 +60,4 @@
}
})
}, "response.formData() with input: " + val.input)
})
</script>
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a newline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, though not recognized by GitHub

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I think it is. If there's no newline there's a red indicator at the end of the line.

<script>
/*
https://url.spec.whatwg.org/#dom-urlsearchparams-append
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to keep this. Or any of the links. It's pretty self-explanatory where this is all documented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @annevk!

I'm curious to hear why you think its obvious and self-explanatory. I agree it might be the case for spec authors and implementors. However, for new WPT contributors without a strong standards background, I think this link would be pretty helpful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the README had a link to the standard (as a standalone section), but it seems like it doesn't. I think we should add that. Test metadata tends to go out-of-date.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good @annevk. Will update.

</head>
</html>

}, 'URLSearchParams connected to URL');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the newline.

@@ -53,5 +47,4 @@
url.searchParams.sort()
assert_equals(url.href, "http://example.com/")
assert_equals(url.search, "")
}, "Sorting non-existent params removes ? from URL")
</script>
}, "Sorting non-existent params removes ? from URL")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the newline.

assert_equals(url2.searchParams.toString(), '%3Fa=b')
}, 'URL.searchParams and URL.search setters, update propagation')
}
runURLSearchParamTests()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was strictly copy-and-pasted, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was strictly copy-and-pasted. Its the 68 lines from url/url-constructor.html plus 4 for the copy of bURL.

@joyeecheung
Copy link
Contributor

Hi, any updates on this PR? Would really love to see this get merged and incorporated into the Node.js core test suites, thanks!

@Ms2ger
Copy link
Contributor

Ms2ger commented Aug 2, 2018

@jugglinmike could you rebase, please?

Amal Hussein and others added 8 commits August 2, 2018 16:00
- Convert url/urlsearchparams-append.html to .any.js
- Convert url/urlsearchparams-constructor.html to .any.js
- Convert url/urlsearchparams-foreach.html to .any.js
- Convert url/urlsearchparams-set.html to .any.js
- Convert url/urlsearchparams-getall.html to .any.js
@jugglinmike
Copy link
Contributor Author

@Ms2ger Sure. The prior version of this branch is available at https://github.com/web-platform-tests/wpt/compare/master...bocoup:liberate-url-3?expand=1 in case that's interesting to anyone.

@Ms2ger Ms2ger merged commit e6422d2 into web-platform-tests:master Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants