From cde6dd66d9441b62aa29138497e11e1e959ca1f7 Mon Sep 17 00:00:00 2001 From: Jake Fried Date: Thu, 18 Mar 2021 13:34:18 -0400 Subject: [PATCH] lint --- src/service/mutator-impl.js | 2 +- src/service/resources-impl.js | 6 ++---- src/service/resources-interface.js | 2 +- test/integration/test-visibility-states.js | 16 +--------------- test/unit/test-resource.js | 2 -- test/unit/test-resources.js | 4 ++-- 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/service/mutator-impl.js b/src/service/mutator-impl.js index fd3637bc6c449..e0b2a6a3d1eee 100644 --- a/src/service/mutator-impl.js +++ b/src/service/mutator-impl.js @@ -21,7 +21,7 @@ import {Services} from '../services'; import {areMarginsChanged} from '../layout-rect'; import {closest} from '../dom'; import {computedStyle} from '../style'; -import {dev, devAssert} from '../log'; +import {dev} from '../log'; import {isExperimentOn} from '../experiments'; import {registerServiceBuilderForDoc} from '../service'; diff --git a/src/service/resources-impl.js b/src/service/resources-impl.js index fb6739d54e02e..ad75d4c88ed19 100644 --- a/src/service/resources-impl.js +++ b/src/service/resources-impl.js @@ -27,13 +27,11 @@ import {VisibilityState} from '../visibility-state'; import {dev, devAssert} from '../log'; import {dict} from '../utils/object'; import {expandLayoutRect} from '../layout-rect'; -import {getMode} from '../mode'; import {getSourceUrl} from '../url'; -import {hasNextNodeInDocumentOrder, isIframed} from '../dom'; +import {hasNextNodeInDocumentOrder} from '../dom'; import {ieIntrinsicCheckAndFix} from './ie-intrinsic-bug'; import {ieMediaCheckAndFix} from './ie-media-bug'; import {isBlockedByConsent, reportError} from '../error'; -import {isExperimentOn} from '../experiments'; import {listen, loadPromise} from '../event-helper'; import {registerServiceBuilderForDoc} from '../service'; import {remove} from '../utils/array'; @@ -1325,7 +1323,7 @@ export class ResourcesImpl { } else { const {resource} = task; - let stillDisplayed = true; + const stillDisplayed = true; // Remeasure can only update isDisplayed(), not in-viewport state. resource.measure(); diff --git a/src/service/resources-interface.js b/src/service/resources-interface.js index 59ebd57dba8c1..3002507165067 100644 --- a/src/service/resources-interface.js +++ b/src/service/resources-interface.js @@ -174,6 +174,6 @@ export class ResourcesInterface { * @param {!Element} element * @param {number} newLayoutPriority */ - updateLayoutPriority(element, newLayoutPriority) {} + updateLayoutPriority(element, newLayoutPriority) {} } /* eslint-enable no-unused-vars */ diff --git a/test/integration/test-visibility-states.js b/test/integration/test-visibility-states.js index 30b29c36fbef0..f71b32e8a4063 100644 --- a/test/integration/test-visibility-states.js +++ b/test/integration/test-visibility-states.js @@ -70,12 +70,8 @@ t.run('Viewer Visibility State', () => { let shouldPass = false; let doPass_; - let intersect_; let notifyPass = noop; - let intersected; - let notifyIntersected; - function doPass() { if (shouldPass) { doPass_.call(this); @@ -84,14 +80,9 @@ t.run('Viewer Visibility State', () => { } } - function intersect() { - intersect_.apply(this, arguments); - notifyIntersected(); - } - function waitForNextPass() { return new Promise((resolve) => { - notifyPass = resolve; + notifyPass = resolve; shouldPass = true; resources.schedulePass(); }); @@ -108,9 +99,6 @@ t.run('Viewer Visibility State', () => { win = env.win; notifyPass = noop; shouldPass = false; - intersected = new Promise((resolve) => { - notifyIntersected = resolve; - }); const vsync = Services.vsyncFor(win); env.sandbox.stub(vsync, 'mutate').callsFake((mutator) => { @@ -130,9 +118,7 @@ t.run('Viewer Visibility State', () => { resources = Services.resourcesForDoc(win.document); doPass_ = resources.doPass; - intersect_ = resources.intersect; env.sandbox.stub(resources, 'doPass').callsFake(doPass); - env.sandbox.stub(resources, 'intersect').callsFake(intersect); const img = win.document.createElement('amp-img'); img.setAttribute('width', 100); diff --git a/test/unit/test-resource.js b/test/unit/test-resource.js index 91df4a8c63367..ca781e4ed4728 100644 --- a/test/unit/test-resource.js +++ b/test/unit/test-resource.js @@ -29,11 +29,9 @@ describes.realWin('Resource', {amp: true}, (env) => { let elementMock; let resources; let resource; - let sandbox; beforeEach(() => { win = env.win; - sandbox = env.sandbox; doc = win.document; element = env.createAmpElement('amp-fake-element'); diff --git a/test/unit/test-resources.js b/test/unit/test-resources.js index e767679ac54ae..9ce59e7855709 100644 --- a/test/unit/test-resources.js +++ b/test/unit/test-resources.js @@ -722,7 +722,7 @@ describes.realWin('Resources discoverWork', {amp: true}, (env) => { resources.discoverWork_(); expect(resource1.hasBeenMeasured()).to.be.true; - }); + }); it('should render two screens when visible', () => { resources.visible_ = true; @@ -913,7 +913,7 @@ describes.realWin('Resources discoverWork', {amp: true}, (env) => { resources.work_(); expect(resource1.getState()).to.equal(ResourceState.LAYOUT_SCHEDULED); expect(resource1.element.layoutScheduleTime).to.be.greaterThan(0); - }); + }); it('should not schedule resource execution outside viewport', () => { resources.scheduleLayoutOrPreload(resource1, true);