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

new test files from TestTWF #80

Closed
Closed
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html>
<body onload="load_test_attr.done()">
Copy link
Contributor

Choose a reason for hiding this comment

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

Bogus onload :-)
Also, you need metadata: your author info, plus a meta help to the relevant place in the spec for this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

<h1>HTMLAllCollection Tests</h1>
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't really need a <h1>, but you do need a <title> :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

<img src="http://www.w3.org/Icons/w3c_home" name="picture">
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not depend on external resources. These tests are run by us browser vendors inside our own internal testing systems. And they don't like external resources (because suddenly they move, or the server is down or something). Causes lots of noise and uncertainty.

Does it have to be an img? Can it be an img with a data-src then instead maybe? If not you can find quite a lot of resources e.g. in the root of web-platform tests. So you'd do ../../../../images/green.png to get to http://w3c-test.org/web-platform-tests/master/images/green.png.

Yeah, a bit ugly but it works. But data-src would probably work well enough :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks to me like it's irrelevant to the tests what the src is or even what kind of element it is. They're just matching up the node name and the tag name in various ways.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, in this test it probably is. But sometimes cases like this really do test obscure things like "all" being updated even with unloaded image tags, etc etc. But you're right, as far as I can read the test only needs an element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used your suggested resource.

<p>There should be eight tests </p>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is way too hard to keep up to date. And why should it say so anyway? :-) The tests should always reliably fail if they don't pass. (And not vary in number).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

<div id="log"></div>
<script src="testharness.js"></script>
<script src="testharnessreport.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

These two should be /resources/testharness.js.

And the log should be after the scripts. That last point only because it is most common to do so, you could put it wherever :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated references and moved the log.

<script>
setup({explicit_done:true})
Copy link
Contributor

Choose a reason for hiding this comment

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

This type of test should not need to have an explicit done. It was possibly because of the external image load you wanted to do that? Anyway, it should be done without.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the explicit done.

{test(function(){ assert_true(document.all.length == 10)}, "Test for HTMLAllCollection size");}
Copy link
Contributor

Choose a reason for hiding this comment

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

We are not space constrained, it would be better to get this written out in full. And use assert_equals() instead of doing your own equality check. So: assert_equals(document.all.length, 10).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated using assert_equals for all the tests

{test(function(){ assert_true(document.all.item(0).tagName == "HTML")}, "Test lookup by index using ()");}
{test(function(){ assert_true(document.all[0].tagName == "HTML")}, "Test lookup by index using []");}
{test(function(){ assert_true(document.all.tags("script").length == 3)}, "Test for multiple occurence 3 <script> found");}
{test(function(){ assert_true(document.all.item("picture").nodeName == "IMG")}, "Test lookup IMG by name");}
{test(function(){ assert_true(document.all.namedItem("picture").nodeName == "IMG")}, "Test lookup IMG by namedItem ");}
{test(function(){ assert_true(document.all("picture").nodeName == "IMG")}, "Test lookup IMG in collection using ()");}
{test(function(){ assert_true(document.all["picture"].nodeName == "IMG")}, "Test lookup IMG in collection using []");}
onload = function() {done();}
</script>
</html>