Remove everywhere on-tap
Recommended by polymer team to remove legacy on tap for on click. On click has better performance and is well supported by browsers. Change-Id: I30a03ae9c7f721d561b11784d07fb186a9fa0407
This commit is contained in:
		@@ -89,7 +89,7 @@
 | 
			
		||||
      this._tooltip = tooltip;
 | 
			
		||||
      this.listen(window, 'scroll', '_handleWindowScroll');
 | 
			
		||||
      this.listen(this, 'mouseleave', '_handleHideTooltip');
 | 
			
		||||
      this.listen(this, 'tap', '_handleHideTooltip');
 | 
			
		||||
      this.listen(this, 'click', '_handleHideTooltip');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleHideTooltip(e) {
 | 
			
		||||
@@ -101,7 +101,7 @@
 | 
			
		||||
 | 
			
		||||
      this.unlisten(window, 'scroll', '_handleWindowScroll');
 | 
			
		||||
      this.unlisten(this, 'mouseleave', '_handleHideTooltip');
 | 
			
		||||
      this.unlisten(this, 'tap', '_handleHideTooltip');
 | 
			
		||||
      this.unlisten(this, 'click', '_handleHideTooltip');
 | 
			
		||||
      this.setAttribute('title', this._titleText);
 | 
			
		||||
      if (this._tooltip && this._tooltip.parentNode) {
 | 
			
		||||
        this._tooltip.parentNode.removeChild(this._tooltip);
 | 
			
		||||
 
 | 
			
		||||
@@ -127,7 +127,7 @@ limitations under the License.
 | 
			
		||||
    <section class$="spacer [[_computeShowOptional(_optionalLabels.*)]]"></section>
 | 
			
		||||
    <section
 | 
			
		||||
        show-bottom-border$="[[_showOptionalLabels]]"
 | 
			
		||||
        on-tap="_handleShowHide"
 | 
			
		||||
        on-click="_handleShowHide"
 | 
			
		||||
        class$="showHide [[_computeShowOptional(_optionalLabels.*)]]">
 | 
			
		||||
      <div class="title">Other labels</div>
 | 
			
		||||
      <div class="value">
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ limitations under the License.
 | 
			
		||||
          <input id="rebaseOnParentInput"
 | 
			
		||||
              name="rebaseOptions"
 | 
			
		||||
              type="radio"
 | 
			
		||||
              on-tap="_handleRebaseOnParent">
 | 
			
		||||
              on-click="_handleRebaseOnParent">
 | 
			
		||||
          <label id="rebaseOnParentLabel" for="rebaseOnParentInput">
 | 
			
		||||
            Rebase on parent change
 | 
			
		||||
          </label>
 | 
			
		||||
@@ -77,7 +77,7 @@ limitations under the License.
 | 
			
		||||
              name="rebaseOptions"
 | 
			
		||||
              type="radio"
 | 
			
		||||
              disabled$="[[!_displayTipOption(rebaseOnCurrent, hasParent)]]"
 | 
			
		||||
              on-tap="_handleRebaseOnTip">
 | 
			
		||||
              on-click="_handleRebaseOnTip">
 | 
			
		||||
          <label id="rebaseOnTipLabel" for="rebaseOnTipInput">
 | 
			
		||||
            Rebase on top of the [[branch]]
 | 
			
		||||
            branch<span hidden$="[[!hasParent]]">
 | 
			
		||||
@@ -93,7 +93,7 @@ limitations under the License.
 | 
			
		||||
          <input id="rebaseOnOtherInput"
 | 
			
		||||
              name="rebaseOptions"
 | 
			
		||||
              type="radio"
 | 
			
		||||
              on-tap="_handleRebaseOnOther">
 | 
			
		||||
              on-click="_handleRebaseOnOther">
 | 
			
		||||
          <label id="rebaseOnOtherLabel" for="rebaseOnOtherInput">
 | 
			
		||||
            Rebase on a specific change, ref, or commit <span hidden$="[[!hasParent]]">
 | 
			
		||||
              (breaks relation chain)
 | 
			
		||||
@@ -106,7 +106,7 @@ limitations under the License.
 | 
			
		||||
              query="[[_query]]"
 | 
			
		||||
              no-debounce
 | 
			
		||||
              text="{{_text}}"
 | 
			
		||||
              on-tap="_handleEnterChangeNumberTap"
 | 
			
		||||
              on-click="_handleEnterChangeNumberClick"
 | 
			
		||||
              allow-non-suggested-values
 | 
			
		||||
              placeholder="Change number, ref, or commit hash">
 | 
			
		||||
          </gr-autocomplete>
 | 
			
		||||
 
 | 
			
		||||
@@ -136,7 +136,7 @@
 | 
			
		||||
      this.$.parentInput.focus();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleEnterChangeNumberTap() {
 | 
			
		||||
    _handleEnterChangeNumberClick() {
 | 
			
		||||
      this.$.rebaseOnOtherInput.checked = true;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -280,7 +280,7 @@ limitations under the License.
 | 
			
		||||
    </style>
 | 
			
		||||
    <div
 | 
			
		||||
        id="container"
 | 
			
		||||
        on-tap="_handleFileListTap">
 | 
			
		||||
        on-click="_handleFileListClick">
 | 
			
		||||
      <div class="header-row row">
 | 
			
		||||
        <div class="status"></div>
 | 
			
		||||
        <div class="path">File</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -561,7 +561,7 @@
 | 
			
		||||
     * Handle all events from the file list dom-repeat so event handleers don't
 | 
			
		||||
     * have to get registered for potentially very long lists.
 | 
			
		||||
     */
 | 
			
		||||
    _handleFileListTap(e) {
 | 
			
		||||
    _handleFileListClick(e) {
 | 
			
		||||
      // Traverse upwards to find the row element if the target is not the row.
 | 
			
		||||
      let row = e.target;
 | 
			
		||||
      while (!row.classList.contains('row') && row.parentElement) {
 | 
			
		||||
 
 | 
			
		||||
@@ -817,18 +817,18 @@ limitations under the License.
 | 
			
		||||
      assert.isTrue(commitReviewLabel.classList.contains('isReviewed'));
 | 
			
		||||
      assert.equal(markReviewLabel.textContent, 'MARK UNREVIEWED');
 | 
			
		||||
 | 
			
		||||
      const tapSpy = sandbox.spy(element, '_handleFileListTap');
 | 
			
		||||
      const clickSpy = sandbox.spy(element, '_handleFileListClick');
 | 
			
		||||
      MockInteractions.tap(markReviewLabel);
 | 
			
		||||
      assert.isTrue(saveStub.lastCall.calledWithExactly('/COMMIT_MSG', false));
 | 
			
		||||
      assert.isFalse(commitReviewLabel.classList.contains('isReviewed'));
 | 
			
		||||
      assert.equal(markReviewLabel.textContent, 'MARK REVIEWED');
 | 
			
		||||
      assert.isTrue(tapSpy.lastCall.args[0].defaultPrevented);
 | 
			
		||||
      assert.isTrue(clickSpy.lastCall.args[0].defaultPrevented);
 | 
			
		||||
 | 
			
		||||
      MockInteractions.tap(markReviewLabel);
 | 
			
		||||
      assert.isTrue(saveStub.lastCall.calledWithExactly('/COMMIT_MSG', true));
 | 
			
		||||
      assert.isTrue(commitReviewLabel.classList.contains('isReviewed'));
 | 
			
		||||
      assert.equal(markReviewLabel.textContent, 'MARK UNREVIEWED');
 | 
			
		||||
      assert.isTrue(tapSpy.lastCall.args[0].defaultPrevented);
 | 
			
		||||
      assert.isTrue(clickSpy.lastCall.args[0].defaultPrevented);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_computeFileStatusLabel', () => {
 | 
			
		||||
@@ -836,7 +836,7 @@ limitations under the License.
 | 
			
		||||
      assert.equal(element._computeFileStatusLabel('M'), 'Modified');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleFileListTap', () => {
 | 
			
		||||
    test('_handleFileListClick', () => {
 | 
			
		||||
      element._filesByPath = {
 | 
			
		||||
        '/COMMIT_MSG': {},
 | 
			
		||||
        'f1.txt': {},
 | 
			
		||||
@@ -848,7 +848,7 @@ limitations under the License.
 | 
			
		||||
        patchNum: '2',
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      const tapSpy = sandbox.spy(element, '_handleFileListTap');
 | 
			
		||||
      const clickSpy = sandbox.spy(element, '_handleFileListClick');
 | 
			
		||||
      const reviewStub = sandbox.stub(element, '_reviewFile');
 | 
			
		||||
      const toggleExpandSpy = sandbox.spy(element, '_togglePathExpanded');
 | 
			
		||||
 | 
			
		||||
@@ -858,26 +858,26 @@ limitations under the License.
 | 
			
		||||
      // Click on the expand button, resulting in _togglePathExpanded being
 | 
			
		||||
      // called and not resulting in a call to _reviewFile.
 | 
			
		||||
      row.querySelector('div.show-hide').click();
 | 
			
		||||
      assert.isTrue(tapSpy.calledOnce);
 | 
			
		||||
      assert.isTrue(clickSpy.calledOnce);
 | 
			
		||||
      assert.isTrue(toggleExpandSpy.calledOnce);
 | 
			
		||||
      assert.isFalse(reviewStub.called);
 | 
			
		||||
 | 
			
		||||
      // Click inside the diff. This should result in no additional calls to
 | 
			
		||||
      // _togglePathExpanded or _reviewFile.
 | 
			
		||||
      Polymer.dom(element.root).querySelector('gr-diff-host').click();
 | 
			
		||||
      assert.isTrue(tapSpy.calledTwice);
 | 
			
		||||
      assert.isTrue(clickSpy.calledTwice);
 | 
			
		||||
      assert.isTrue(toggleExpandSpy.calledOnce);
 | 
			
		||||
      assert.isFalse(reviewStub.called);
 | 
			
		||||
 | 
			
		||||
      // Click the reviewed checkbox, resulting in a call to _reviewFile, but
 | 
			
		||||
      // no additional call to _togglePathExpanded.
 | 
			
		||||
      row.querySelector('.markReviewed').click();
 | 
			
		||||
      assert.isTrue(tapSpy.calledThrice);
 | 
			
		||||
      assert.isTrue(clickSpy.calledThrice);
 | 
			
		||||
      assert.isTrue(toggleExpandSpy.calledOnce);
 | 
			
		||||
      assert.isTrue(reviewStub.calledOnce);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleFileListTap editMode', () => {
 | 
			
		||||
    test('_handleFileListClick editMode', () => {
 | 
			
		||||
      element._filesByPath = {
 | 
			
		||||
        '/COMMIT_MSG': {},
 | 
			
		||||
        'f1.txt': {},
 | 
			
		||||
@@ -890,12 +890,12 @@ limitations under the License.
 | 
			
		||||
      };
 | 
			
		||||
      element.editMode = true;
 | 
			
		||||
      flushAsynchronousOperations();
 | 
			
		||||
      const tapSpy = sandbox.spy(element, '_handleFileListTap');
 | 
			
		||||
      const clickSpy = sandbox.spy(element, '_handleFileListClick');
 | 
			
		||||
      const toggleExpandSpy = sandbox.spy(element, '_togglePathExpanded');
 | 
			
		||||
 | 
			
		||||
      // Tap the edit controls. Should be ignored by _handleFileListTap.
 | 
			
		||||
      // Tap the edit controls. Should be ignored by _handleFileListClick.
 | 
			
		||||
      MockInteractions.tap(element.$$('.editFileControls'));
 | 
			
		||||
      assert.isTrue(tapSpy.calledOnce);
 | 
			
		||||
      assert.isTrue(clickSpy.calledOnce);
 | 
			
		||||
      assert.isFalse(toggleExpandSpy.called);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,11 +55,11 @@ limitations under the License.
 | 
			
		||||
          <tr>
 | 
			
		||||
            <td>Number</td>
 | 
			
		||||
            <td class="checkboxContainer"
 | 
			
		||||
                on-tap="_handleCheckboxContainerTap">
 | 
			
		||||
                on-click="_handleCheckboxContainerClick">
 | 
			
		||||
              <input
 | 
			
		||||
                  type="checkbox"
 | 
			
		||||
                  name="number"
 | 
			
		||||
                  on-tap="_handleNumberCheckboxTap"
 | 
			
		||||
                  on-click="_handleNumberCheckboxClick"
 | 
			
		||||
                  checked$="[[showNumber]]">
 | 
			
		||||
            </td>
 | 
			
		||||
          </tr>
 | 
			
		||||
@@ -67,11 +67,11 @@ limitations under the License.
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td>[[item]]</td>
 | 
			
		||||
              <td class="checkboxContainer"
 | 
			
		||||
                  on-tap="_handleCheckboxContainerTap">
 | 
			
		||||
                  on-click="_handleCheckboxContainerClick">
 | 
			
		||||
                <input
 | 
			
		||||
                    type="checkbox"
 | 
			
		||||
                    name="[[item]]"
 | 
			
		||||
                    on-tap="_handleTargetTap"
 | 
			
		||||
                    on-click="_handleTargetClick"
 | 
			
		||||
                    checked$="[[!isColumnHidden(item, displayedColumns)]]">
 | 
			
		||||
              </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -49,28 +49,28 @@
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle a tap on a checkbox container and relay the tap to the checkbox it
 | 
			
		||||
     * Handle a click on a checkbox container and relay the click to the checkbox it
 | 
			
		||||
     * contains.
 | 
			
		||||
     */
 | 
			
		||||
    _handleCheckboxContainerTap(e) {
 | 
			
		||||
    _handleCheckboxContainerClick(e) {
 | 
			
		||||
      const checkbox = Polymer.dom(e.target).querySelector('input');
 | 
			
		||||
      if (!checkbox) { return; }
 | 
			
		||||
      checkbox.click();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle a tap on the number checkbox and update the showNumber property
 | 
			
		||||
     * Handle a click on the number checkbox and update the showNumber property
 | 
			
		||||
     * accordingly.
 | 
			
		||||
     */
 | 
			
		||||
    _handleNumberCheckboxTap(e) {
 | 
			
		||||
    _handleNumberCheckboxClick(e) {
 | 
			
		||||
      this.showNumber = Polymer.dom(e).rootTarget.checked;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle a tap on a displayed column checkboxes (excluding number) and
 | 
			
		||||
     * Handle a click on a displayed column checkboxes (excluding number) and
 | 
			
		||||
     * update the displayedColumns property accordingly.
 | 
			
		||||
     */
 | 
			
		||||
    _handleTargetTap(e) {
 | 
			
		||||
    _handleTargetClick(e) {
 | 
			
		||||
      this.set('displayedColumns', this._getDisplayedColumns());
 | 
			
		||||
    },
 | 
			
		||||
  });
 | 
			
		||||
 
 | 
			
		||||
@@ -119,41 +119,41 @@ limitations under the License.
 | 
			
		||||
          columns.filter(c => c !== 'Assignee'));
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleCheckboxContainerTap relayes taps to checkboxes', () => {
 | 
			
		||||
      sandbox.stub(element, '_handleNumberCheckboxTap');
 | 
			
		||||
      sandbox.stub(element, '_handleTargetTap');
 | 
			
		||||
    test('_handleCheckboxContainerClick relayes taps to checkboxes', () => {
 | 
			
		||||
      sandbox.stub(element, '_handleNumberCheckboxClick');
 | 
			
		||||
      sandbox.stub(element, '_handleTargetClick');
 | 
			
		||||
 | 
			
		||||
      MockInteractions.tap(
 | 
			
		||||
          element.$$('table tr:first-of-type .checkboxContainer'));
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxTap.calledOnce);
 | 
			
		||||
      assert.isFalse(element._handleTargetTap.called);
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxClick.calledOnce);
 | 
			
		||||
      assert.isFalse(element._handleTargetClick.called);
 | 
			
		||||
 | 
			
		||||
      MockInteractions.tap(
 | 
			
		||||
          element.$$('table tr:last-of-type .checkboxContainer'));
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxTap.calledOnce);
 | 
			
		||||
      assert.isTrue(element._handleTargetTap.calledOnce);
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxClick.calledOnce);
 | 
			
		||||
      assert.isTrue(element._handleTargetClick.calledOnce);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleNumberCheckboxTap', () => {
 | 
			
		||||
      sandbox.spy(element, '_handleNumberCheckboxTap');
 | 
			
		||||
    test('_handleNumberCheckboxClick', () => {
 | 
			
		||||
      sandbox.spy(element, '_handleNumberCheckboxClick');
 | 
			
		||||
 | 
			
		||||
      MockInteractions
 | 
			
		||||
          .tap(element.$$('.checkboxContainer input[name=number]'));
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxTap.calledOnce);
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxClick.calledOnce);
 | 
			
		||||
      assert.isTrue(element.showNumber);
 | 
			
		||||
 | 
			
		||||
      MockInteractions
 | 
			
		||||
          .tap(element.$$('.checkboxContainer input[name=number]'));
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxTap.calledTwice);
 | 
			
		||||
      assert.isTrue(element._handleNumberCheckboxClick.calledTwice);
 | 
			
		||||
      assert.isFalse(element.showNumber);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleTargetTap', () => {
 | 
			
		||||
      sandbox.spy(element, '_handleTargetTap');
 | 
			
		||||
    test('_handleTargetClick', () => {
 | 
			
		||||
      sandbox.spy(element, '_handleTargetClick');
 | 
			
		||||
      assert.include(element.displayedColumns, 'Assignee');
 | 
			
		||||
      MockInteractions
 | 
			
		||||
          .tap(element.$$('.checkboxContainer input[name=Assignee]'));
 | 
			
		||||
      assert.isTrue(element._handleTargetTap.calledOnce);
 | 
			
		||||
      assert.isTrue(element._handleTargetClick.calledOnce);
 | 
			
		||||
      assert.notInclude(element.displayedColumns, 'Assignee');
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ limitations under the License.
 | 
			
		||||
              type="radio"
 | 
			
		||||
              data-name$="[[item.name]]"
 | 
			
		||||
              data-url$="[[item.url]]"
 | 
			
		||||
              on-tap="_handleShowAgreement"
 | 
			
		||||
              on-click="_handleShowAgreement"
 | 
			
		||||
              disabled$="[[_disableAggreements(item, _groups, _signedAgreements)]]">
 | 
			
		||||
          <label id="claNewAgreementsLabel">[[item.name]]</label>
 | 
			
		||||
        </span>
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ limitations under the License.
 | 
			
		||||
          <template is="dom-repeat" items="[[_emails]]">
 | 
			
		||||
            <tr>
 | 
			
		||||
              <td class="emailColumn">[[item.email]]</td>
 | 
			
		||||
              <td class="preferredControl" on-tap="_handlePreferredControlTap">
 | 
			
		||||
              <td class="preferredControl" on-click="_handlePreferredControlClick">
 | 
			
		||||
                <iron-input
 | 
			
		||||
                    class="preferredRadio"
 | 
			
		||||
                    type="radio"
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@
 | 
			
		||||
      this.hasUnsavedChanges = true;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handlePreferredControlTap(e) {
 | 
			
		||||
    _handlePreferredControlClick(e) {
 | 
			
		||||
      if (e.target.classList.contains('preferredControl')) {
 | 
			
		||||
        e.target.firstElementChild.click();
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -119,7 +119,7 @@ limitations under the License.
 | 
			
		||||
        <hr>
 | 
			
		||||
        <p>
 | 
			
		||||
          More configuration options for Gerrit may be found in the
 | 
			
		||||
          <a on-tap="close" href$="[[settingsUrl]]">settings</a>.
 | 
			
		||||
          <a on-click="close" href$="[[settingsUrl]]">settings</a>.
 | 
			
		||||
        </p>
 | 
			
		||||
      </main>
 | 
			
		||||
      <footer>
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ limitations under the License.
 | 
			
		||||
                  is="dom-repeat"
 | 
			
		||||
                  items="[[_getTypes()]]"
 | 
			
		||||
                  as="type">
 | 
			
		||||
                <td class="notifControl" on-tap="_handleNotifCellTap">
 | 
			
		||||
                <td class="notifControl" on-click="_handleNotifCellClick">
 | 
			
		||||
                  <input
 | 
			
		||||
                      type="checkbox"
 | 
			
		||||
                      data-index$="[[projectIndex]]"
 | 
			
		||||
 
 | 
			
		||||
@@ -169,7 +169,7 @@
 | 
			
		||||
      this.hasUnsavedChanges = true;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleNotifCellTap(e) {
 | 
			
		||||
    _handleNotifCellClick(e) {
 | 
			
		||||
      const checkbox = Polymer.dom(e.target).querySelector('input');
 | 
			
		||||
      if (checkbox) { checkbox.click(); }
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ limitations under the License.
 | 
			
		||||
              aria-label$="[[item.name]]"
 | 
			
		||||
              class="autocompleteOption"
 | 
			
		||||
              role="option"
 | 
			
		||||
              on-tap="_handleTapItem">
 | 
			
		||||
              on-click="_handleClickItem">
 | 
			
		||||
            <span>[[item.text]]</span>
 | 
			
		||||
            <span class$="label [[_computeLabelClass(item)]]">[[item.label]]</span>
 | 
			
		||||
          </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,7 @@
 | 
			
		||||
      this.close();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleTapItem(e) {
 | 
			
		||||
    _handleClickItem(e) {
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      e.stopPropagation();
 | 
			
		||||
      let selected = e.target;
 | 
			
		||||
@@ -144,7 +144,7 @@
 | 
			
		||||
        selected = selected.parentElement;
 | 
			
		||||
      }
 | 
			
		||||
      this.fire('item-selected', {
 | 
			
		||||
        trigger: 'tap',
 | 
			
		||||
        trigger: 'click',
 | 
			
		||||
        selected,
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -128,7 +128,7 @@ limitations under the License.
 | 
			
		||||
      MockInteractions.tap(element.$.suggestions.querySelectorAll('li')[1]);
 | 
			
		||||
      flushAsynchronousOperations();
 | 
			
		||||
      assert.deepEqual(itemSelectedStub.lastCall.args[0].detail, {
 | 
			
		||||
        trigger: 'tap',
 | 
			
		||||
        trigger: 'click',
 | 
			
		||||
        selected: element.$.suggestions.querySelectorAll('li')[1],
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
@@ -141,7 +141,7 @@ limitations under the License.
 | 
			
		||||
          .lastElementChild);
 | 
			
		||||
      flushAsynchronousOperations();
 | 
			
		||||
      assert.deepEqual(itemSelectedStub.lastCall.args[0].detail, {
 | 
			
		||||
        trigger: 'tap',
 | 
			
		||||
        trigger: 'click',
 | 
			
		||||
        selected: element.$.suggestions.querySelectorAll('li')[0],
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -182,11 +182,11 @@
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    attached() {
 | 
			
		||||
      this.listen(document.body, 'tap', '_handleBodyTap');
 | 
			
		||||
      this.listen(document.body, 'click', '_handleBodyClick');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    detached() {
 | 
			
		||||
      this.unlisten(document.body, 'tap', '_handleBodyTap');
 | 
			
		||||
      this.unlisten(document.body, 'click', '_handleBodyClick');
 | 
			
		||||
      this.cancelDebouncer('update-suggestions');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@@ -210,7 +210,7 @@
 | 
			
		||||
 | 
			
		||||
    _handleItemSelect(e) {
 | 
			
		||||
      // Let _handleKeydown deal with keyboard interaction.
 | 
			
		||||
      if (e.detail.trigger !== 'tap') { return; }
 | 
			
		||||
      if (e.detail.trigger !== 'click') { return; }
 | 
			
		||||
      this._selected = e.detail.selected;
 | 
			
		||||
      this._commit();
 | 
			
		||||
    },
 | 
			
		||||
@@ -374,7 +374,7 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleBodyTap(e) {
 | 
			
		||||
    _handleBodyClick(e) {
 | 
			
		||||
      const eventPath = Polymer.dom(e).path;
 | 
			
		||||
      for (let i = 0; i < eventPath.length; i++) {
 | 
			
		||||
        if (eventPath[i] === this) {
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ limitations under the License.
 | 
			
		||||
        fill: var(--link-color);
 | 
			
		||||
      }
 | 
			
		||||
    </style>
 | 
			
		||||
    <button aria-label="Change star" on-tap="toggleStar">
 | 
			
		||||
    <button aria-label="Change star" on-click="toggleStar">
 | 
			
		||||
      <iron-icon
 | 
			
		||||
          class$="[[_computeStarClass(change.starred)]]"
 | 
			
		||||
          icon$="[[_computeStarIcon(change.starred)]]"></iron-icon>
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ limitations under the License.
 | 
			
		||||
          class="copyText"
 | 
			
		||||
          type="text"
 | 
			
		||||
          bind-value="[[text]]"
 | 
			
		||||
          on-tap="_handleInputTap"
 | 
			
		||||
          on-tap="_handleInputClick"
 | 
			
		||||
          readonly>
 | 
			
		||||
        <input
 | 
			
		||||
            id="input"
 | 
			
		||||
@@ -59,7 +59,7 @@ limitations under the License.
 | 
			
		||||
            class$="[[_computeInputClass(hideInput)]]"
 | 
			
		||||
            type="text"
 | 
			
		||||
            bind-value="[[text]]"
 | 
			
		||||
            on-tap="_handleInputTap"
 | 
			
		||||
            on-click="_handleInputClick"
 | 
			
		||||
            readonly>
 | 
			
		||||
      </iron-input>
 | 
			
		||||
      <gr-button id="button"
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@
 | 
			
		||||
      return hideInput ? 'hideInput' : '';
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleInputTap(e) {
 | 
			
		||||
    _handleInputClick(e) {
 | 
			
		||||
      e.preventDefault();
 | 
			
		||||
      Polymer.dom(e).rootTarget.select();
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ limitations under the License.
 | 
			
		||||
          element.$$('.copyToClipboard'));
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('_handleInputTap', () => {
 | 
			
		||||
    test('_handleInputClick', () => {
 | 
			
		||||
      const inputElement = element.$$('input');
 | 
			
		||||
      MockInteractions.tap(inputElement);
 | 
			
		||||
      assert.equal(inputElement.selectionStart, 0);
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ limitations under the License.
 | 
			
		||||
      <label
 | 
			
		||||
          class$="[[_computeLabelClass(readOnly, value, placeholder)]]"
 | 
			
		||||
          title$="[[_computeLabel(value, placeholder)]]"
 | 
			
		||||
          on-tap="_showDropdown">[[_computeLabel(value, placeholder)]]</label>
 | 
			
		||||
          on-click="_showDropdown">[[_computeLabel(value, placeholder)]]</label>
 | 
			
		||||
      <iron-dropdown id="dropdown"
 | 
			
		||||
          vertical-align="auto"
 | 
			
		||||
          horizontal-align="auto"
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,7 @@
 | 
			
		||||
      this.listen(this._target, 'focus', 'show');
 | 
			
		||||
      this.listen(this._target, 'mouseleave', 'hide');
 | 
			
		||||
      this.listen(this._target, 'blur', 'hide');
 | 
			
		||||
      this.listen(this._target, 'tap', 'hide');
 | 
			
		||||
      this.listen(this._target, 'click', 'hide');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    ready() {
 | 
			
		||||
@@ -118,7 +118,7 @@
 | 
			
		||||
      this.unlisten(this._target, 'focus', 'show');
 | 
			
		||||
      this.unlisten(this._target, 'mouseleave', 'hide');
 | 
			
		||||
      this.unlisten(this._target, 'blur', 'hide');
 | 
			
		||||
      this.unlisten(this._target, 'tap', 'hide');
 | 
			
		||||
      this.unlisten(this._target, 'click', 'hide');
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ limitations under the License.
 | 
			
		||||
            disabled="[[disabled]]"
 | 
			
		||||
            placeholder="[[placeholder]]"
 | 
			
		||||
            borderless></gr-autocomplete>
 | 
			
		||||
        <div id="trigger" on-tap="_handleTriggerTap">▼</div>
 | 
			
		||||
        <div id="trigger" on-click="_handleTriggerClick">▼</div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </template>
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    _handleTriggerTap(e) {
 | 
			
		||||
    _handleTriggerClick(e) {
 | 
			
		||||
      // Stop propagation here so we don't confuse gr-autocomplete, which
 | 
			
		||||
      // listens for taps on body to try to determine when it's blurred.
 | 
			
		||||
      e.stopPropagation();
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ limitations under the License.
 | 
			
		||||
      const e = {stopPropagation: () => undefined};
 | 
			
		||||
      sandbox.stub(e, 'stopPropagation');
 | 
			
		||||
      sandbox.stub(element.$.autocomplete, 'focus');
 | 
			
		||||
      element._handleTriggerTap(e);
 | 
			
		||||
      element._handleTriggerClick(e);
 | 
			
		||||
      assert.isTrue(e.stopPropagation.calledOnce);
 | 
			
		||||
      assert.isTrue(element.$.autocomplete.focus.calledOnce);
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user