raw.html revision 13a5ee3728c8d0a8ac7b95cf29627b0b8c05da8f
<!doctype html>
<html>
<head>
<title>Test Page</title>
h1 {
font: normal 125%/1.4 Arial, sans-serif;
}
.yui-skin-sam .yui-console .yui-console-content {
font-size: 10px;
width: 32em;
}
.yui-skin-sam .yui-console .yui-console-bd {
height: 50em;
}
.yui-skin-sam .yui-console-entry-pass .yui-console-entry-cat {
background: #070;
color: #fff;
}
.yui-skin-sam .yui-console-entry-fail .yui-console-entry-cat {
background: #700;
color: #fff;
}
.yui-skin-sam .yui-console-entry-time {
display: none;
}
</style>
</head>
<body class="yui-skin-sam">
<h1>Tests</h1>
<div id="testbed"></div>
<script>
YUI({
filter : 'raw',
logInclude : { TestRunner: true }
}).use('test','console', function (Y) {
var d = document,
Assert = Y.Assert,
suite = new Y.Test.Suite("!important related Tests"),
sheet,
rules;
function getCssText( allRules ) {
var content = [], rule, i, len;
rule = allRules[i];
(rule.selectorText || rule.tagName) +
}
return content;
}
name: "!important",
test_new_sheet_with_important: function () {
css;
css = "#foo { color: red !important; } #bar { height: 100px; }";
if (s.styleSheet) {
s.styleSheet.cssText = css;
} else {
}
sheet = s.sheet || s.styleSheet,
rules = sheet.cssRules || sheet.rules;
css = getCssText( rules );
"No parsed rule reports !important in its cssText");
},
test_new_rule_with_important: function () {
if ( sheet.insertRule ) {
} else {
}
var css = getCssText( rules ),
},
test_new_property_with_important: function () {
rule.style.paddingBottom = '10px !important';
},
test_existing_property_with_important: function () {
rule = rules[i];
rule.style.height = '5em !important';
Y.log( getCssText( rules ).join("\n"), "info", "TestRunner" );
Assert.areEqual( '5em !important', rule.style.height );
break;
}
}
},
test_off_dom_style_property_with_important: function () {
var p = d.createElement('p');
p.style.color = '#000';
p.style.textAlign = 'right !important';
Y.log( getCssText( [p] ).join("\n"), "info", "TestRunner" );
try {
Assert.areEqual( 'right !important', p.style.textAlign );
}
catch (e) {
Assert.areEqual( 'right', p.style.textAlign );
}
},
test_on_dom_style_property_with_important: function () {
d.body.style.color = '#000';
d.body.style.textAlign = 'right !important';
try {
Assert.areEqual( 'right !important', d.body.style.textAlign );
}
catch (e) {
Assert.areEqual( 'right', d.body.style.textAlign );
}
}
}));
var yconsole = new Y.Console({
contentBox:"log",
newestOnTop: false,
height: '600px'
}).render();
Y.Test.Runner.add(suite);
});
</script>
</body>
</html>