Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/components/prompts/test/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 4 kB image not shown  

Quelle  test_dom_prompts.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/toolkit/components/prompts/test/test_dom_prompts.html


<html>
<head>
  <title>Test for DOM prompts</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="text/javascript" src="prompt_common.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
</pre>

<script class="testbody" type="text/javascript">
var rv;
var state, action;
modalType = Ci.nsIPrompt.MODAL_TYPE_CONTENT;

add_task(async function test_alert_ok() {
    info("Starting test: Alert");
    state = {
        msg: "This is the alert text.",
        iconClass: "alert-icon",
        titleHidden: true,
        textHidden: true,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "button0",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    alert("This is the alert text.");

    await promptDone;
});

// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(async function test_alert_noargs() {
    info("Starting test: Alert with no args");
    state = {
        msg: "",
        iconClass: "alert-icon",
        titleHidden: true,
        textHidden: true,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "button0",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    try {
        alert();
        ok(true, "alert() without arguments should not throw!");
    } catch (e) {
        ok(false, "alert() without arguments should not throw!");
    }

    await promptDone;
});

add_task(async function test_confirm_ok() {
    info("Starting test: Confirm");
    state = {
        msg: "This is the confirm text.",
        iconClass: "question-icon",
        titleHidden: true,
        textHidden: true,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "button0",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    rv = confirm("This is the confirm text.");
    is(rv, true, "check prompt return value");

    await promptDone;
});

// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(async function test_confirm_noargs() {
    info("Starting test: Confirm with no args");
    state = {
        msg: "",
        iconClass: "question-icon",
        titleHidden: true,
        textHidden: true,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "button0",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    try {
        rv = confirm();
        ok(true, "confirm() without arguments should not throw!");
    } catch (e) {
        ok(false, "confirm() without arguments should not throw!");
    }
    is(rv, true, "check prompt return value");

    await promptDone;
});


add_task(async function test_prompt_ok() {
    info("Starting test: Prompt");
    state = {
        msg: "This is the Prompt text.",
        iconClass: "question-icon",
        titleHidden: true,
        textHidden: false,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "textField",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    rv = prompt("This is the Prompt text.");
    is(rv, """check prompt return value");

    await promptDone;
});

// bug 861605 made the arguments to alert/confirm optional (prompt already was).
add_task(async function test_prompt_noargs() {
    info("Starting test: Prompt with no args");
    state = {
        msg: "",
        iconClass: "question-icon",
        titleHidden: true,
        textHidden: false,
        passHidden: true,
        checkHidden: true,
        textValue: "",
        passValue: "",
        checkMsg: "",
        checked: false,
        focused: "textField",
        defButton: "button0",
    };
    action = {
        buttonClick: "ok",
    };

    let promptDone = handlePrompt(state, action);

    try {
        rv = prompt();
        ok(true, "prompt() without arguments should not throw!");
    } catch (e) {
        ok(false, "prompt() without arguments should not throw!");
    }
    is(rv, """check prompt return value");

    await promptDone;
});

</script>

</body>
</html>

Messung V0.5
C=94 H=96 G=94

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.