diff options
Diffstat (limited to 'spec')
-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); + }); }); |