blob: 15c3c6e1845e2a5fec4f3bd4b08e3f0879a3a029 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
div#node1 {
BACKGROUND-COLOR:blue;
COLOR:white;
border-STYLE:solid;
BORDER-width:0;
position:absolute;
ToP:0;
lEfT:0;
/* font-size: 12px; */
/*float: left;*/
}
</style>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test() {
var nodeStyles;
function validatePropertyName(name)
{
if (typeof name != "string") {
InspectorTest.log("Unexpected property name type: " + typeof name);
return false;
}
if (name.toLowerCase() != name) {
InspectorTest.log("Property name contains uppercase characters: " + name);
return false;
}
return true;
}
function validateStyles()
{
for (var i = 0; i < nodeStyles.matchedRules.length; ++i) {
var rule = nodeStyles.matchedRules[i];
if (rule.type !== WI.CSSStyleSheet.Type.Author)
continue;
for (var j = 0; j < rule.style.properties.length; ++j) {
var property = rule.style.properties[j];
if (property.anonymous)
continue;
if (validatePropertyName(property.name))
InspectorTest.log("Property valid: " + property.name);
}
}
InspectorTest.completeTest();
}
function onStylesRefreshed()
{
nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
validateStyles();
}
WI.domTreeManager.requestDocument(function(documentNode) {
WI.domTreeManager.querySelector(documentNode.id, "#node1", function(contentNodeId) {
if (contentNodeId) {
var domNode = WI.domTreeManager.nodeForId(contentNodeId);
nodeStyles = WI.cssStyleManager.stylesForNode(domNode);
if (nodeStyles.needsRefresh)
nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, onStylesRefreshed, this);
else
validateStyles();
} else {
InspectorTest.log("DOM node not found.");
InspectorTest.completeTest();
}
});
});
}
</script>
</head>
<body onload="runTest()">
<p>Testing that the author rules returned by CSSStyleManager.stylesForNode have lowercase property names regardless of CSS source formatting.</p>
<div id="node1"></div>
</body>
</html>