From 16d86f79d4d3fc4b004e857aef36aee145b46268 Mon Sep 17 00:00:00 2001 From: Carlos Vializ Date: Mon, 5 Jun 2017 14:08:31 -0700 Subject: [PATCH] Remove experiment for input-debounced. Update docs. (#9724) --- spec/amp-actions-and-events.md | 2 +- src/service/action-impl.js | 6 ------ test/functional/test-action.js | 34 +--------------------------------- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/spec/amp-actions-and-events.md b/spec/amp-actions-and-events.md index 1eee512793b3..a20e1ea2f822 100644 --- a/spec/amp-actions-and-events.md +++ b/spec/amp-actions-and-events.md @@ -110,7 +110,7 @@ Including: `input[type=radio]`, `input[type=checkbox]`, `input[type=range]`, and input-debounced - Fired when the value of the element is changed. This is similar to the standard input event, but it only fires when 300ms have passed after the value of the input has stopped changing. This is currently experimental, so [the "input-debounced" experiment must be enabled](https://www.ampproject.org/docs/reference/experimental) before using. + Fired when the value of the element is changed. This is similar to the standard input event, but it only fires when 300ms have passed after the value of the input has stopped changing. Various, see below. diff --git a/src/service/action-impl.js b/src/service/action-impl.js index e1828b08569a..7f7512898a83 100644 --- a/src/service/action-impl.js +++ b/src/service/action-impl.js @@ -23,7 +23,6 @@ import { } from '../service'; import {getMode} from '../mode'; import {isArray} from '../types'; -import {isExperimentOn} from '../experiments'; import {map} from '../utils/object'; import {timerFor} from '../services'; import {vsyncFor} from '../services'; @@ -364,11 +363,6 @@ export class ActionService { for (let i = 0; i < action.actionInfos.length; i++) { const actionInfo = action.actionInfos[i]; - if (actionInfo.event === 'input-debounced') { - user().assert(isExperimentOn(this.ampdoc.win, 'input-debounced'), - 'Enable "input-debounced" experiment to use input-debounced'); - } - // Replace any variables in args with data in `event`. const args = applyActionInfoArgs(actionInfo.args, event); diff --git a/test/functional/test-action.js b/test/functional/test-action.js index fe838bbcf65f..832e20427fa4 100644 --- a/test/functional/test-action.js +++ b/test/functional/test-action.js @@ -24,7 +24,6 @@ import { import {AmpDocSingle} from '../../src/service/ampdoc-impl'; import {KeyCodes} from '../../src/utils/key-codes'; import {createCustomEvent} from '../../src/event-helper'; -import {toggleExperiment} from '../../src/experiments'; import {setParentWindow} from '../../src/service'; import * as sinon from 'sinon'; @@ -927,14 +926,13 @@ describes.sandboxed('Action global target', {}, () => { describes.fakeWin('Core events', {amp: true}, env => { let sandbox; - let win; let window; let document; let action; let triggerPromise; beforeEach(() => { - win = window = env.win; + window = env.win; document = window.document; sandbox = env.sandbox; sandbox.stub(window.document, 'addEventListener'); @@ -954,10 +952,6 @@ describes.fakeWin('Core events', {amp: true}, env => { action.vsync_ = {mutate: callback => callback()}; }); - afterEach(() => { - toggleExperiment(win, 'input-debounced', false); - }); - it('should trigger tap event on click', () => { expect(window.document.addEventListener).to.have.been.calledWith('click'); const handler = window.document.addEventListener.getCall(0).args[1]; @@ -1051,7 +1045,6 @@ describes.fakeWin('Core events', {amp: true}, env => { }); it('should trigger input-debounced event on input', () => { - toggleExperiment(window, 'input-debounced', true); sandbox.stub(action, 'invoke_'); const handler = window.document.addEventListener.getCall(4).args[1]; const element = document.createElement('input'); @@ -1070,31 +1063,6 @@ describes.fakeWin('Core events', {amp: true}, env => { const value = event.target.value; return value == 'foo bar baz'; })); - toggleExperiment(window, 'input-debounced', false); - }, () => { - assert.fail('Should succeed with experiment.'); - }); - }); - - it('should not handle input-debounced event without experiment', () => { - const handler = window.document.addEventListener.getCall(4).args[1]; - const element = document.createElement('input'); - element.setAttribute('on', 'input-debounced:body.hide'); - element.value = 'foo bar baz'; - const event = {target: element}; - handler(event); - - return triggerPromise.then(() => { - assert.fail('Should not succeed without experiment.'); - }, error => { - expect(error).to.match(/"input-debounced" experiment/); - expect(action.trigger).to.have.been.calledWith( - element, - 'input-debounced', - sinon.match(event => { - const value = event.target.value; - return value == 'foo bar baz'; - })); }); });