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
45e8b5d6
Commit
45e8b5d6
authored
Jul 19, 2021
by
pburdette
Committed by
Miguel Rincon
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use find by role helper
Use findByRole to improve bundle size and accessbility.
parent
6be45816
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
15 deletions
+10
-15
app/assets/javascripts/token_access/components/token_access.vue
...sets/javascripts/token_access/components/token_access.vue
+1
-6
app/assets/javascripts/token_access/components/token_projects_table.vue
...ascripts/token_access/components/token_projects_table.vue
+0
-1
spec/frontend/token_access/token_access_spec.js
spec/frontend/token_access/token_access_spec.js
+9
-8
No files found.
app/assets/javascripts/token_access/components/token_access.vue
View file @
45e8b5d6
...
...
@@ -187,12 +187,7 @@ export default {
/>
</
template
>
<
template
#footer
>
<gl-button
variant=
"confirm"
:disabled=
"isProjectPathEmpty"
data-testid=
"add-project-button"
@
click=
"addProject"
>
<gl-button
variant=
"confirm"
:disabled=
"isProjectPathEmpty"
@
click=
"addProject"
>
{{
$options
.
i18n
.
addProject
}}
</gl-button>
<gl-button
@
click=
"clearTargetProjectPath"
>
{{
$options
.
i18n
.
cancel
}}
</gl-button>
...
...
app/assets/javascripts/token_access/components/token_projects_table.vue
View file @
45e8b5d6
...
...
@@ -73,7 +73,6 @@ export default {
variant=
"danger"
icon=
"remove"
:aria-label=
"__('Remove access')"
data-testid=
"remove-project-button"
@
click=
"removeProject(item.fullPath)"
/>
</
template
>
...
...
spec/frontend/token_access/token_access_spec.js
View file @
45e8b5d6
import
{
GlToggle
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
createLocalVue
,
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
mountExtended
,
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
createFlash
from
'
~/flash
'
;
import
TokenAccess
from
'
~/token_access/components/token_access.vue
'
;
...
...
@@ -41,15 +42,15 @@ describe('TokenAccess component', () => {
const
findToggle
=
()
=>
wrapper
.
findComponent
(
GlToggle
);
const
findLoadingIcon
=
()
=>
wrapper
.
findComponent
(
GlLoadingIcon
);
const
findAddProjectBtn
=
()
=>
wrapper
.
find
(
'
[data-testid="add-project-button"]
'
);
const
findRemoveProjectBtn
=
()
=>
wrapper
.
find
(
'
[data-testid="remove-project-button"]
'
);
const
findAddProjectBtn
=
()
=>
wrapper
.
find
ByRole
(
'
button
'
,
{
name
:
'
Add project
'
}
);
const
findRemoveProjectBtn
=
()
=>
wrapper
.
find
ByRole
(
'
button
'
,
{
name
:
'
Remove access
'
}
);
const
findTokenSection
=
()
=>
wrapper
.
find
(
'
[data-testid="token-section"]
'
);
const
createMockApolloProvider
=
(
requestHandlers
)
=>
{
return
createMockApollo
(
requestHandlers
);
};
const
createComponent
=
(
requestHandlers
,
mountFn
=
shallowMount
)
=>
{
const
createComponent
=
(
requestHandlers
,
mountFn
=
shallowMount
Extended
)
=>
{
wrapper
=
mountFn
(
TokenAccess
,
{
localVue
,
provide
:
{
...
...
@@ -138,7 +139,7 @@ describe('TokenAccess component', () => {
[
getProjectsWithCIJobTokenScopeQuery
,
getProjectsWithScope
],
[
addProjectCIJobTokenScopeMutation
,
addProjectSuccessHandler
],
],
mount
,
mount
Extended
,
);
await
waitForPromises
();
...
...
@@ -160,7 +161,7 @@ describe('TokenAccess component', () => {
[
getProjectsWithCIJobTokenScopeQuery
,
getProjectsWithScope
],
[
addProjectCIJobTokenScopeMutation
,
addProjectFailureHandler
],
],
mount
,
mount
Extended
,
);
await
waitForPromises
();
...
...
@@ -181,7 +182,7 @@ describe('TokenAccess component', () => {
[
getProjectsWithCIJobTokenScopeQuery
,
getProjectsWithScope
],
[
removeProjectCIJobTokenScopeMutation
,
removeProjectSuccessHandler
],
],
mount
,
mount
Extended
,
);
await
waitForPromises
();
...
...
@@ -203,7 +204,7 @@ describe('TokenAccess component', () => {
[
getProjectsWithCIJobTokenScopeQuery
,
getProjectsWithScope
],
[
removeProjectCIJobTokenScopeMutation
,
removeProjectFailureHandler
],
],
mount
,
mount
Extended
,
);
await
waitForPromises
();
...
...
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