classnamemanager.html revision 1bb9ba7f0e700971d0c04fca23820699348cfd49
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai<html>
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots<head>
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai <title>YUI ClassNameManager Tests</title>
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai <script src="/build/yui/yui.js" type="text/javascript"></script>
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai <style type="text/css">
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai #console .yui3-console-entry {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai padding:2px;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai margin:0px;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai min-height:0;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai #console .yui3-console-entry-fail .yui3-console-entry-cat {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai background-color:red;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai #console .yui3-console-entry-pass .yui3-console-entry-cat {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai background-color:green;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai #console .yui3-console-entry-perf .yui3-console-entry-cat {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai background-color:blue;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai #console {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai position:static;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai html, body {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai height:100%;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai </style>
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots</head>
7d507382f17958718343411514753ac813c037acSatyen Desai<body class="yui3-skin-sam">
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots<script type="text/javascript">
1bb9ba7f0e700971d0c04fca23820699348cfd49Satyen Desai YUI({
1bb9ba7f0e700971d0c04fca23820699348cfd49Satyen Desai useBrowserConsole:false,
1bb9ba7f0e700971d0c04fca23820699348cfd49Satyen Desai filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
1bb9ba7f0e700971d0c04fca23820699348cfd49Satyen Desai }).use("test", "classnamemanager", "console", function(Y) {
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
7d507382f17958718343411514753ac813c037acSatyen Desai var testClassNameManager = new Y.Test.Case({
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
7d507382f17958718343411514753ac813c037acSatyen Desai name: "ClassNameManager Tests",
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
7d507382f17958718343411514753ac813c037acSatyen Desai testSingleSection: function() {
7d507382f17958718343411514753ac813c037acSatyen Desai Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem"), "yui3-menuitem");
7d507382f17958718343411514753ac813c037acSatyen Desai },
7d507382f17958718343411514753ac813c037acSatyen Desai
7d507382f17958718343411514753ac813c037acSatyen Desai testSingleSectionNoPrefix: function() {
7d507382f17958718343411514753ac813c037acSatyen Desai Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", true), "menuitem");
7d507382f17958718343411514753ac813c037acSatyen Desai },
7d507382f17958718343411514753ac813c037acSatyen Desai
7d507382f17958718343411514753ac813c037acSatyen Desai testMoreThanOneSection : function() {
7d507382f17958718343411514753ac813c037acSatyen Desai Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", "active"), "yui3-menuitem-active");
7d507382f17958718343411514753ac813c037acSatyen Desai },
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
7d507382f17958718343411514753ac813c037acSatyen Desai testMoreThanOneSectionNoPrefix : function() {
7d507382f17958718343411514753ac813c037acSatyen Desai Y.Assert.areEqual(Y.ClassNameManager.getClassName("menuitem", "active", true), "menuitem-active");
7d507382f17958718343411514753ac813c037acSatyen Desai }
7d507382f17958718343411514753ac813c037acSatyen Desai });
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai var suite = new Y.Test.Suite("ClassNameManager Tests");
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai suite.add(new Y.Test.Case(testClassNameManager));
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.setName("ClassNameManager Tests");
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.add(suite);
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.disableLogging();
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.run();
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai var console;
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.one("#btnRun").set("disabled", false).on("click", function() {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai if (!console) {
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai console = new Y.Console({
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai id:"console",
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai width:"100%",
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai height:"90%",
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai verbose : false,
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai printTimeout: 0,
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai newestOnTop : false,
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai entryTemplate: '<pre class="{entry_class} {cat_class} {src_class}">'+
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai '<span class="{entry_cat_class}">{label}</span>'+
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai '<span class="{entry_content_class}">{message}</span>'+
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai '</pre>'
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }).render();
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai }
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.enableLogging();
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai Y.Test.Runner.run();
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai });
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots });
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots</script>
98c1ab155c0e2148f69291b1abe1007c9d5a08e8Satyen Desai<p><input type="button" value="Run Tests" id="btnRun" disabled=true></p>
f0356c78ab4c064aefae40965cbaf2b9b92efe99Todd Kloots</body>
47f7380215b8e35dd4da7b1dde41e85467f13777Luke Smith</html>