Merge "Specify the correct type of Context Item for a gerrit change."
diff --git a/polygerrit-ui/app/elements/chat-panel/context-chip_test.ts b/polygerrit-ui/app/elements/chat-panel/context-chip_test.ts
index 203cd11..39a9f56 100644
--- a/polygerrit-ui/app/elements/chat-panel/context-chip_test.ts
+++ b/polygerrit-ui/app/elements/chat-panel/context-chip_test.ts
@@ -84,6 +84,23 @@
assert.equal(chip?.title, 'test tooltip');
});
+ test('renders with gerrit change icon', async () => {
+ const contextItem: ContextItem = {
+ type_id: 'gerrit_change',
+ title: 'This Change',
+ link: '',
+ tooltip: 'File diffs (against base), commit message, and comments.',
+ };
+ element.contextItem = contextItem;
+ await element.updateComplete;
+
+ // Should use gr-icon element with commit
+ const icon = element.shadowRoot?.querySelector('gr-icon');
+
+ assert.isOk(icon, 'Expected gr-icon to be rendered');
+ assert.equal(icon.getAttribute('icon'), 'commit');
+ });
+
test('is removable', async () => {
element.isRemovable = true;
element.isSuggestion = false;
diff --git a/polygerrit-ui/app/elements/chat-panel/prompt-box.ts b/polygerrit-ui/app/elements/chat-panel/prompt-box.ts
index 4a154e5..4290371 100644
--- a/polygerrit-ui/app/elements/chat-panel/prompt-box.ts
+++ b/polygerrit-ui/app/elements/chat-panel/prompt-box.ts
@@ -373,7 +373,7 @@
// The chip makes it clear to the user that it is already in the context.
if (!this.change) return nothing;
const changeContextItem: ContextItem = {
- type_id: 'gerrit',
+ type_id: 'gerrit_change',
// Don't include link in the chip since it's already on the change page.
link: '',
title: 'This Change',
diff --git a/polygerrit-ui/app/test/test-data-generators.ts b/polygerrit-ui/app/test/test-data-generators.ts
index 15b7466..a2d8694 100644
--- a/polygerrit-ui/app/test/test-data-generators.ts
+++ b/polygerrit-ui/app/test/test-data-generators.ts
@@ -1310,6 +1310,16 @@
};
},
},
+ {
+ id: 'gerrit_change',
+ name: 'Gerrit Change',
+ icon: 'commit',
+ placeholder: '',
+ regex: /.*/,
+ parse() {
+ return undefined;
+ },
+ },
];
export const chatProvider: AiCodeReviewProvider = {