Merge "Do not collapse delta groups in context control group if they are focussed"
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
index 984391d..e2a1d63 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
@@ -277,7 +277,8 @@
 
     return html`<section id="relatedChanges">
       <gr-related-collapse
-        title="Relation chain"
+        .name=${'Relation chain'}
+        title="parent changes are ordered after child changes"
         class=${classMap({first: isFirst})}
         .length=${this.relatedChanges.length}
         .numChangesWhenCollapsed=${sectionSize(Section.RELATED_CHANGES)}
@@ -342,7 +343,8 @@
     );
     return html`<section id="submittedTogether">
       <gr-related-collapse
-        title="Submitted together"
+        .name=${'Submitted together'}
+        title="parent changes are ordered after child changes"
         class=${classMap({first: isFirst})}
         .length=${submittedTogetherChanges.length}
         .numChangesWhenCollapsed=${sectionSize(Section.SUBMITTED_TOGETHER)}
@@ -405,7 +407,7 @@
     );
     return html`<section id="sameTopic">
       <gr-related-collapse
-        title="Same topic"
+        .name=${'Same topic'}
         class=${classMap({first: isFirst})}
         .length=${this.sameTopicChanges.length}
         .numChangesWhenCollapsed=${sectionSize(Section.SAME_TOPIC)}
@@ -445,7 +447,7 @@
     );
     return html`<section id="mergeConflicts">
       <gr-related-collapse
-        title="Merge conflicts"
+        .name=${'Merge conflicts'}
         class=${classMap({first: isFirst})}
         .length=${this.conflictingChanges.length}
         .numChangesWhenCollapsed=${sectionSize(Section.MERGE_CONFLICTS)}
@@ -490,7 +492,7 @@
     );
     return html`<section id="cherryPicks">
       <gr-related-collapse
-        title="Cherry picks"
+        .name=${'Cherry picks'}
         class=${classMap({first: isFirst})}
         .length=${this.cherryPickChanges.length}
         .numChangesWhenCollapsed=${sectionSize(Section.CHERRY_PICKS)}
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
index 2e33333..e8bf442 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
@@ -200,7 +200,10 @@
             <gr-endpoint-param name="change"> </gr-endpoint-param>
             <gr-endpoint-slot name="top"> </gr-endpoint-slot>
             <section id="relatedChanges">
-              <gr-related-collapse class="first" title="Relation chain">
+              <gr-related-collapse
+                class="first"
+                title="parent changes are ordered after child changes"
+              >
                 <div class="relatedChangeLine show-when-collapsed">
                   <span class="marker space"> </span>
                   <gr-related-change
@@ -213,7 +216,9 @@
               </gr-related-collapse>
             </section>
             <section id="submittedTogether">
-              <gr-related-collapse title="Submitted together">
+              <gr-related-collapse
+                title="parent changes are ordered after child changes"
+              >
                 <div class="relatedChangeLine selected show-when-collapsed">
                   <span
                     aria-label="Arrow marking current change"
@@ -236,7 +241,7 @@
               <div class="note" hidden="">(+ )</div>
             </section>
             <section id="cherryPicks">
-              <gr-related-collapse title="Cherry picks">
+              <gr-related-collapse>
                 <div class="relatedChangeLine show-when-collapsed">
                   <span class="marker space"> </span>
                   <gr-related-change show-change-status="">
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-collapse.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-collapse.ts
index 30d2282..8c2f459 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-collapse.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-collapse.ts
@@ -18,7 +18,7 @@
 @customElement('gr-related-collapse')
 export class GrRelatedCollapse extends LitElement {
   @property()
-  override title = '';
+  name = '';
 
   @property({type: Boolean})
   showAll = false;
@@ -64,7 +64,7 @@
   }
 
   override render() {
-    const title = html`<h3 class="title heading-3">${this.title}</h3>`;
+    const title = html`<h3 class="title heading-3">${this.name}</h3>`;
 
     const collapsible = this.length > this.numChangesWhenCollapsed;
     this.collapsed = !this.showAll && collapsible;
@@ -88,7 +88,7 @@
     e.stopPropagation();
     this.showAll = !this.showAll;
     this.reporting.reportInteraction(Interaction.TOGGLE_SHOW_ALL_BUTTON, {
-      sectionName: this.title,
+      sectionName: this.name,
       toState: this.showAll ? 'Show all' : 'Show less',
     });
   }
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-results.ts b/polygerrit-ui/app/elements/checks/gr-checks-results.ts
index 65fdb93..6cff5ab 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-results.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-results.ts
@@ -489,7 +489,7 @@
     return html`
       <!-- The &nbsp; is for being able to shrink a tiny amount without
        the text itself getting shrunk with an ellipsis. -->
-      <div class="summary" @click=${this.toggleExpanded} title=${text}>
+      <div class="summary" @click=${this.toggleExpandedClick} title=${text}>
         ${text}&nbsp;
       </div>
     `;
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts b/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
index a349b58..22c2940 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
@@ -123,6 +123,22 @@
     `
     );
   });
+
+  test('click summary, toggle expand', async () => {
+    element.isExpandable = true;
+    await element.updateComplete;
+    assert.isFalse(element.isExpanded);
+
+    const summaryDiv: HTMLElement =
+      element.shadowRoot!.querySelector('.summary')!;
+    summaryDiv.click();
+    await element.updateComplete;
+    assert.isTrue(element.isExpanded);
+
+    summaryDiv.click();
+    await element.updateComplete;
+    assert.isFalse(element.isExpanded);
+  });
 });
 
 suite('gr-checks-results test', () => {