Skip to content

Commit d253131

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
Correctly show new badge in Elements panel and subgrid subitems
Before, the new badge wouldn't show up in the Elements panel, as we passed it in as the wrong argument. Also, for subgrid items we would show the grid and not the subgrid prompts, as a subgrid is also a grid. Fixed: 438129920 Change-Id: I0a5122a6d819360ce8e28c745f2cfc7fbbaed704 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6839780 Auto-Submit: Kim-Anh Tran <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent 31818f4 commit d253131

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

front_end/panels/elements/ElementsTreeElement.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ describeWithMockConnection('ElementsTreeElement ', () => {
199199
});
200200

201201
it('shows subgrid submenu items', async () => {
202-
const contextMenu =
203-
await getContextMenuForElementWithLayoutProperties({...DEFAULT_LAYOUT_PROPERTIES, isSubgrid: true});
202+
const contextMenu = await getContextMenuForElementWithLayoutProperties(
203+
{...DEFAULT_LAYOUT_PROPERTIES, isGrid: true, isSubgrid: true});
204204
const debugWithAiItem = contextMenu.buildDescriptor().subItems?.find(item => item.label === 'Debug with AI');
205205
assert.exists(debugWithAiItem);
206206
assert.deepEqual(

front_end/panels/elements/ElementsTreeElement.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
916916
const action = UI.ActionRegistry.ActionRegistry.instance().getAction(openAiAssistanceId);
917917
// Register new badge under the `devToolsAiSubmenuPrompts` feature, as the freestyler one is already used in ViewManager.
918918
const submenu = contextMenu.footerSection().appendSubMenuItem(
919-
action.title(), false, Root.Runtime.hostConfig.devToolsAiSubmenuPrompts?.featureName);
919+
action.title(), false, openAiAssistanceId, Root.Runtime.hostConfig.devToolsAiSubmenuPrompts?.featureName);
920920
submenu.defaultSection().appendAction(openAiAssistanceId, i18nString(UIStrings.startAChat));
921921

922922
const submenuConfigs = [
@@ -941,7 +941,8 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
941941
],
942942
},
943943
{
944-
condition: (props: SDK.CSSModel.LayoutProperties|null): boolean => Boolean(props?.isGrid),
944+
condition: (props: SDK.CSSModel.LayoutProperties|null): boolean =>
945+
Boolean(props?.isGrid && !props?.isSubgrid),
945946
items: [
946947
{
947948
label: i18nString(UIStrings.alignItems),

0 commit comments

Comments
 (0)