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

<ul id="tree0" role="tree" aria-labelledby="treelabel" aria-activedescendant="tree0_item0_2_0_1" tabindex="0">
    <li id="tree0_item0" role="treeitem" aria-level="1" aria-expanded="true">
        <span>
            <span class="expander"></span>
        Animals
        </span>
        <ul role="group">
             <li id="tree0_item0_0" role="treeitem" aria-level="2"><span>Birds</span></li>
        </ul>
     </li>
</ul>

<p id="description"></p>
<div id="console"></div>
<div id="notifications"></div>

<script>

    description("This tests that when aria-expanded is toggled, the appropriate notifications are sent out");

    var axTree = 0;
    var notifyCount = 0;
    var notifyName = 0;
    // The order of notifications should be Row Count, Row Collapsed, Row Count, Row Expanded
    function notifyCallback(element, notification) {  
        if (notification == "AXLoadComplete"
            || notification == "AXLayoutComplete"
            || notification == "AXFocusChanged")
            return;
        notifyName = notification;
        if (notifyCount == 0)
            shouldBeEqualToString("notifyName", "AXRowCountChanged");
        else if (notifyCount == 1)
            shouldBeEqualToString("notifyName", "AXRowCollapsed");
        else if (notifyCount == 2)
            shouldBeEqualToString("notifyName", "AXRowCountChanged");
        else if (notifyCount == 3) {
            shouldBeEqualToString("notifyName", "AXRowExpanded");
            accessibilityController.removeNotificationListener();
            finishJSTest();
        }
        notifyCount++;
    }

    if (window.accessibilityController) {
        jsTestIsAsync = true;

        var domTree = document.getElementById("tree0");
        domTree.focus();

        axTree = window.accessibilityController.focusedElement;

        var addedNotification = accessibilityController.addNotificationListener(notifyCallback);
        shouldBe("addedNotification", "true");

        accessibilityController.accessibleElementById("tree0");
        accessibilityController.accessibleElementById("tree0_item0");

        // the first aria-expanded should generate row count, row collapsed.
        document.getElementById("tree0_item0").setAttribute("aria-expanded", "false");

        // the second aria-expanded should generate row count, row expanded.
        document.getElementById("tree0_item0").setAttribute("aria-expanded", "true");
    }

</script>
</body>
</html>
