array.html revision 52671ce4f644d565b2acd71a8ce4f6d20829a67c
<html>
<head>
<title>YUI Array Tests</title>
</head>
<body class="yui-skin-sam">
<h1>Array Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>
<script type="text/javascript">
(function() {
YUI({
base: "/build/",
filter: "debug",
logExclude: {
attribute: true,
dom: true,
node: true,
event: true,
base: true,
widget: true,
selector: true
},
useConsole: true
}).use("dump", "test", "console", "event-custom", function(Y) {
var button = Y.get('#btnRun');
// Set up the page
button.set("disabled", false);
Y.on("click", function() {
}, button);
var myConsole = new Y.Console().render();
var testArray = new Y.Test.Case({
name: "Array tests",
'[3, 100, 1, 2] should produce [1, 2, 3, 100] when sorted': function() {
// the stock sort behavior should fail to produce desired result
Y.ArrayAssert.itemsAreEqual([1, 100, 2, 3], [3, 100, 1, 2].sort());
Y.ArrayAssert.itemsAreEqual([1, 2, 3, 100], [3, 100, 1, 2].sort(Y.Array.numericSort));
}
});
Y.Test.Runner.add(testArray);
});
})();
</script>
</body>
</html>