Evaluate parent list class on merged changes
The binding for the class attribute of the parent list in change
metadata depends on the parent-is-current boolean. The boolean in-turn
depends on the rebase revision action. Formerly, if the rebase action
was not present at all (as it is not on merged changes) the boolean
would be left as `undefined` and the binding would not evaluate.
As a result, the class would not be set and the parent list would not
show numbers next to parents on merged merge changes.
With this change, the boolean is given a value whether or not the rebase
action is present and tests are updated to confirm this.
Change-Id: I1e4734d825d2ed0b2f00b1866b2a057e9097c676
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
index 7e661c7..758a862 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
@@ -370,7 +370,7 @@
server-config="[[_serverConfig]]"
missing-labels="[[_missingLabels]]"
mutable="[[_loggedIn]]"
- parent-is-current="[[!_rebaseOriginallyEnabled]]"
+ parent-is-current="[[_parentIsCurrent]]"
on-show-reply-dialog="_handleShowReplyDialog">
</gr-change-metadata>
<!-- Plugins insert content into following container.
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 fd9a490..b4fb92a 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
@@ -224,7 +224,7 @@
value: false,
observer: '_updateToggleContainerClass',
},
- _rebaseOriginallyEnabled: Boolean,
+ _parentIsCurrent: Boolean,
},
behaviors: [
@@ -938,8 +938,10 @@
if (revisionActions && revisionActions.rebase) {
revisionActions.rebase.rebaseOnCurrent =
!!revisionActions.rebase.enabled;
- this._rebaseOriginallyEnabled = !!revisionActions.rebase.enabled;
+ this._parentIsCurrent = !revisionActions.rebase.enabled;
revisionActions.rebase.enabled = true;
+ } else {
+ this._parentIsCurrent = true;
}
return revisionActions;
},
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
index d8367610..7d4a54b 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html
@@ -399,6 +399,7 @@
title: 'Rebase onto tip of branch or parent change',
},
};
+ element._parentIsCurrent = undefined;
// Rebase enabled should always end up true.
// When rebase is enabled initially, rebaseOnCurrent should be set to
@@ -408,6 +409,7 @@
assert.isTrue(currentRevisionActions.rebase.enabled);
assert.isTrue(currentRevisionActions.rebase.rebaseOnCurrent);
+ assert.isFalse(element._parentIsCurrent);
delete currentRevisionActions.rebase.enabled;
@@ -418,6 +420,21 @@
assert.isTrue(currentRevisionActions.rebase.enabled);
assert.isFalse(currentRevisionActions.rebase.rebaseOnCurrent);
+ assert.isTrue(element._parentIsCurrent);
+ });
+
+ test('_updateRebaseAction sets _parentIsCurrent on no rebase', () => {
+ const currentRevisionActions = {
+ cherrypick: {
+ enabled: true,
+ label: 'Cherry Pick',
+ method: 'POST',
+ title: 'cherrypick',
+ },
+ };
+ element._parentIsCurrent = undefined;
+ element._updateRebaseAction(currentRevisionActions);
+ assert.isTrue(element._parentIsCurrent);
});
test('_reload is called when an approved label is removed', () => {