array.html revision cb4f4f79feb7498d1f3406b88fb62209e5f5a444
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore<script type="text/javascript" src="/build/yui/yui.js"></script>
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore logExclude: {
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore attribute: true,
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore widget: true,
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore selector: true
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore useConsole: true
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore }).use("dump", "test", "console", "event-custom", function(Y) {
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore var button = Y.get('#btnRun');
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore // Set up the page
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore button.set("disabled", false);
826ac02a0def83e0a41b29321470d299c7389aabGarrett D'Amore Y.on("click", function() {
var myConsole = new Y.Console().render();
var testArray = new Y.Test.Case({
Y.ArrayAssert.itemsAreEqual([1, 100, 2, 3], [3, 100, 1, 2].sort());
Y.Array.some(a, function(v) {
Y.fail('truthy value did not stop iteration');
if (a.some) {
a.some(function(v) {
Y.fail('truthy value did not stop iteration');
var els = document.getElementsByTagName('span'),
a = Y.Array(els, 1),
nodes = Y.all('span'),
b = Y.Array(nodes, 1);
// Y.Lang.type is broken for HTMLElementCollections in Safari. isObject
Y.log('els typeof:' + typeof els); // function
// array. If Array.test is adapted to handle NodeLists this could be made to
Y.Assert.areEqual(2, Y.Array.test(arguments), 'arguments should be arraylike'); // arguments collection
Y.Assert.areEqual(2, Y.Array.test(document.getElementsByTagName('span')), 'htmlelement collections should be arraylike'); // HTMLElementsCollection
// Y.Assert.areEqual(3, Y.Array.test(Y.all('#btnRun')), 'nodelists should be specifically identified as a special collection'); // NodeList
Y.Assert.areEqual(0, Y.Array.test(Y.all('span')), 'nodelists are not currently considered arraylike'); // NodeList
Y.Test.Runner.add(testArray);