Commit d557b47f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/348798/extensionFullRowClickable' into 'master'

Make full widget extension row clickable

See merge request gitlab-org/gitlab!78294
parents abd5838c b5ee6e55
...@@ -128,10 +128,12 @@ export default { ...@@ -128,10 +128,12 @@ export default {
api.trackRedisHllUserEvent(this.$options.expandEvent); api.trackRedisHllUserEvent(this.$options.expandEvent);
} }
}), }),
toggleCollapsed() { toggleCollapsed(e) {
if (!e?.target?.closest('.btn:not(.btn-icon),a')) {
this.isCollapsed = !this.isCollapsed; this.isCollapsed = !this.isCollapsed;
this.triggerRedisTracking(); this.triggerRedisTracking();
}
}, },
initExtensionPolling() { initExtensionPolling() {
const poll = new Poll({ const poll = new Poll({
...@@ -207,6 +209,19 @@ export default { ...@@ -207,6 +209,19 @@ export default {
this.showFade = true; this.showFade = true;
} }
}, },
onRowMouseDown() {
this.down = Number(new Date());
},
onRowMouseUp(e) {
const up = Number(new Date());
// To allow for text to be selected we check if the the user is clicking
// or selecting, if they are selecting the time difference should be
// more than 200ms
if (up - this.down < 200) {
this.toggleCollapsed(e);
}
},
generateText, generateText,
}, },
EXTENSION_ICON_CLASS, EXTENSION_ICON_CLASS,
...@@ -215,7 +230,7 @@ export default { ...@@ -215,7 +230,7 @@ export default {
<template> <template>
<section class="media-section" data-testid="widget-extension"> <section class="media-section" data-testid="widget-extension">
<div class="media gl-p-5"> <div class="media gl-p-5 gl-cursor-pointer" @mousedown="onRowMouseDown" @mouseup="onRowMouseUp">
<status-icon <status-icon
:name="$options.label || $options.name" :name="$options.label || $options.name"
:is-loading="isLoadingSummary" :is-loading="isLoadingSummary"
...@@ -253,7 +268,7 @@ export default { ...@@ -253,7 +268,7 @@ export default {
category="tertiary" category="tertiary"
data-testid="toggle-button" data-testid="toggle-button"
size="small" size="small"
@click="toggleCollapsed" @click.self="toggleCollapsed"
/> />
</div> </div>
</div> </div>
......
...@@ -25,9 +25,9 @@ export default { ...@@ -25,9 +25,9 @@ export default {
n__( n__(
'ciReport|Load performance test metrics detected %{strong_start}%{changesFound}%{strong_end} change', 'ciReport|Load performance test metrics detected %{strong_start}%{changesFound}%{strong_end} change',
'ciReport|Load performance test metrics detected %{strong_start}%{changesFound}%{strong_end} changes', 'ciReport|Load performance test metrics detected %{strong_start}%{changesFound}%{strong_end} changes',
changesFound, count,
), ),
{ changesFound }, { changesFound: count },
); );
}, },
// Status icon to be used next to the summary text // Status icon to be used next to the summary text
......
...@@ -95,10 +95,11 @@ describe('Accessibility extension', () => { ...@@ -95,10 +95,11 @@ describe('Accessibility extension', () => {
await waitForPromises(); await waitForPromises();
findToggleCollapsedButton().vm.$emit('click'); findToggleCollapsedButton().trigger('click');
await waitForPromises(); await waitForPromises();
}); });
it('displays all report list items', async () => { it('displays all report list items', async () => {
expect(findAllExtensionListItems()).toHaveLength(10); expect(findAllExtensionListItems()).toHaveLength(10);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment