Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri committed Mar 18, 2021
1 parent f78913c commit cde6dd6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/service/mutator-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
6 changes: 2 additions & 4 deletions src/service/resources-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/service/resources-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ export class ResourcesInterface {
* @param {!Element} element
* @param {number} newLayoutPriority
*/
updateLayoutPriority(element, newLayoutPriority) {}
updateLayoutPriority(element, newLayoutPriority) {}
}
/* eslint-enable no-unused-vars */
16 changes: 1 addition & 15 deletions test/integration/test-visibility-states.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
});
Expand All @@ -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) => {
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions test/unit/test-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cde6dd6

Please sign in to comment.