Merge "Remove nowrap on file name and reduce the min-width on comments" into stable-3.1
diff --git a/plugins/replication b/plugins/replication
index fefba17..94a465e 160000
--- a/plugins/replication
+++ b/plugins/replication
@@ -1 +1 @@
-Subproject commit fefba17b04224e9346a50f6e66944142f4878179
+Subproject commit 94a465e0989ff8124aca3dca8e200aeb870cc9dd
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
index 4ffcc9b..1627999 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -853,7 +853,8 @@
       Gerrit.awaitPluginsLoaded()
           .then(this._getLoggedIn.bind(this))
           .then(loggedIn => {
-            if (!loggedIn || this._change.status !== this.ChangeStatus.MERGED) {
+            if (!loggedIn || !this._change ||
+                this._change.status !== this.ChangeStatus.MERGED) {
             // Do not display dialog if not logged-in or the change is not
             // merged.
               return;
@@ -1203,6 +1204,7 @@
     },
 
     _getProjectConfig() {
+      if (!this._change) return;
       return this.$.restAPI.getProjectConfig(this._change.project).then(
           config => {
             this._projectConfig = config;
@@ -1317,6 +1319,7 @@
     _getLatestCommitMessage() {
       return this.$.restAPI.getChangeCommitInfo(this._changeNum,
           this.computeLatestPatchNum(this._allPatchSets)).then(commitInfo => {
+            if (!commitInfo) return Promise.resolve();
             this._latestCommitMessage =
                     this._prepareCommitMsgForLinkify(commitInfo.message);
           });
@@ -1500,6 +1503,10 @@
     },
 
     _getMergeability() {
+      if (!this._change) {
+        this._mergeable = null;
+        return Promise.resolve();
+      }
       // If the change is closed, it is not mergeable. Note: already merged
       // changes are obviously not mergeable, but the mergeability API will not
       // answer for abandoned changes.
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js
index 414abad..9da9c86 100644
--- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js
+++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js
@@ -34,16 +34,32 @@
   };
 
   /**
+   * Alias of onClick
+   * @see onClick
+   */
+  GrEventHelper.prototype.onTap = function(callback) {
+    return this._listen(this.element, callback);
+  };
+
+  /**
    * Add a callback to element click or touch.
    * The callback may return false to prevent event bubbling.
    * @param {function(Event):boolean} callback
    * @return {function()} Unsubscribe function.
    */
-  GrEventHelper.prototype.onTap = function(callback) {
+  GrEventHelper.prototype.onClick = function(callback) {
     return this._listen(this.element, callback);
   };
 
   /**
+   * Alias of captureClick
+   * @see captureClick
+   */
+  GrEventHelper.prototype.captureTap = function(callback) {
+    return this._listen(this.element.parentElement, callback, {capture: true});
+  };
+
+  /**
    * Add a callback to element click or touch ahead of normal flow.
    * Callback is installed on parent during capture phase.
    * https://www.w3.org/TR/DOM-Level-3-Events/#event-flow
@@ -51,13 +67,13 @@
    * @param {function(Event):boolean} callback
    * @return {function()} Unsubscribe function.
    */
-  GrEventHelper.prototype.captureTap = function(callback) {
+  GrEventHelper.prototype.captureClick = function(callback) {
     return this._listen(this.element.parentElement, callback, {capture: true});
   };
 
   GrEventHelper.prototype._listen = function(container, callback, opt_options) {
     const capture = opt_options && opt_options.capture;
-    const event = opt_options && opt_options.event || 'tap';
+    const event = opt_options && opt_options.event || 'click';
     const handler = e => {
       if (e.path.indexOf(this.element) !== -1) {
         let mayContinue = true;
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.html b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.html
index 896238f..d33a88c 100644
--- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.html
+++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.html
@@ -74,14 +74,23 @@
       instance.onTap(() => {
         done();
       });
-      element.fire('tap');
+      MockInteractions.tap(element);
     });
 
     test('onTap() cancel', () => {
       const tapStub = sandbox.stub();
-      element.parentElement.addEventListener('tap', tapStub);
+      Polymer.Gestures.addListener(element.parentElement, 'tap', tapStub);
       instance.onTap(() => false);
-      element.fire('tap');
+      MockInteractions.tap(element);
+      flushAsynchronousOperations();
+      assert.isFalse(tapStub.called);
+    });
+
+    test('onClick() cancel', () => {
+      const tapStub = sandbox.stub();
+      element.parentElement.addEventListener('click', tapStub);
+      instance.onTap(() => false);
+      MockInteractions.tap(element);
       flushAsynchronousOperations();
       assert.isFalse(tapStub.called);
     });
@@ -90,14 +99,30 @@
       instance.captureTap(() => {
         done();
       });
-      element.fire('tap');
+      MockInteractions.tap(element);
+    });
+
+    test('captureClick()', done => {
+      instance.captureClick(() => {
+        done();
+      });
+      MockInteractions.tap(element);
     });
 
     test('captureTap() cancels tap()', () => {
       const tapStub = sandbox.stub();
-      element.addEventListener('tap', tapStub);
+      Polymer.Gestures.addListener(element.parentElement, 'tap', tapStub);
       instance.captureTap(() => false);
-      element.fire('tap');
+      MockInteractions.tap(element);
+      flushAsynchronousOperations();
+      assert.isFalse(tapStub.called);
+    });
+
+    test('captureClick() cancels click()', () => {
+      const tapStub = sandbox.stub();
+      element.addEventListener('click', tapStub);
+      instance.captureTap(() => false);
+      MockInteractions.tap(element);
       flushAsynchronousOperations();
       assert.isFalse(tapStub.called);
     });
diff --git a/polygerrit-ui/app/test/index.html b/polygerrit-ui/app/test/index.html
index 20964bf..a1c3ae6 100644
--- a/polygerrit-ui/app/test/index.html
+++ b/polygerrit-ui/app/test/index.html
@@ -187,8 +187,7 @@
     'shared/gr-js-api-interface/gr-api-utils_test.html',
     'shared/gr-js-api-interface/gr-js-api-interface_test.html',
     'shared/gr-js-api-interface/gr-gerrit_test.html',
-    // TODO: uncomment file & fix tests.
-    // 'shared/gr-js-api-interface/gr-plugin-action-context_test.html',
+    'shared/gr-js-api-interface/gr-plugin-action-context_test.html',
     'shared/gr-js-api-interface/gr-plugin-endpoints_test.html',
     'shared/gr-js-api-interface/gr-plugin-rest-api_test.html',
     'shared/gr-fixed-panel/gr-fixed-panel_test.html',