widget.html revision d0a16c48f3477794c63f4ff3242dc20db6a49295
<!doctype html>
<html>
<head>
<title>Widget Test Suite</title>
h1 {
font: normal 125%/1.4 Arial, sans-serif;
}
.yui3-skin-sam .yui3-console .yui3-console-content {
font-size: 10px;
}
.yui3-skin-sam .yui3-console-entry-pass .yui3-console-entry-cat {
background: #070;
color: #fff;
}
.yui3-skin-sam .yui3-console-entry-fail .yui3-console-entry-cat {
background: #700;
color: #fff;
}
.yui3-skin-sam .yui3-console-entry-time {
display: none;
}
</style>
</head>
<body class="yui3-skin-sam">
<div id="testbed" class="yui3-skin-foo"></div>
<script>
YUI({
filter : 'raw'
}).use('test','console',function (Y) {
var suite = new Y.Test.Suite("Widget Tests");
suite.add(new Y.Test.Case({
name : "getSkinName",
"getSkinName should return null if not rendered" : function () {
var w = new Y.Widget();
Y.Assert.isNull( w.getSkinName() );
},
"getSkinName should return name from BB if available": function () {
cb = bb.one( 'div' ),
w = new Y.Widget( {
boundingBox: bb,
contentBox: cb
} );
Y.Assert.areEqual( "foo", w.getSkinName() );
},
"getSkinName should return name from body or null": function () {
var w = new Y.Widget().render(),
body = Y.one( 'body' );
Y.Assert.areEqual( "sam", w.getSkinName() );
body.removeClass( "yui3-skin-sam" );
Y.Assert.isNull( w.getSkinName() );
body.addClass( "yui3-skin-sam" );
},
"getSkinName should return name from ancestor if both ancestor and body are classed": function () {
var w = new Y.Widget().render( '#testbed' ),
body = Y.one( 'body' );
body.addClass( "yui3-skin-sam" );
Y.Assert.areEqual( "foo", w.getSkinName() );
}
}));
new Y.Console({
newestOnTop: false,
height: '580px'
}).render();
Y.Test.Runner.add(suite);
});
</script>
</body>
</html>