summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-02 21:16:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-02 21:16:54 +0000
commita1ee5ac49b801535223f7498762f0c0820165a1a (patch)
tree8bfde6b9f8ac7872aa368a2f8d6c657583ec809d /spec/frontend
parent05cde74f482201ed19d89c3c01ebf9b5d26cd4fd (diff)
downloadgitlab-ce-a1ee5ac49b801535223f7498762f0c0820165a1a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/lib/utils/table_utility_spec.js29
-rw-r--r--spec/frontend/settings_panels_spec.js14
2 files changed, 43 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/table_utility_spec.js b/spec/frontend/lib/utils/table_utility_spec.js
index 75b9252aa40..a67adac5efb 100644
--- a/spec/frontend/lib/utils/table_utility_spec.js
+++ b/spec/frontend/lib/utils/table_utility_spec.js
@@ -8,4 +8,33 @@ describe('table_utility', () => {
expect(tableUtils.thWidthClass(width)).toBe(`gl-w-${width}p ${DEFAULT_TH_CLASSES}`);
});
});
+
+ describe('sortObjectToString', () => {
+ it('returns the expected sorting string ending in "DESC" when sortDesc is true', () => {
+ expect(tableUtils.sortObjectToString({ sortBy: 'mergedAt', sortDesc: true })).toBe(
+ 'MERGED_AT_DESC',
+ );
+ });
+
+ it('returns the expected sorting string ending in "ASC" when sortDesc is false', () => {
+ expect(tableUtils.sortObjectToString({ sortBy: 'mergedAt', sortDesc: false })).toBe(
+ 'MERGED_AT_ASC',
+ );
+ });
+ });
+
+ describe('sortStringToObject', () => {
+ it.each`
+ sortBy | sortDesc | sortString
+ ${'mergedAt'} | ${true} | ${'MERGED_AT_DESC'}
+ ${'mergedAt'} | ${false} | ${'MERGED_AT_ASC'}
+ ${'severity'} | ${true} | ${'SEVERITY_DESC'}
+ ${'severity'} | ${false} | ${'SEVERITY_ASC'}
+ `(
+ 'returns $sortString when sortBy = "$sortBy" and sortDesc = "sortDesc"',
+ ({ sortBy, sortDesc, sortString }) => {
+ expect(tableUtils.sortStringToObject(sortString)).toStrictEqual({ sortBy, sortDesc });
+ },
+ );
+ });
});
diff --git a/spec/frontend/settings_panels_spec.js b/spec/frontend/settings_panels_spec.js
index 6b739617b97..3a62cd703ab 100644
--- a/spec/frontend/settings_panels_spec.js
+++ b/spec/frontend/settings_panels_spec.js
@@ -24,6 +24,20 @@ describe('Settings Panels', () => {
expect(isExpanded(panel)).toBe(true);
});
+
+ it('should expand panel containing linked hash', () => {
+ window.location.hash = '#group_description';
+
+ const panel = document.querySelector('#js-general-settings');
+ // Our test environment automatically expands everything so we need to clear that out first
+ panel.classList.remove('expanded');
+
+ expect(isExpanded(panel)).toBe(false);
+
+ initSettingsPanels();
+
+ expect(isExpanded(panel)).toBe(true);
+ });
});
it('does not change the text content of triggers', () => {