Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c4b1d791
Commit
c4b1d791
authored
Sep 08, 2020
by
Dheeraj Joshi
Committed by
Ezekiel Kigbo
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing setter function for tabIndex
parent
b1070678
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
ee/app/assets/javascripts/dast_profiles/components/dast_profiles.vue
...ts/javascripts/dast_profiles/components/dast_profiles.vue
+8
-8
ee/spec/frontend/dast_profiles/components/dast_profiles_spec.js
...c/frontend/dast_profiles/components/dast_profiles_spec.js
+8
-9
No files found.
ee/app/assets/javascripts/dast_profiles/components/dast_profiles.vue
View file @
c4b1d791
...
...
@@ -56,15 +56,19 @@ export default {
return
Math
.
max
(
0
,
activeTabIndex
);
},
set
(
newTabIndex
)
{
const
profileTypeName
=
Object
.
keys
(
this
.
profileSettings
)[
newTabIndex
];
if
(
profileTypeName
)
{
window
.
location
.
hash
=
kebabCase
(
profileTypeName
);
}
},
},
},
created
()
{
this
.
addSmartQueriesForEnabledProfileTypes
();
},
methods
:
{
setLocationHash
(
profileType
)
{
window
.
location
.
hash
=
kebabCase
(
profileType
);
},
addSmartQueriesForEnabledProfileTypes
()
{
Object
.
values
(
this
.
profileSettings
).
forEach
(({
profileType
,
graphQL
:
{
query
}
})
=>
{
this
.
makeProfileTypeReactive
(
profileType
);
...
...
@@ -242,11 +246,7 @@ export default {
</header>
<gl-tabs
v-model=
"tabIndex"
>
<gl-tab
v-for=
"(settings, profileType) in profileSettings"
:key=
"profileType"
@
click=
"setLocationHash(profileType)"
>
<gl-tab
v-for=
"(settings, profileType) in profileSettings"
:key=
"profileType"
>
<template
#title
>
<span>
{{
settings
.
i18n
.
tabName
}}
</span>
</
template
>
...
...
ee/spec/frontend/dast_profiles/components/dast_profiles_spec.js
View file @
c4b1d791
import
{
mount
,
shallowMount
,
createWrapper
}
from
'
@vue/test-utils
'
;
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
within
}
from
'
@testing-library/dom
'
;
import
{
merge
}
from
'
lodash
'
;
import
{
GlDropdown
}
from
'
@gitlab/ui
'
;
import
{
GlDropdown
,
GlTabs
}
from
'
@gitlab/ui
'
;
import
setWindowLocation
from
'
helpers/set_window_location_helper
'
;
import
DastProfiles
from
'
ee/dast_profiles/components/dast_profiles.vue
'
;
...
...
@@ -82,6 +82,7 @@ describe('EE - DastProfiles', () => {
const
getDropdownComponent
=
()
=>
wrapper
.
find
(
GlDropdown
);
const
getSiteProfilesDropdownItem
=
text
=>
within
(
getDropdownComponent
().
element
).
queryByText
(
text
);
const
getTabsComponent
=
()
=>
wrapper
.
find
(
GlTabs
);
const
getTab
=
({
tabName
,
selected
})
=>
withinComponent
().
getByRole
(
'
tab
'
,
{
name
:
tabName
,
...
...
@@ -161,10 +162,10 @@ describe('EE - DastProfiles', () => {
});
describe
.
each
`
tabName | givenLocationHash
${
'
Site Profiles
'
}
|
${
'
site-profiles
'
}
${
'
Scanner Profiles
'
}
|
${
'
scanner-profiles
'
}
`
(
'
with location hash set to "$givenLocationHash"
'
,
({
tabName
,
givenLocationHash
})
=>
{
tabName |
index |
givenLocationHash
${
'
Site Profiles
'
}
|
${
0
}
|
${
'
site-profiles
'
}
${
'
Scanner Profiles
'
}
|
${
1
}
|
${
'
scanner-profiles
'
}
`
(
'
with location hash set to "$givenLocationHash"
'
,
({
tabName
,
index
,
givenLocationHash
})
=>
{
beforeEach
(()
=>
{
setWindowLocation
(
`http://foo.com/index#
${
givenLocationHash
}
`
);
createFullComponent
();
...
...
@@ -186,9 +187,7 @@ describe('EE - DastProfiles', () => {
it
(
'
updates the browsers URL to contain the selected tab
'
,
()
=>
{
window
.
location
.
hash
=
''
;
const
tab
=
getTab
({
tabName
});
createWrapper
(
tab
).
trigger
(
'
click
'
);
getTabsComponent
().
vm
.
$emit
(
'
input
'
,
index
);
expect
(
window
.
location
.
hash
).
toBe
(
givenLocationHash
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment