|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>the blockquote element</title> |
| 6 | + <link rel=" author" title=" dzenana" href=" mailto:[email protected]" > |
| 7 | + <link rel="help" href="http://www.w3.org/html/wg/drafts/html/CR/grouping-content.html#the-blockquote-element"> |
| 8 | + <script src="/resources/testharness.js"></script> |
| 9 | + <script src="/resources/testharnessreport.js"></script> |
| 10 | +</head> |
| 11 | +<body> |
| 12 | + <h1>Description</h1> |
| 13 | + <p>This test validates the blockquote element.</p> |
| 14 | + |
| 15 | + <div id="log"></div> |
| 16 | + |
| 17 | + <hr> |
| 18 | + |
| 19 | + <blockquote>0- Cite is not provided.</blockquote> |
| 20 | + <blockquote cite="blehblah">1- Cite = "blehblah" </blockquote> |
| 21 | + <blockquote cite="http://w3c-test.org/">2- Cite = "http://w3c-test.org/"</blockquote> |
| 22 | + <blockquote cite="http://www2.w3c-test.org/">3- Cite = "http://www2.w3c-test.org/"</blockquote> |
| 23 | + <blockquote cite="http://天気の良い日.w3c-test.org/">4- Cite = "http://天気の良い日.w3c-test.org/"</blockquote> |
| 24 | + <blockquote cite="http://élève.w3c-test.org/">5- Cite = "http://élève.w3c-test.org/"</blockquote> |
| 25 | + <blockquote cite="https://www.w3c-test.org/">6- Cite = "https://www.w3c-test.org/"</blockquote> |
| 26 | + <blockquote cite=" http://w3c-test.org/ ">7- Cite = "http://w3c-test.org/" w/ spaces </blockquote> |
| 27 | + <blockquote cite=" http://w3c-test.org/ ">8- Cite = "http://w3c-test.org/" w/ tabs </blockquote> |
| 28 | + <blockquote cite=" http://w3c-test.org/ ">9- Cite = "http://w3c-test.org/" w/ Unicode space </blockquote> |
| 29 | + <blockquote cite="	http://w3c-test.org/	">10- Cite = "http://w3c-test.org/" w/ Unicode tab</blockquote> |
| 30 | + <blockquote cite="
http://w3c-test.org/
">11- Cite = "http://w3c-test.org/" w/ Unicode newline</blockquote> |
| 31 | + <blockquote cite="http://w3c-test.org/">12- Cite = "http://w3c-test.org/" w/ Unicode formfeed</blockquote> |
| 32 | + <blockquote cite="
http://w3c-test.org/
">13- Cite = "http://w3c-test.org/" w/ Unicode carriage return </blockquote> |
| 33 | + <blockquote cite="  	
 http://w3c-test.org/  
 ">14- Cite = "http://w3c-test.org/" w/ combo spaces </blockquote> |
| 34 | + |
| 35 | + <script> |
| 36 | + "use strict"; |
| 37 | + |
| 38 | + var testURLs = [{actual: "", resolved: ""}, |
| 39 | + {actual: "blehblah", resolved: document.location.protocol + "//" + document.location.host + "/blehblah"}, |
| 40 | + {actual: "http://w3c-test.org/", resolved: "http://w3c-test.org/"}, |
| 41 | + {actual: "http://www2.w3c-test.org/", resolved: "http://www2.w3c-test.org/"}, |
| 42 | + {actual: "http://天気の良い日.w3c-test.org/", resolved: "http://天気の良い日.w3c-test.org/"}, |
| 43 | + {actual: "http://élève.w3c-test.org/", resolved: "http://élève.w3c-test.org/"}, |
| 44 | + {actual: "https://www.w3c-test.org/", resolved: "https://www.w3c-test.org/"}, |
| 45 | + {actual: " http://w3c-test.org/ ", resolved: "http://w3c-test.org/"}, // with spaces |
| 46 | + {actual: " http://w3c-test.org/ ", resolved: "http://w3c-test.org/"}, // with tabs |
| 47 | + {actual: "\u0020http://w3c-test.org/\u0020", resolved: "http://w3c-test.org/"}, // with unicode space |
| 48 | + {actual: "\u0009http://w3c-test.org/\u0009", resolved: "http://w3c-test.org/"}, // with unicode tab |
| 49 | + {actual: "\u000Ahttp://w3c-test.org/\u000A", resolved: "http://w3c-test.org/"}, // with unicode newline |
| 50 | + {actual: "\u000Chttp://w3c-test.org/\u000C", resolved: "http://w3c-test.org/"}, // with unicode formfeed |
| 51 | + {actual: "\u000Dhttp://w3c-test.org/\u000D", resolved: "http://w3c-test.org/"}, // with unicode carriage return |
| 52 | + {actual: " \u0020\u0009\u000A http://w3c-test.org/ \u000C \u000D ", resolved: "http://w3c-test.org/"} // with combo unicode spaces |
| 53 | + ]; |
| 54 | + |
| 55 | + var testElement = {}, testQuotes = []; |
| 56 | + |
| 57 | + setup(function () { |
| 58 | + testQuotes = document.getElementsByTagName("blockquote"); |
| 59 | + testElement = testQuotes[0]; |
| 60 | + }); |
| 61 | + |
| 62 | + // check that prototype matches spec's DOM interface |
| 63 | + test(function () { |
| 64 | + assert_equals(Object.getPrototypeOf(testElement), HTMLQuoteElement.prototype, "HTMLQuoteElement.prototype should be used for blockquote."); |
| 65 | + }, "The prototype for blockquote is HTMLQuoteElement.prototype"); |
| 66 | + |
| 67 | + // check that "cite" is an "own" property |
| 68 | + test(function () { |
| 69 | + assert_own_property(testElement, "cite", "blockquote should have 'cite' as own property."); |
| 70 | + }, "blockquote should have 'cite' as own property."); |
| 71 | + |
| 72 | + // 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. |
| 73 | + test(function () { |
| 74 | + assert_equals(testElement.cite, "", "If the cite content attribute is absent, the IDL attribute must return the empty string."); |
| 75 | + }, "If the cite content attribute is absent, the IDL attribute must return the empty string."); |
| 76 | + |
| 77 | + // On setting, the IDL attribute must set the content attribute to the specified literal value. |
| 78 | + test(function () { |
| 79 | + testElement.cite = "foo bar"; |
| 80 | + assert_equals(testElement.attributes["cite"].value, "foo bar", "Setting cite IDL sets content attribute to specified literal value."); |
| 81 | + }, "Setting cite IDL sets content attribute to specified literal value."); |
| 82 | + |
| 83 | + // All other testQuote examples have content attributes to test vis-a-vis registering and resolving |
| 84 | + |
| 85 | + for (var i = 1; i < testQuotes.length; i++) { |
| 86 | + // Check that element's cite content attribute registered properly (literally, not resolved) |
| 87 | + test(function () { |
| 88 | + assert_equals(testQuotes[i].attributes["cite"].value, testURLs[i].actual, "blockquote #" + i + ": content attribute"); |
| 89 | + }, "blockquote #" + i + ": cite content attribute registers markup."); |
| 90 | + } |
| 91 | + |
| 92 | + for (var i = 1; i < testQuotes.length; i++) { |
| 93 | + // The cite IDL attribute must reflect the element's cite content attribute (resolving URLs relative to the element)... |
| 94 | + test(function () { |
| 95 | + assert_equals(testQuotes[i].cite, testURLs[i].resolved, "blockquote #" + i + ": cite IDL reflects content attribute."); |
| 96 | + }, "blockquote #" + i + ": cite IDL reflects content attribute."); |
| 97 | + } |
| 98 | + |
| 99 | + // Not checking: Is a sectioning root |
| 100 | + |
| 101 | + </script> |
| 102 | +</body> |
| 103 | +</html> |
| 104 | + |
| 105 | + |
0 commit comments