array.html revision 0771d781138a507b3e657573703f511291640bf3
<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>