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