Skip to content

Commit

Permalink
[DL]: Rename isLocked to locked as per design principle.
Browse files Browse the repository at this point in the history
As https://w3ctag.github.io/design-principles/#api-surface suggests,
boolean attributes should not have "is" at the beginning of their names.

This patch fixes this for DisplayLockContext.isLocked

R=chrishtr@chromium.org

Bug: 882663, github.com/WICG/display-locking/issues/43
Change-Id: Ie5be4b4f6fd0ee8656fbb3c31aae0e7eb0fc3612
Reviewed-on: https://chromium-review.googlesource.com/c/1466155
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632467}
  • Loading branch information
vmpstr authored and Commit Bot committed Feb 15, 2019
1 parent a4ac9c7 commit 0582192
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Expand Up @@ -23,5 +23,5 @@ interface DisplayLockContext {

// Returns true if this context is locked. In other words, if true, then any
// changes to the subtree of this element would not be reflected visually on screen.
[ImplementedAs=IsLocked] readonly attribute boolean isLocked;
[ImplementedAs=IsLocked] readonly attribute boolean locked;
};
Expand Up @@ -15,32 +15,32 @@
async_test((t) => {
async function runTest() {
let container = document.getElementById("container");
t.step(() => assert_false(container.displayLock.isLocked, "initial context is unlocked"));
t.step(() => assert_false(container.displayLock.locked, "initial context is unlocked"));

let acquire_promise = container.displayLock.acquire({ timeout: Infinity });
t.step(() => assert_false(container.displayLock.isLocked, "context before acquire finishes is unlocked"));
t.step(() => assert_false(container.displayLock.locked, "context before acquire finishes is unlocked"));

await acquire_promise;
t.step(() => assert_true(container.displayLock.isLocked, "context after acquire finishes is locked"));
t.step(() => assert_true(container.displayLock.locked, "context after acquire finishes is locked"));

let update_promise = container.displayLock.update();
t.step(() => assert_true(container.displayLock.isLocked, "context during update is locked"));
t.step(() => assert_true(container.displayLock.locked, "context during update is locked"));

await update_promise;
t.step(() => assert_true(container.displayLock.isLocked, "context after update is locked"));
t.step(() => assert_true(container.displayLock.locked, "context after update is locked"));

let commit_promise = container.displayLock.commit();
t.step(() => assert_true(container.displayLock.isLocked, "context during commit is locked"));
t.step(() => assert_true(container.displayLock.locked, "context during commit is locked"));

await commit_promise;
t.step(() => assert_false(container.displayLock.isLocked, "context after commit is unlocked"));
t.step(() => assert_false(container.displayLock.locked, "context after commit is unlocked"));

t.done();
}

window.onload = function() {
requestAnimationFrame(() => requestAnimationFrame(runTest));
};
}, "isLocked attribute");
}, "locked attribute");
</script>

Expand Up @@ -16,34 +16,34 @@
async function runTest() {
let container = document.createElement("div");
container.id = "container";
assert_false(container.displayLock.isLocked, "initial context is unlocked");
assert_false(container.displayLock.locked, "initial context is unlocked");

let acquire_promise = container.displayLock.acquire({ timeout: Infinity });
t.step(() => assert_true(container.displayLock.isLocked, "context before acquire finishes is locked"));
t.step(() => assert_true(container.displayLock.locked, "context before acquire finishes is locked"));

await acquire_promise;
t.step(() => assert_true(container.displayLock.isLocked, "context after acquire finishes is locked"));
t.step(() => assert_true(container.displayLock.locked, "context after acquire finishes is locked"));

document.getElementById("parent").appendChild(container);

let update_promise = container.displayLock.update();
t.step(() => assert_true(container.displayLock.isLocked, "context during update is locked"));
t.step(() => assert_true(container.displayLock.locked, "context during update is locked"));

await update_promise;
t.step(() => assert_true(container.displayLock.isLocked, "context after update is locked"));
t.step(() => assert_true(container.displayLock.locked, "context after update is locked"));

let commit_promise = container.displayLock.commit();
t.step(() => assert_true(container.displayLock.isLocked, "context during commit is locked"));
t.step(() => assert_true(container.displayLock.locked, "context during commit is locked"));

await commit_promise;
t.step(() => assert_false(container.displayLock.isLocked, "context after commit is unlocked"));
t.step(() => assert_false(container.displayLock.locked, "context after commit is unlocked"));

t.done();
}

window.onload = function() {
requestAnimationFrame(() => requestAnimationFrame(runTest));
};
}, "isLocked attribute");
}, "locked attribute");
</script>

0 comments on commit 0582192

Please sign in to comment.