Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/script-tests/URL-attribute-reflection.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 description("Test reflecting URL attributes with empty string values.");
2
3 function testURLReflection(attributeName, tag, scriptAttributeName)
4 {
5 if (!scriptAttributeName)
6 scriptAttributeName = attributeName.toLowerCase();
7
8 var element;
9 if (tag === "html")
10 element = document.documentElement;
11 else {
12 element = document.createElement(tag);
13 document.body.appendChild(element);
14 }
15 element.setAttribute(scriptAttributeName, "x");
16 var xValue = element[attributeName];
17 element.setAttribute(scriptAttributeName, "");
18 var emptyValue = element[attributeName];
19 if (tag !== "html")
20 document.body.removeChild(element);
21
22 if (xValue === undefined)
23 return "none";
24 if (xValue === "x")
25 return "non-URL";
26 if (xValue !== document.baseURI.replace(/[^\/]+$/, "x"))
27 return "error (x): " + xValue;
28 if (emptyValue === "")
29 return "non-empty URL";
30 if (emptyValue === document.baseURI)
31 return "URL";
32 return "error (empty): " + emptyValue;
33 }
34
35 shouldBe("testURLReflection('attribute', 'element')", "'none'");
36 shouldBe("testURLReflection('id', 'element')", "'non-URL'");
37
38 // The following list comes from the HTML5 document’s attributes index.
39 // These are the URL attributes from that list.
40
41 shouldBe("testURLReflection('action', 'form')", "'URL'");
42 shouldBe("testURLReflection('cite', 'blockquote')", "'URL'");
43 shouldBe("testURLReflection('cite', 'del')", "'URL'");
44 shouldBe("testURLReflection('cite', 'ins')", "'URL'");
45 shouldBe("testURLReflection('cite', 'q')", "'URL'");
46 shouldBe("testURLReflection('data', 'object')", "'URL'");
47 shouldBe("testURLReflection('formaction', 'button')", "'URL'");
48 shouldBe("testURLReflection('formaction', 'input')", "'URL'");
49 shouldBe("testURLReflection('href', 'a')", "'URL'");
50 shouldBe("testURLReflection('href', 'area')", "'URL'");
51 shouldBe("testURLReflection('href', 'link')", "'URL'");
52 shouldBe("testURLReflection('href', 'base')", "'URL'");
53 shouldBe("testURLReflection('icon', 'command')", "'URL'");
54 shouldBe("testURLReflection('poster', 'video')", "'URL'");
55 shouldBe("testURLReflection('src', 'audio')", "'URL'");
56 shouldBe("testURLReflection('src', 'embed')", "'URL'");
57 shouldBe("testURLReflection('src', 'iframe')", "'URL'");
58 shouldBe("testURLReflection('src', 'img')", "'URL'");
59 shouldBe("testURLReflection('src', 'input')", "'URL'");
60 shouldBe("testURLReflection('src', 'script')", "'URL'");
61 shouldBe("testURLReflection('src', 'source')", "'URL'");
62 shouldBe("testURLReflection('src', 'video')", "'URL'");
63
64 // Other reflected URL attributes.
65
66 shouldBe("testURLReflection('longDesc', 'img')", "'URL'");
67 shouldBe("testURLReflection('lowsrc', 'img')", "'URL'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698