Skip to content

Commit

Permalink
Fix :granted selector never changing to false
Browse files Browse the repository at this point in the history
Permission element now has the right style when the permission is revoked

Bug: 347250842
Change-Id: I590ca83d8a244a27c153f3974b3c0230170fb09a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5851072
Auto-Submit: Ravjit Uppal <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Commit-Queue: Ravjit Uppal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1361720}
  • Loading branch information
Ravjit authored and chromium-wpt-export-bot committed Sep 30, 2024
1 parent 6b7b634 commit 1ff0d85
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions html/semantics/permission-element/granted-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<meta charset=utf-8>
<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<body>

<permission id="permission_element" type="camera">

<script>
promise_test(async() => {

// Set the initial camera state to denied.
await test_driver.set_permission({name: "camera"}, "denied");
await navigator.permissions.query({name: "camera"});

assert_false(permission_element.matches(":granted"));

// Set the camera state to allowed.
await test_driver.set_permission({name: "camera"}, "granted");
await navigator.permissions.query({name: "camera"});

// The granted selector should now be applied.
assert_true(permission_element.matches(":granted"));

// Set the camera state to denied.
await test_driver.set_permission({name: "camera"}, "denied");
await navigator.permissions.query({name: "camera"});

// The granted selector should now be removed.
assert_false(permission_element.matches(":granted"));

}, "Permission element should not have the granted selector when the \
permission is not granted.")
</script>

0 comments on commit 1ff0d85

Please sign in to comment.