can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
48 lines (44 loc) • 1.45 kB
HTML
<html>
<head>
<title>testing debugging and logging functions</title>
<script type="text/javascript">
djConfig = {};
djConfig.isDebug = document.location.href.match(/\?ON/);
</script>
<script type="text/javascript" src="../../../dojo.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
var toggle = document.getElementById("toggle").innerHTML = djConfig.isDebug?"ON":"OFF";
});
var aString = "this is my test string";
var anObject = {
aProperty: "aValue",
anotherProperty: "anotherValue",
aNumber: 1234
};
var cn = ["debug","log",
"assert", "count", "dir", "dirxml", "error", "group",
"groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
"trace", "warn"
];
for(var i=0;i<cn.length;i++) {
console[cn[i]]( cn[i] + ": " + aString);
console[cn[i]]( cn[i] + ": " + anObject);
}
</script>
</head>
<body>
<p>
Testing console.* methods with djConfig.isDebug turned <span id="toggle"></span>
</p>
<p>
Append '?ON' to URL to try with djConfig.isDebug turned ON. Remove it to test djConfig.isDebug turned OFF
</p>
<p>
If isDebug is off (false), then make sure console functions go to a simple empty function. You may see
errors in the console, since console.error is being tested as part of this test.
</p>
</body>
</html>