Skip to content

Commit

Permalink
(2021-01-27, b738789) visibility-trigger-improvements: 1
Browse files Browse the repository at this point in the history
Previous history on prod-config.json:

- b738789 - 2021-01-27T13:32:15-08:00 - Launch layout-aspect-ratio-css to 1%
- c0de64d - 2021-01-19T20:39:22-05:00 - Revert "✨ Implement sticky ad bottom type ad on amp-ad (ampproject#31491)"
- 5f43080 - 2021-01-07T13:54:47-08:00 - ✨ Implement sticky ad bottom type ad on amp-ad
  • Loading branch information
mohammed-ibra committed Jan 1, 2025
1 parent aeee979 commit 7417503
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
1 change: 0 additions & 1 deletion build-system/global-configs/canary-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"dfp-render-on-idle-cwv-exp": 1,
"flexAdSlots": 0.05,
"ios-fixed-no-transfer": 1,
"visibility-trigger-improvements": 1,
"ads-initialIntersection": 1,
"amp-cid-backup": 1,
"sticky-ad-transition": 0.1,
Expand Down
1 change: 0 additions & 1 deletion build-system/global-configs/prod-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"doubleclickSraReportExcludedBlock": 0.1,
"flexAdSlots": 0.05,
"ios-fixed-no-transfer": 0,
"visibility-trigger-improvements": 1,
"layout-aspect-ratio-css": 0,
"sticky-ad-transition": 0.02,
"disable-a4a-non-sd": 1,
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-analytics/0.1/analytics-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
import {dev, user, userAssert} from '../../../src/log';
import {getMode} from '../../../src/mode';
import {isArray} from '../../../src/types';
import {isExperimentOn} from '../../../src/experiments';
import {layoutRectLtwh} from '../../../src/layout-rect';
import {map} from '../../../src/utils/object';
import {provideVisibilityManager} from './visibility-manager';
Expand Down Expand Up @@ -342,7 +341,8 @@ export class AnalyticsRoot {
*/
getElements(context, selectors, selectionMethod) {
if (
isExperimentOn(this.ampdoc.win, 'visibility-trigger-improvements') &&
/* isExperimentOn(this.ampdoc.win, 'visibility-trigger-improvements') // launched: true */
true &&
isArray(selectors)
) {
userAssert(
Expand Down
22 changes: 12 additions & 10 deletions extensions/amp-analytics/0.1/test/test-analytics-root.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
VisibilityManagerForDoc,
VisibilityManagerForEmbed,
} from '../visibility-manager';
import {toggleExperiment} from '../../../../src/experiments';
import {user} from '../../../../src/log';

describes.realWin('AmpdocAnalyticsRoot', {amp: 1}, (env) => {
Expand Down Expand Up @@ -339,11 +338,11 @@ describes.realWin('AmpdocAnalyticsRoot', {amp: 1}, (env) => {
child.setAttribute('data-vars-id', 'child1');
child2.setAttribute('data-vars-id', 'child2');
child3.setAttribute('data-vars-id', 'child3');
toggleExperiment(win, 'visibility-trigger-improvements', true);
});

afterEach(() => {
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
});

it('should find element and elements by selector', async () => {
Expand All @@ -355,7 +354,8 @@ describes.realWin('AmpdocAnalyticsRoot', {amp: 1}, (env) => {
child2,
]);
// Check that non-experiment works
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
expect(
await root.getElements(body, '.notMyClass', null)
).to.deep.equal([child3]);
Expand Down Expand Up @@ -421,7 +421,8 @@ describes.realWin('AmpdocAnalyticsRoot', {amp: 1}, (env) => {
});

it('should find non AMP element with single selector', async () => {
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
child.classList.remove('i-amphtml-element');
child.removeAttribute('data-vars-id');
child.classList.add('myClass');
Expand Down Expand Up @@ -753,21 +754,21 @@ describes.realWin(
child.setAttribute('data-vars-id', '123');
child2.setAttribute('data-vars-id', '456');
child3.setAttribute('data-vars-id', '789');

toggleExperiment(win, 'visibility-trigger-improvements', true);
});

afterEach(() => {
child.classList.add('i-amphtml-element');
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
});

it('should find all elements by selector', async () => {
const elements = await root.getElements(body, ['.myClass'], null);

expect(elements).to.deep.equals([child, child2]);
// Check that non-experiment version works
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
expect(
await root.getElements(body, '.notMyClass', null)
).to.deep.equals([child3]);
Expand Down Expand Up @@ -829,7 +830,8 @@ describes.realWin(
});

it('should find non AMP element with single selector', async () => {
toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
child.classList.remove('i-amphtml-element');
expect(await root.getElements(body, '.myClass', null)).to.deep.equal([
child,
Expand Down
5 changes: 2 additions & 3 deletions extensions/amp-analytics/0.1/test/test-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {AmpdocAnalyticsRoot} from '../analytics-root';
import {Deferred} from '../../../../src/utils/promise';
import {Signals} from '../../../../src/utils/signals';
import {macroTask} from '../../../../testing/yield';
import {toggleExperiment} from '../../../../src/experiments';

describes.realWin('Events', {amp: 1}, (env) => {
let win;
Expand Down Expand Up @@ -2001,7 +2000,6 @@ describes.realWin('Events', {amp: 1}, (env) => {
let target2;

beforeEach(() => {
toggleExperiment(win, 'visibility-trigger-improvements', true);
readyPromise = Promise.resolve();
unlisten = env.sandbox.spy();
unlisten2 = env.sandbox.spy();
Expand Down Expand Up @@ -2045,7 +2043,8 @@ describes.realWin('Events', {amp: 1}, (env) => {
});
}

toggleExperiment(win, 'visibility-trigger-improvements', false);
/* toggleExperiment(win, 'visibility-trigger-improvements', false) // launched: true */
false;
});

it('should fire event per selector', async () => {
Expand Down
6 changes: 0 additions & 6 deletions tools/experiments/experiments-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ export const EXPERIMENTS = [
spec: 'https://github.com/ampproject/amphtml/issues/20595',
cleanupIssue: 'https://github.com/ampproject/amphtml/issues/26709',
},
{
id: 'visibility-trigger-improvements',
name: 'AMP Analytics Visibility Trigger Improvements',
spec: 'https://github.com/ampproject/amphtml/issues/26823',
cleanupIssue: 'https://github.com/ampproject/amphtml/issues/26823',
},
{
id: 'a4a-no-signing',
name: 'Remove signing requirement for AMPHTML ads',
Expand Down

0 comments on commit 7417503

Please sign in to comment.