|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>Permission Element: invalid if precise attribute is changed</title> |
| 6 | + <link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md" /> |
| 7 | + <script src="/resources/testharness.js"></script> |
| 8 | + <script src="/resources/testharnessreport.js"></script> |
| 9 | + </head> |
| 10 | + <body> |
| 11 | + <script> |
| 12 | + promise_test(async (t) => { |
| 13 | + let is_element_valid = false; |
| 14 | + const element = document.createElement("permission"); |
| 15 | + element.setAttribute("type", "geolocation"); |
| 16 | + element.onvalidationstatuschange = t.step_func(() => { |
| 17 | + if (element.invalidReason == "") { |
| 18 | + is_element_valid = true; |
| 19 | + } |
| 20 | + if (element.invalidReason == "attribute_changed") { |
| 21 | + is_element_valid = false; |
| 22 | + } |
| 23 | + }); |
| 24 | + document.body.appendChild(element); |
| 25 | + |
| 26 | + // wait for the element to be ready. |
| 27 | + await t.step_wait(() => is_element_valid === true); |
| 28 | + |
| 29 | + // setting the preciselocation attribute should temporarily disable the element. |
| 30 | + element.setAttribute("preciselocation", ""); |
| 31 | + await t.step_wait(() => is_element_valid === false); |
| 32 | + await t.step_wait(() => is_element_valid === true); |
| 33 | + |
| 34 | + // uusetting the preciselocation attribute should temporarily disable the element. |
| 35 | + element.removeAttribute("preciselocation"); |
| 36 | + await t.step_wait(() => is_element_valid === false); |
| 37 | + await t.step_wait(() => is_element_valid === true); |
| 38 | + }, "Permission element is invalid temporarily if the precise attribute is changed."); |
| 39 | + </script> |
| 40 | + </body> |
| 41 | +</html> |
0 commit comments