Skip to content
代码片段 群组 项目
未验证 提交 5c6ad84f 编辑于 作者: Savas Vedova's avatar Savas Vedova 提交者: GitLab
浏览文件

Display up to 2 values in the placeholder

Instead of displaying +x after the second option, we now display
up to two options, and then rely on +X in the Enhanced Filtering.
上级 9cf2bff2
No related branches found
No related tags found
无相关合并请求
显示
25 个添加11 个删除
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
options: Object.values(ITEMS), options: Object.values(ITEMS),
selected: this.selectedActivities, selected: this.selectedActivities,
placeholder: this.$options.i18n.allItemsText, placeholder: this.$options.i18n.allItemsText,
maxOptionsShown: 2,
}); });
}, },
}, },
......
...@@ -52,6 +52,7 @@ export default { ...@@ -52,6 +52,7 @@ export default {
return getSelectedOptionsText({ return getSelectedOptionsText({
options: this.$options.items, options: this.$options.items,
selected: this.selectedSeverities, selected: this.selectedSeverities,
maxOptionsShown: 2,
}); });
}, },
}, },
......
...@@ -80,6 +80,7 @@ export default { ...@@ -80,6 +80,7 @@ export default {
return getSelectedOptionsText({ return getSelectedOptionsText({
options: [...GROUPS[0].options, ...GROUPS[1].options], options: [...GROUPS[0].options, ...GROUPS[1].options],
selected: this.selectedStatuses, selected: this.selectedStatuses,
maxOptionsShown: 2,
}); });
}, },
}, },
......
...@@ -113,6 +113,7 @@ export default { ...@@ -113,6 +113,7 @@ export default {
options: this.flatItems, options: this.flatItems,
selected: this.selectedTools, selected: this.selectedTools,
placeholder: this.$options.i18n.allItemsText, placeholder: this.$options.i18n.allItemsText,
maxOptionsShown: 2,
}); });
}, },
}, },
......
...@@ -241,9 +241,14 @@ describe('ActivityToken', () => { ...@@ -241,9 +241,14 @@ describe('ActivityToken', () => {
expect(findViewSlot().text()).toBe('Has issue'); expect(findViewSlot().text()).toBe('Has issue');
}); });
it('shows "Has issue +1 more" when "Has issue" and another option is selected', async () => { it('shows "Has issue, Has merge request" when "Has issue" and another option is selected', async () => {
await clickDropdownItem('HAS_ISSUE', 'HAS_MERGE_REQUEST'); await clickDropdownItem('HAS_ISSUE', 'HAS_MERGE_REQUEST');
expect(findViewSlot().text()).toBe('Has issue +1 more'); expect(findViewSlot().text()).toBe('Has issue, Has merge request');
});
it('shows "Still detected, Has issue +1 more" when more than 2 options are selected', async () => {
await clickDropdownItem('STILL_DETECTED', 'HAS_ISSUE', 'HAS_MERGE_REQUEST');
expect(findViewSlot().text()).toBe('Still detected, Has issue +1 more');
}); });
it('shows "All activity" when "All activity" is selected', async () => { it('shows "All activity" when "All activity" is selected', async () => {
......
...@@ -172,9 +172,14 @@ describe('Severity Token component', () => { ...@@ -172,9 +172,14 @@ describe('Severity Token component', () => {
expect(findSlotView().text()).toBe('All severities'); expect(findSlotView().text()).toBe('All severities');
}); });
it('shows "Critical +1 more" when critical and high severities are selected', async () => { it('shows "Critical, High" when critical and high severities are selected', async () => {
await clickDropdownItem('CRITICAL', 'HIGH'); await clickDropdownItem('CRITICAL', 'HIGH');
expect(findSlotView().text()).toBe('Critical +1 more'); expect(findSlotView().text()).toBe('Critical, High');
});
it('shows "Critical, High +1 more" when more than 2 options are selected', async () => {
await clickDropdownItem('CRITICAL', 'HIGH', 'LOW');
expect(findSlotView().text()).toBe('Critical, High +1 more');
}); });
it('shows "Low" when only low severity is selected', async () => { it('shows "Low" when only low severity is selected', async () => {
......
...@@ -95,7 +95,7 @@ describe('Status Token component', () => { ...@@ -95,7 +95,7 @@ describe('Status Token component', () => {
}); });
it('shows the label', () => { it('shows the label', () => {
expect(findSlotView().text()).toBe('Needs triage +1 more'); expect(findSlotView().text()).toBe('Needs triage, Confirmed');
}); });
it('shows the dropdown with correct options', () => { it('shows the dropdown with correct options', () => {
...@@ -220,14 +220,14 @@ describe('Status Token component', () => { ...@@ -220,14 +220,14 @@ describe('Status Token component', () => {
expect(findSlotView().text()).toBe('Dismissed (2 reasons)'); expect(findSlotView().text()).toBe('Dismissed (2 reasons)');
}); });
it('shows "Confirmed +1 more" when confirmed and a dismissal reason are selected', async () => { it('shows "Confirmed, False positive" when confirmed and a dismissal reason are selected', async () => {
await clickDropdownItem('CONFIRMED', 'FALSE_POSITIVE'); await clickDropdownItem('CONFIRMED', 'FALSE_POSITIVE');
expect(findSlotView().text()).toBe('Confirmed +1 more'); expect(findSlotView().text()).toBe('Confirmed, False positive');
}); });
it('shows "Confirmed +1 more" when confirmed and all dismissal reasons are selected', async () => { it('shows "Needs triage, Confirmed +1 more" when more than 2 options are selected', async () => {
await clickDropdownItem('CONFIRMED', 'DISMISSED'); await clickDropdownItem('CONFIRMED', 'DETECTED', 'DISMISSED');
expect(findSlotView().text()).toBe('Confirmed +1 more'); expect(findSlotView().text()).toBe('Needs triage, Confirmed +1 more');
}); });
}); });
......
...@@ -230,7 +230,7 @@ describe('ToolToken', () => { ...@@ -230,7 +230,7 @@ describe('ToolToken', () => {
it('shows "OWASP Zed Attack Proxy (ZAP) +1 more" when "zaproxy" and another option is selected', async () => { it('shows "OWASP Zed Attack Proxy (ZAP) +1 more" when "zaproxy" and another option is selected', async () => {
await clickDropdownItem('zaproxy', 'gitleaks'); await clickDropdownItem('zaproxy', 'gitleaks');
expect(findViewSlot().text()).toBe('OWASP Zed Attack Proxy (ZAP) +1 more'); expect(findViewSlot().text()).toBe('OWASP Zed Attack Proxy (ZAP), GitLeaks');
}); });
it('shows "All tools" when "All tool" is selected', async () => { it('shows "All tools" when "All tool" is selected', async () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册