<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/accessibility-helper.js"></script>
<script src="../../resources/js-test.js"></script>
</head>
<body>

<ul id="tree" role="tree" aria-labelledby="treelabel" aria-activedescendant="tree0_item0_2_0_1" tabindex="0">
    <li id="treeitem1" role="treeitem" aria-level="1" aria-expanded="true">
        <span>
            <span class="expander"></span>
            Animals
            </span>
            <ul role="group">
                <div id="treeitem2" role="treeitem" aria-level="2"><span>Birds</span></div>
                <li id="treeitem3" role="treeitem" aria-level="2" aria-expanded="true">
                    <span>
                        <span class="expander"></span>
                        Cats
                    </span>
                    <ul role="group">
                        <li id="tree0_item0_1_0" role="treeitem"aria-level="3"><span>Siamese</span></li>
                        <li id="tree0_item0_1_1" role="treeitem" aria-level="3"><span>Tabby</span></li>
                    </ul>
                </li>
            </ul>
        </span>
    </li>

    <li id="treeitem4" role="treeitem" aria-expanded="true">
        <span>
            <span class="expander"></span>
            Vegetables
            </span>
            <ul role="group">
                <div id="treeitem5" role="treeitem"><span>Carrots</span></div>
                <div id="treeitem6" role="treeitem"><span>Broccoli</span></div>
            </ul>
        </span>
    </li>
</ul>

<script>
    var testOutput = "This tests that aria trees and tree items are converted into AXOutlines and AXRows, with all the right attributes.\n\n";

    if (window.accessibilityController) {
        window.jsTestIsAsync = true;

        // Test tree attributes.
        var tree = accessibilityController.accessibleElementById("tree");
        testOutput += expect("tree.role", "'AXRole: AXOutline'");
        var canSetRows = tree.isAttributeSettable('AXSelectedRows');
        testOutput += expect("canSetRows", "true");
        testOutput += expect("tree.childrenCount", "8");
  
        // Test tree item attributes.
        var treeitem1 = tree.childAtIndex(0);
        testOutput += expect("treeitem1.role", "'AXRole: AXRow'");
        testOutput += expect("treeitem1.subrole", "'AXSubrole: AXOutlineRow'");
        testOutput += expect("treeitem1.isExpanded", "true");
        testOutput += expect("treeitem1.hierarchicalLevel", "0");
        var canSetDisclosing = treeitem1.isAttributeSettable('AXDisclosing');
        testOutput += expect("canSetDisclosing", "true");

        // Test more tree item attributes as we dive i,
        var treeitem2 = treeitem1.disclosedRowAtIndex(0);
        testOutput += expect("treeitem2.role", "'AXRole: AXRow'");
        testOutput += expect("treeitem2.subrole", "'AXSubrole: AXOutlineRow'");
        testOutput += expect("treeitem2.isExpanded", "false");
        testOutput += expect("treeitem2.hierarchicalLevel", "1");
        testOutput += expect("treeitem2.disclosedByRow().isEqual(treeitem1)", "true");
        canSetDisclosing = treeitem2.isAttributeSettable('AXDisclosing');
        testOutput += expect("canSetDisclosing", "false");

        var treeitem3 = treeitem2.childAtIndex(0);
        testOutput += expect("treeitem3.stringValue", "'AXValue: Birds'");
        canSetDisclosing = treeitem3.isAttributeSettable('AXDisclosing');
        testOutput += expect("canSetDisclosing", "false");

        // Test more AXRow attributes and values as we dive further in.
        treeitem3 = treeitem1.disclosedRowAtIndex(1);
        testOutput += expect("treeitem3.role", "'AXRole: AXRow'");
        testOutput += expect("treeitem3.subrole", "'AXSubrole: AXOutlineRow'");
        testOutput += expect("treeitem3.isExpanded", "true");

        // test that the row can be selected correctly.
        testOutput += expect("treeitem3.isSelected", "false");
        document.getElementById("treeitem3").setAttribute("aria-selected", true);
        testOutput += expect("treeitem3.isSelected", "true");

        // Test that the tree reports the right selected row (treeitem3)
        var selectedRow = tree.selectedRowAtIndex(0);
        testOutput += expect("selectedRow.isEqual(treeitem3)", "true");

        // Test that hierarchicalLevel can be computed automatically, also,
        // and that it's consistent with the ARIA level.
        var treeitem4 = accessibilityController.accessibleElementById("treeitem4");
        testOutput += expect("treeitem4.hierarchicalLevel", "0");

        var treeitem5 = accessibilityController.accessibleElementById("treeitem5");
        testOutput += expect("treeitem5.hierarchicalLevel", "1");

        var treeitem6 = accessibilityController.accessibleElementById("treeitem6");
        testOutput += expect("treeitem6.hierarchicalLevel", "1");

        testOutput += "\nUpdating aria-level of #treeitem2 to 3.\n";
        document.getElementById("treeitem2").setAttribute("aria-level", "3");
        setTimeout(async function() {
            await waitFor(() => treeitem2.hierarchicalLevel === 2);
            testOutput += expect("treeitem2.hierarchicalLevel", "2");

            debug(testOutput);
            finishJSTest();
        }, 0);
    }
</script>
</body>
</html>

