diff options
author | Sarah German <sgerman@gitlab.com> | 2022-07-13 14:54:03 +0300 |
---|---|---|
committer | David O'Regan <doregan@gitlab.com> | 2022-07-13 14:54:03 +0300 |
commit | 0430fea527c4c81ef4122536faf07d3fb6d2ca4b (patch) | |
tree | 7956a50d35d28c3225c8e21b8c6454a8cf9345e8 /spec/frontend | |
parent | 430a79f5ea7c9428ccfaf8f670a46cb87215bb20 (diff) |
Enable filtering the Deprecations list with URL parameters
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/deprecations/deprecation_filters_spec.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/frontend/deprecations/deprecation_filters_spec.js b/spec/frontend/deprecations/deprecation_filters_spec.js index c192745e..d5149792 100644 --- a/spec/frontend/deprecations/deprecation_filters_spec.js +++ b/spec/frontend/deprecations/deprecation_filters_spec.js @@ -5,7 +5,7 @@ import { mount } from '@vue/test-utils'; import DeprecationFilters from '../../../content/frontend/deprecations/components/deprecation_filters.vue'; -const propsData = { showAllText: 'Show all', milestonesList: [] }; +const propsData = { showAllText: 'Show all', milestonesList: [{ value: '160', text: '16.0' }] }; const removalsFilterSelector = '[data-testid="removal-milestone-filter"]'; describe('component: Deprecations Filter', () => { @@ -13,4 +13,24 @@ describe('component: Deprecations Filter', () => { const wrapper = mount(DeprecationFilters, { propsData }); expect(wrapper.find(removalsFilterSelector).isVisible()).toBe(true); }); + + it('Validates a URL parameter', () => { + const location = { + ...window.location, + search: '?removal_milestone=16.0', + toString: () => { + return 'http://localhost/ee/update/deprecations.html'; + }, + }; + Object.defineProperty(window, 'location', { + writable: true, + value: location, + }); + + const searchParams = new URLSearchParams(window.location.search); + const versionValue = searchParams.get('removal_milestone').replace(/\./g, ''); + + const wrapper = mount(DeprecationFilters, { propsData }); + expect(wrapper.vm.isValidVersion(versionValue)).toBe(true); + }); }); |