<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<map name="navmap">
<area id="testArea" shape=rect coords="0,0,100,100" href="#"> 
</map>
<img id="testImage" border=2 width=100 height=100 ismap>
<div id="description"></div>
<div id="console"></div>
<script>
description("Tests that usemap attribute parsing logic.");

var areaWasClicked = false;
document.getElementById("testArea").onclick = function() {
    areaWasClicked = true;
};

function testUsemapAttribute(usemap, shouldMatch)
{
    debug("usemap=" + usemap);
    document.getElementById("testImage").setAttribute("usemap", usemap);

    areaWasClicked = false;
    if (window.eventSender) {
        eventSender.mouseMoveTo(50, 50);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
    shouldBe("areaWasClicked", "" + shouldMatch);
    debug("");
}

testUsemapAttribute("#navmap", true);
testUsemapAttribute("navmap", false);
testUsemapAttribute("#navMap", false);
testUsemapAttribute("foo#navmap", true);
testUsemapAttribute("foo#navmap2", false);
testUsemapAttribute("navmap#", false);
testUsemapAttribute("navmap#bar", false);
testUsemapAttribute("#", false);
testUsemapAttribute("", false);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
