| <!DOCTYPE html> |
| <title>Tests for DigitalCredential's userAgentAllowsProtocol() static method.</title> |
| <link rel="help" href="https://github.com/w3c-fedid/digital-credentials/pull/221" /> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| |
| <body></body> |
| <script type="module"> |
| |
| const invalidIdentifiers = ["", " ", "a b", "a,b", "AB", "a.B", "a.b", " foo-bar", " foo-bar ", "foo-bar ", "fooBar"]; |
| |
| promise_test(async (t) => { |
| for (const invalidIdentifier of invalidIdentifiers) { |
| const result = DigitalCredential.userAgentAllowsProtocol(invalidIdentifier); |
| assert_equals(result, false, `Incorrect result for ${invalidIdentifier}.`); |
| } |
| }, "User agent does not allow invalid protocol identifiers."); |
| |
| </script> |