<!DOCTYPE html>
<title>Credential Management API: create() basics.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function(t) {
    return promise_rejects(t, "NotSupportedError",
            navigator.credentials.create());
}, "navigator.credentials.create() with no argument.");

promise_test(function(t) {
    return promise_rejects(t, "NotSupportedError",
            navigator.credentials.create({}));
}, "navigator.credentials.create() with empty argument.");

promise_test(function(t) {
    var credential_data = {
        id: 'id',
        password: 'pencil',
    };

    return navigator.credentials.create({password: credential_data})
        .then(function(credential) {
            assert_equals(credential.id, 'id');
            assert_equals(credential.name, '');
            assert_equals(credential.iconURL, '');
            assert_equals(credential.type, 'password');
            assert_equals(credential.password, 'pencil');
        });
}, "navigator.credentials.create() with valid PasswordCredentialData");

promise_test(function(t) {
    var f = document.createElement('form');
    f.innerHTML = "<input type='text' name='theId' value='musterman' autocomplete='username'>"
        + "<input type='text' name='thePassword' value='sekrit' autocomplete='current-password'>"
        + "<input type='text' name='theIcon' value='https://example.com/photo' autocomplete='photo'>"
        + "<input type='text' name='theExtraField' value='extra'>"
        + "<input type='text' name='theName' value='friendly name' autocomplete='name'>";

    return navigator.credentials.create({password: f})
        .then(function(credential) {
            assert_equals(credential.id, 'musterman');
            assert_equals(credential.name, 'friendly name');
            assert_equals(credential.iconURL, 'https://example.com/photo');
            assert_equals(credential.type, 'password');
            assert_equals(credential.password, 'sekrit');
        });
}, "navigator.credentials.create() with valid HTMLFormElement");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({password: "bogus password data"}));
}, "navigator.credentials.create() with bogus password data");

promise_test(function(t) {
    var federated_data = {
        id: 'id',
        provider: 'https://example.com/',
    };

    return navigator.credentials.create({federated: federated_data})
        .then(function(credential) {
            assert_equals(credential.id, 'id');
            assert_equals(credential.name, '');
            assert_equals(credential.iconURL, '');
            assert_equals(credential.type, 'federated');
        });
}, "navigator.credentials.create() with valid FederatedCredentialData");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({federated: "bogus federated data"}));
}, "navigator.credentials.create() with bogus federated data");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({publicKey: "bogus publicKey data"}));
}, "navigator.credentials.create() with bogus publicKey data");

promise_test(function(t) {
    var publicKey = {
        challenge: new TextEncoder().encode("climb a mountain"),
        rp: {
            id: "1098237235409872",
            name: "Acme"
        },

        user: {
            id: "1098237235409872",
            name: "avery.a.jones@example.com",
            displayName: "Avery A. Jones",
            icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
        },

        parameters: [{
            type: "public-key",
            algorithm: "ES256",
        },],

        timeout: 60000,  // 1 minute
        excludeList: [], // No excludeList
    };

    return navigator.credentials.create({publicKey}).then(r => {
    assert_true(r instanceof PublicKeyCredential);
    });
}, "navigator.credentials.create() returns PublicKeyCredential");

promise_test(function(t) {
    var credential_data = {
        id: 'id',
        password: 'pencil',
    };

    var federated_data = {
        id: 'id',
        provider: 'https://example.com/',
    };

    return promise_rejects(t, "NotSupportedError",
            navigator.credentials.create({
                password: credential_data,
                federated: federated_data,
            }));
}, "navigator.credentials.create() with both PasswordCredentialData and FederatedCredentialData");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({
                password: "bogus password data",
                federated: "bogus federated data",
            }));
}, "navigator.credentials.create() with bogus password and federated data");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({
                federated: "bogus federated data",
                publicKey: "bogus publicKey data",
            }));
}, "navigator.credentials.create() with bogus federated and publicKey data");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({
                password: "bogus password data",
                publicKey: "bogus publicKey data",
            }));
}, "navigator.credentials.create() with bogus password and publicKey data");

promise_test(function(t) {
    return promise_rejects(t, new TypeError(),
            navigator.credentials.create({
                password: "bogus password data",
                federated: "bogus federated data",
                publicKey: "bogus publicKey data",
            }));
}, "navigator.credentials.create() with bogus password, federated, and publicKey data");

promise_test(function(t) {
    return promise_rejects(t, "NotSupportedError",
            navigator.credentials.create({bogus_key: "bogus data"}));
}, "navigator.credentials.create() with bogus data");
</script>
