Skip to content

Commit

Permalink
Merge pull request #21 from dzenana-trenutak/submission/dzenana.t-gro…
Browse files Browse the repository at this point in the history
…uping

Add grouping tests
  • Loading branch information
sideshowbarker committed Apr 13, 2013
2 parents fe1892b + 9f4bb4c commit 4990e54
Show file tree
Hide file tree
Showing 32 changed files with 2,030 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>the blockquote element</title>
<link rel="author" title="dzenana" href="mailto:dzenana.trenutak@gmail.com">
<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 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
];

var testElement = {}, testQuotes = [];

setup(function () {
testQuotes = document.getElementsByTagName("blockquote");
testElement = testQuotes[0];
});

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

// check that "cite" is an "own" property
test(function () {
assert_own_property(testElement, "cite", "blockquote should have 'cite' as own property.");
}, "blockquote should have 'cite' as own property.");

// 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(testElement.cite, "", "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 () {
testElement.cite = "foo bar";
assert_equals(testElement.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, "blockquote #" + i + ": content attribute");
}, "blockquote #" + 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, "blockquote #" + i + ": cite IDL reflects content attribute.");
}, "blockquote #" + 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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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:dzenana.trenutak@gmail.com">
<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

0 comments on commit 4990e54

Please # to comment.