Bug 839116 part 3. Add tests for HTMLSharedElement attribute reflection. r=ms2ger

--HG--
rename : content/html/content/test/test_li_attributes_reflection.html => content/html/content/test/test_base_attributes_reflection.html
rename : content/html/content/test/test_li_attributes_reflection.html => content/html/content/test/test_dir_attributes_reflection.html
rename : content/html/content/test/test_li_attributes_reflection.html => content/html/content/test/test_html_attributes_reflection.html
rename : content/html/content/test/test_li_attributes_reflection.html => content/html/content/test/test_param_attributes_reflection.html
rename : content/html/content/test/test_li_attributes_reflection.html => content/html/content/test/test_q_attributes_reflection.html
This commit is contained in:
Boris Zbarsky 2013-02-08 12:20:11 +00:00
Родитель 1cb4c2a5d3
Коммит ade6b0db6f
11 изменённых файлов: 214 добавлений и 4 удалений

Просмотреть файл

@ -260,6 +260,11 @@ MOCHITEST_FILES = \
test_ol_attributes_reflection.html \
test_dl_attributes_reflection.html \
test_ul_attributes_reflection.html \
test_param_attributes_reflection.html \
test_base_attributes_reflection.html \
test_dir_attributes_reflection.html \
test_q_attributes_reflection.html \
test_html_attributes_reflection.html \
test_bug651956.html \
test_bug694503.html \
test_object_plugin_nav.html \

Просмотреть файл

@ -22,7 +22,8 @@ reflectString({
otherValues: [ "ISO-8859-1", "UTF-8" ],
});
// TODO: action (URL)
// TODO: action (URL). But note that we currently reflect it weirdly; see
// content/html/content/test/test_bug607145.html
// .autocomplete
reflectLimitedEnumerated({

Просмотреть файл

@ -67,7 +67,8 @@ reflectBoolean({
// TODO: form (HTMLFormElement)
// TODO: files (FileList)
// TODO: formAction (URL)
// TODO: formAction (URL). But note that we currently reflect it weirdly; see
// content/html/content/test/test_bug607145.html
// .formEnctype
reflectLimitedEnumerated({
@ -187,7 +188,11 @@ reflectUnsignedInt({
defaultValue: 20,
});
// TODO: src (URL)
// .src (URL)
reflectURL({
element: document.createElement('input'),
attribute: 'src',
});
// .step
reflectString({

Просмотреть файл

@ -588,3 +588,24 @@ function reflectInt(aParameters)
is(element[attr], defaultValue,
"When not set, the IDL attribute should return default value.");
}
/**
* Checks that a given attribute is correctly reflected as a url.
*
* @param aParameters Object object containing the parameters, which are:
* - element Element node to test
* - attribute String name of the attribute
* OR
* attribute Object object containing two attributes, 'content' and 'idl'
*/
function reflectURL(aParameters)
{
var element = aParameters.element;
var contentAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.content;
var idlAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.idl;
element[idlAttr] = "";
is(element[idlAttr], document.URL, "Empty string should resolve to document URL");
}

Просмотреть файл

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLBaseElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLBaseElement attributes reflection **/
// .href is sort of like a URL reflection, but with some special rules. Watch
// out for that!
reflectURL({
element: document.createElement("base"),
attribute: "href"
});
// .target
reflectString({
element: document.createElement("base"),
attribute: "target"
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -19,6 +19,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607145
/**
* This is not really reflecting an URL as the HTML5 specs want to.
* It's how .action is reflected in Gecko (might change later).
*
* If this changes, add reflectURL for "formAction" in
* content/html/content/test/forms/test_input_attributes_reflection.html and
* "action" in
* content/html/content/test/forms/test_form_attributes_reflection.html
*/
function reflectURL(aElement, aAttr)
{

Просмотреть файл

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLDirectoryElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLDirectoryElement attributes reflection **/
// .name
reflectBoolean({
element: document.createElement("dir"),
attribute: "compact",
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLHtmlElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLHtmlElement attributes reflection **/
// .version
reflectString({
element: document.createElement("html"),
attribute: "version",
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -15,7 +15,15 @@
/** Test for HTMLModElement attributes reflection **/
// TODO: cite (URL)
// .cite (URL)
reflectURL({
element: document.createElement("ins"),
attribute: "cite",
})
reflectURL({
element: document.createElement("del"),
attribute: "cite",
})
// .dateTime (String)
reflectString({

Просмотреть файл

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLParamElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLParamElement attributes reflection **/
// .name
reflectString({
element: document.createElement("param"),
attribute: "name",
});
// .value
reflectString({
element: document.createElement("param"),
attribute: "value"
});
// .type
reflectString({
element: document.createElement("param"),
attribute: "type"
});
// .valueType
reflectString({
element: document.createElement("param"),
attribute: "valueType"
});
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLQuoteElement attributes reflection</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="reflect.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for HTMLQuoteElement attributes reflection **/
// .cite
reflectURL({
element: document.createElement("q"),
attribute: "cite",
});
reflectURL({
element: document.createElement("blockquote"),
attribute: "cite",
});
</script>
</pre>
</body>
</html>