Commit 41b28682 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Fix some style issues with the virtual scroller's test .mjs

Just running clang-format

Change-Id: I855e9fd343c063d787f46a352895bfa834a97b13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1781131Reviewed-by: default avatarRakina Zata Amni <rakina@chromium.org>
Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693005}
parent 4e6be429
...@@ -207,8 +207,8 @@ export class VisibilityManager { ...@@ -207,8 +207,8 @@ export class VisibilityManager {
// which would involve an unknown number of forced layouts, we // which would involve an unknown number of forced layouts, we
// come back next frame and try to make it better. We know we can // come back next frame and try to make it better. We know we can
// stop when we didn't hide or reveal any elements. // stop when we didn't hide or reveal any elements.
if (this.#syncRevealed(newRevealed) + if (this.#syncRevealed(newRevealed) + this.#syncObserved(newObserved) >
this.#syncObserved(newObserved) > 0) { 0) {
this.scheduleSync(); this.scheduleSync();
} }
} }
......
...@@ -25,8 +25,8 @@ export function div(id) { ...@@ -25,8 +25,8 @@ export function div(id) {
*/ */
export function largeDiv(id) { export function largeDiv(id) {
const large = div(id); const large = div(id);
large.style.height = "5000px"; large.style.height = '5000px';
large.style.border = "solid"; large.style.border = 'solid';
return large; return large;
} }
...@@ -60,7 +60,7 @@ export function withElement(name, callback) { ...@@ -60,7 +60,7 @@ export function withElement(name, callback) {
* *
* This includes a hack to wait 1s to give the virtual-scroller * This includes a hack to wait 1s to give the virtual-scroller
* elements time to settle. * elements time to settle.
*/ */
export function stopWaiting() { export function stopWaiting() {
setTimeout(() => { setTimeout(() => {
document.documentElement.classList.remove('reftest-wait'); document.documentElement.classList.remove('reftest-wait');
...@@ -81,7 +81,7 @@ export function words(n) { ...@@ -81,7 +81,7 @@ export function words(n) {
/** /**
* Allow the next |n| frames to end and then call |callback| ASAP in * Allow the next |n| frames to end and then call |callback| ASAP in
* the following frame. * the following frame.
*/ */
export function inNFrames(n, callback) { export function inNFrames(n, callback) {
if (n == 0) { if (n == 0) {
window.setTimeout(callback, 0); window.setTimeout(callback, 0);
...@@ -95,7 +95,7 @@ export function inNFrames(n, callback) { ...@@ -95,7 +95,7 @@ export function inNFrames(n, callback) {
/** /**
* Allow the current frame to end and then call |callback| asap in the * Allow the current frame to end and then call |callback| asap in the
* next frame. * next frame.
*/ */
export function nextFrame(callback) { export function nextFrame(callback) {
inNFrames(1, callback); inNFrames(1, callback);
} }
...@@ -33,9 +33,9 @@ export function testLargeChild(target) { ...@@ -33,9 +33,9 @@ export function testLargeChild(target) {
// page reloads. // page reloads.
document.body.scrollTo(0, 0); document.body.scrollTo(0, 0);
helpers.nextFrame(() => { helpers.nextFrame(() => {
const largeChild = helpers.largeDiv("largeChild"); const largeChild = helpers.largeDiv('largeChild');
target.appendChild(largeChild); target.appendChild(largeChild);
const child = helpers.div("child"); const child = helpers.div('child');
target.appendChild(child); target.appendChild(child);
// Give the scroller time to settle. // Give the scroller time to settle.
...@@ -53,11 +53,11 @@ export function testLargeChildComment(target) { ...@@ -53,11 +53,11 @@ export function testLargeChildComment(target) {
// page reloads. // page reloads.
document.body.scrollTo(0, 0); document.body.scrollTo(0, 0);
helpers.nextFrame(() => { helpers.nextFrame(() => {
const largeChild = helpers.largeDiv("largeChild"); const largeChild = helpers.largeDiv('largeChild');
target.appendChild(largeChild); target.appendChild(largeChild);
// Ensure that non-element nodes don't cause problems. // Ensure that non-element nodes don't cause problems.
target.appendChild(document.createComment("comment")); target.appendChild(document.createComment('comment'));
target.appendChild(helpers.div("child")); target.appendChild(helpers.div('child'));
// Give the scroller time to settle. // Give the scroller time to settle.
helpers.inNFrames(10, () => { helpers.inNFrames(10, () => {
...@@ -114,9 +114,9 @@ export function testScrollFromOffScreen(target) { ...@@ -114,9 +114,9 @@ export function testScrollFromOffScreen(target) {
helpers.nextFrame(() => { helpers.nextFrame(() => {
// The page is a large element (much bigger than the page) // The page is a large element (much bigger than the page)
// followed by the scroller. We then scroll down to the scroller. // followed by the scroller. We then scroll down to the scroller.
const largeSibling = helpers.largeDiv("large"); const largeSibling = helpers.largeDiv('large');
target.before(largeSibling); target.before(largeSibling);
const child = helpers.div("child"); const child = helpers.div('child');
target.appendChild(child); target.appendChild(child);
// Give the scroller time to settle. // Give the scroller time to settle.
...@@ -130,18 +130,18 @@ export function testScrollFromOffScreen(target) { ...@@ -130,18 +130,18 @@ export function testScrollFromOffScreen(target) {
/** /**
* Runs |test| with a <virtual-scroller>, waiting until the custom element is * Runs |test| with a <virtual-scroller>, waiting until the custom element is
* defined. * defined.
*/ */
export function withVirtualScroller(test) { export function withVirtualScroller(test) {
customElements.whenDefined('virtual-scroller').then(() => { customElements.whenDefined('virtual-scroller').then(() => {
runTest("virtual-scroller", test); runTest('virtual-scroller', test);
}); });
} }
/** /**
* Runs |test| with a <div>. * Runs |test| with a <div>.
*/ */
export function withDiv(test) { export function withDiv(test) {
runTest("div", test); runTest('div', test);
} }
function runTest(elementName, test) { function runTest(elementName, test) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment