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

Add grouping tests #21

Merged
Show file tree
Hide file tree
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,106 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the blockquote element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-blockquote-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the blockquote element.</p>

<div id="log"></div>

<hr>

<blockquote>0- Cite is not provided.</blockquote>
<blockquote cite="blehblah">1- Cite = "blehblah" </blockquote>
<blockquote cite="http://w3c-test.org/">2- Cite = "http://w3c-test.org/"</blockquote>
<blockquote cite="http://www2.w3c-test.org/">3- Cite = "http://www2.w3c-test.org/"</blockquote>
<blockquote cite="http://天気の良い日.w3c-test.org/">4- Cite = "http://天気の良い日.w3c-test.org/"</blockquote>
<blockquote cite="http://élève.w3c-test.org/">5- Cite = "http://élève.w3c-test.org/"</blockquote>
<blockquote cite="https://www.w3c-test.org/">6- Cite = "https://www.w3c-test.org/"</blockquote>
<blockquote cite=" http://w3c-test.org/ ">7- Cite = "http://w3c-test.org/" w/ spaces </blockquote>
<blockquote cite=" http://w3c-test.org/ ">8- Cite = "http://w3c-test.org/" w/ tabs </blockquote>
<blockquote cite="&#x20http://w3c-test.org/&#x20">9- Cite = "http://w3c-test.org/" w/ Unicode space </blockquote>
<blockquote cite="&#x09http://w3c-test.org/&#x09">10- Cite = "http://w3c-test.org/" w/ Unicode tab</blockquote>
<blockquote cite="&#x0Ahttp://w3c-test.org/&#x0A">11- Cite = "http://w3c-test.org/" w/ Unicode newline</blockquote>
<blockquote cite="&#x0Chttp://w3c-test.org/&#x0C">12- Cite = "http://w3c-test.org/" w/ Unicode formfeed</blockquote>
<blockquote cite="&#x0Dhttp://w3c-test.org/&#x0D">13- Cite = "http://w3c-test.org/" w/ Unicode carriage return </blockquote>
<blockquote cite=" &#x20&#x09&#x0A http://w3c-test.org/ &#x0C &#x0D ">14- Cite = "http://w3c-test.org/" w/ combo spaces </blockquote>

<script>
"use strict";

var strElement = "blockquote", testElement = {}, testElementProperties = [], testQuotes = [];

var testURLs = [{actual: "", resolved: ""},
{actual: "blehblah", resolved: document.location.protocol + "//" + document.location.host + "/blehblah"},
{actual: "http://w3c-test.org/", resolved: "http://w3c-test.org/"},
{actual: "http://www2.w3c-test.org/", resolved: "http://www2.w3c-test.org/"},
{actual: "http://天気の良い日.w3c-test.org/", resolved: "http://天気の良い日.w3c-test.org/"},
{actual: "http://élève.w3c-test.org/", resolved: "http://élève.w3c-test.org/"},
{actual: "https://www.w3c-test.org/", resolved: "https://www.w3c-test.org/"},
{actual: " http://w3c-test.org/ ", resolved: "http://w3c-test.org/"}, // with spaces
{actual: " http://w3c-test.org/ ", resolved: "http://w3c-test.org/"}, // with tabs
{actual: "\u0020http://w3c-test.org/\u0020", resolved: "http://w3c-test.org/"}, // with unicode space
{actual: "\u0009http://w3c-test.org/\u0009", resolved: "http://w3c-test.org/"}, // with unicode tab
{actual: "\u000Ahttp://w3c-test.org/\u000A", resolved: "http://w3c-test.org/"}, // with unicode newline
{actual: "\u000Chttp://w3c-test.org/\u000C", resolved: "http://w3c-test.org/"}, // with unicode formfeed
{actual: "\u000Dhttp://w3c-test.org/\u000D", resolved: "http://w3c-test.org/"}, // with unicode carriage return
{actual: " \u0020\u0009\u000A http://w3c-test.org/ \u000C \u000D ", resolved: "http://w3c-test.org/"} // with combo unicode spaces
];

setup(function () {
testQuotes = document.getElementsByTagName(strElement);
testElement = testQuotes[0];
testElementProperties = Object.getOwnPropertyNames(testElement);
});

// check that prototype matches spec's DOM interface
test(function () {
assert_equals(Object.getPrototypeOf(testElement), HTMLQuoteElement.prototype, "HTMLQuoteElement.prototype should be used for " + strElement);
}, "The prototype for " + strElement + " is HTMLQuoteElement.prototype");

// check that "cite" is an "own" property
test(function () {
assert_own_property(testElementProperties, "cite", strElement + " should have 'cite' as own property.");
}, strElement + " should have 'cite' as own property.");
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 not correct. Per WebIDL, "cite" should be a getter property of HTMLQuoteElement.prototype.

(Did you actually mean testElementProperties here, or did you mean testElement?)


// If the content attribute is absent, the IDL attribute must return the default value, if the content attribute has one, or else the empty string.
test(function () {
assert_equals(testQuotes[0].cite, "", strElement + "If the cite content attribute is absent, the IDL attribute must return the empty string.");
}, "If the cite content attribute is absent, the IDL attribute must return the empty string.");

// On setting, the IDL attribute must set the content attribute to the specified literal value.
test(function () {
testQuotes[0].cite = "foo bar";
assert_equals(testQuotes[0].attributes["cite"].value, "foo bar", "Setting cite IDL sets content attribute to specified literal value.");
}, "Setting cite IDL sets content attribute to specified literal value.");

// All other testQuote examples have content attributes to test vis-a-vis registering and resolving

for (var i = 1; i < testQuotes.length; i++) {
// Check that element's cite content attribute registered properly (literally, not resolved)
test(function () {
assert_equals(testQuotes[i].attributes["cite"].value, testURLs[i].actual, strElement + " #" + i + ": content attribute");
}, strElement + " #" + i + ": cite content attribute registers markup.");
}

for (var i = 1; i < testQuotes.length; i++) {
// The cite IDL attribute must reflect the element's cite content attribute (resolving URLs relative to the element)...
test(function () {
assert_equals(testQuotes[i].cite, testURLs[i].resolved, strElement + " #" + i + ": cite IDL reflects content attribute.");
}, strElement + " #" + i + ": cite IDL reflects content attribute.");
}

// Not checking: Is a sectioning root

</script>
</body>
</html>


27 changes: 27 additions & 0 deletions html/semantics/grouping-content/the-dd-element/grouping-dd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the dd element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-dd-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("dd");
assert_equals(Object.getPrototypeOf(testElement), HTMLElement.prototype, "HTMLElement.prototype should be used for dd");
}, "The prototype for dd is HTMLElement.prototype");

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the dd element.</p>

<div id="log"></div>
</body>
</html>
28 changes: 28 additions & 0 deletions html/semantics/grouping-content/the-div-element/grouping-div.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>The div element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-div-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("div");
assert_equals(Object.getPrototypeOf(testElement), HTMLDivElement.prototype, "HTMLDivElement.prototype should be used for div");
}, "The prototype for div is HTMLDivElement.prototype");

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the div element.</p>

<div id="log"></div>

</body>
</html>
30 changes: 30 additions & 0 deletions html/semantics/grouping-content/the-dl-element/grouping-dl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the dl element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-dl-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("dl");
assert_equals(Object.getPrototypeOf(testElement), HTMLDListElement.prototype, "HTMLDListElement.prototype should be used for dl");
}, "The prototype for dl is HTMLDListElement.prototype");

// Not checking: effects of markup on defining groups and the name-pair values within those groups

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the dl element.</p>

<div id="log"></div>

</body>
</html>
28 changes: 28 additions & 0 deletions html/semantics/grouping-content/the-dt-element/grouping-dt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the dl element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-dt-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("dt");
assert_equals(Object.getPrototypeOf(testElement), HTMLElement.prototype, "HTMLElement.prototype should be used for dt");
}, "The prototype for dt is HTMLElement.prototype");

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the dt element.</p>

<div id="log"></div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the figcaption element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-figcaption-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("figcaption");
assert_equals(Object.getPrototypeOf(testElement), HTMLElement.prototype, "HTMLElement.prototype should be used for figcaption");
}, "The prototype for figcaption is HTMLElement.prototype");

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the figcaption element.</p>

<div id="log"></div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the figure element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-figure-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("figure");
assert_equals(Object.getPrototypeOf(testElement), HTMLElement.prototype, "HTMLElement.prototype should be used for figure");
}, "The prototype for figure is HTMLElement.prototype");

// Not checking: Sectioning root

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the figure element.</p>

<div id="log"></div>
</body>
</html>
32 changes: 32 additions & 0 deletions html/semantics/grouping-content/the-hr-element/grouping-hr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the hr element</title>
<link rel="author" title="dzenana" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-hr-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
"use strict";

// check that prototype matches spec's DOM interface
test(function () {
var testElement = document.createElement("hr");
assert_equals(Object.getPrototypeOf(testElement), HTMLHRElement.prototype, "HTMLHRElement.prototype should be used for hr");
}, "The prototype for hr is HTMLHRElement.prototype");

// Not checking: "The hr element does not affect the document's outline."

</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates the hr element.</p>

<div id="log"></div>

</body>
</html>


Loading