chromium/third_party/blink/web_tests/fast/forms/formaction-attribute.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<form action="javascript: failTest(this)" method="get">
<input id="button1" type="submit" formaction="javascript: passTest1(this)" />
<button id="button2" type="submit" formaction="javascript: passTest2(this)" />
<button type="submit" formaction="javascript: passTest3(this)">
  <span id="span" formaction="javascript: failTest2(this)">submit</span>
</button>
</form>
<script>
description("Test for formaction attributes in input and button tags.");
var doneAction = false;
jsTestIsAsync = true;

function failTest(ul)
{
    doneAction = true;
    testFailed('The formaction attribute in the input or button tag was ignored.');
}
function failTest2(ul)
{
    doneAction = true;
    testFailed('The formaction attribute in the span tag was used.');
}
function passTest1(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the input tag was used.');
}
function passTest2(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the button tag was used.');
}
function passTest3(ul)
{
    doneAction = true;
    testPassed('The formaction attribute in the button tag was used.');
}

function test1() {
    doneAction = false;
    var input = document.getElementById('button1');
    input.click();
    setTimeout(function() {
        if (!doneAction)
            testFailed('Both of the action and the formaction attributes were ignored.');
        test2();
    }, 0);
}

function test2() {
    doneAction = false;
    var input = document.getElementById('button1');
    clickElement(input);
    setTimeout(function() {
        if (!doneAction)
            testFailed('Both of the action and the formaction attributes were ignored.');
        test3();
    }, 0);
}

function test3() {
    doneAction = false;
    var button = document.getElementById('button2');
    button.click();
    setTimeout(function() {
        if (!doneAction)
            testFailed('Both of the action and the formaction attributes were ignored.');
        test4();
    }, 0);
}

function test4() {
    doneAction = false;
    var span = document.getElementById('span');
    span.click();
    setTimeout(function() {
        if (!doneAction)
            testFailed('Both of the action and the formaction attributes were ignored.');
        finishJSTest();
    }, 0);
}

test1();
</script>
</body>
</html>