diff --git a/webviews/components/pullRequestStack.tsx b/webviews/components/pullRequestStack.tsx
index 1f193d8416..84c77501ff 100644
--- a/webviews/components/pullRequestStack.tsx
+++ b/webviews/components/pullRequestStack.tsx
@@ -93,7 +93,7 @@ export const StackSection = ({ pr }: { pr: PullRequest }) => {
{pr.state === GithubItemStateEnum.Open && openBelow > 0
? `Merging this pull request will also merge ${openBelow} pull request${openBelow === 1 ? '' : 's'} below it.`
- : `${stack.size} pull requests in this stack.`}
+ : `${stack.size} pull request${stack.size === 1 ? '' : 's'} in this stack.`}
{chevronDownIcon}
diff --git a/webviews/editorWebview/test/overview.test.tsx b/webviews/editorWebview/test/overview.test.tsx
index e8b0663af3..12f680c846 100644
--- a/webviews/editorWebview/test/overview.test.tsx
+++ b/webviews/editorWebview/test/overview.test.tsx
@@ -281,6 +281,27 @@ describe('Overview', function () {
assert.strictEqual((out.getByText('Unstack all') as HTMLButtonElement).disabled, false);
});
+ it('uses singular wording for single-member stacks, including a retained merged PR', function () {
+ for (const state of [GithubItemStateEnum.Open, GithubItemStateEnum.Closed, GithubItemStateEnum.Merged]) {
+ const pr = new PullRequestBuilder().number(793).state(state).stack({
+ position: 1, size: 1, base: 'main',
+ pullRequests: [{
+ position: 1, number: 793, title: 'First Change', head: 'D1', url: 'https://example.com/793',
+ state, isDraft: false, mergeable: PullRequestMergeability.Unknown,
+ }],
+ }).build();
+ const out = render(
+
+
+ ,
+ );
+
+ assert.strictEqual(out.container.querySelector('.stack-description')?.textContent, '1 pull request in this stack.');
+ assert.strictEqual(out.container.querySelector('.stack-badge')?.textContent?.trim(), '1/1');
+ out.unmount();
+ }
+ });
+
it('offers Update stack for an open, conflict-free stack without collapsing the heading', async function () {
const stack = {
position: 2, size: 2, base: 'main',
@@ -400,7 +421,7 @@ describe('Overview', function () {
,
);
- assert(out.container.querySelector('#pull-request-stack')?.textContent?.includes('2 pull requests in this stack.'));
+ assert.strictEqual(out.container.querySelector('.stack-description')?.textContent, '2 pull requests in this stack.');
assert.deepStrictEqual([...out.container.querySelectorAll('.stack-entry-readiness')].map(entry => entry.getAttribute('aria-label')), [
'Mergeability is being checked',
'Closed pull request cannot be merged',