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
8de5b9a8
Commit
8de5b9a8
authored
Nov 26, 2021
by
Andrew Fontaine
Committed by
Nicolò Maria Mezzopera
Nov 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change icon to button on environment folder
parent
fc23ee11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
app/assets/javascripts/environments/components/new_environment_folder.vue
...cripts/environments/components/new_environment_folder.vue
+20
-7
spec/frontend/environments/new_environment_folder_spec.js
spec/frontend/environments/new_environment_folder_spec.js
+5
-2
No files found.
app/assets/javascripts/environments/components/new_environment_folder.vue
View file @
8de5b9a8
<
script
>
import
{
GlCollapse
,
GlIcon
,
GlBadge
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlCollapse
,
GlIcon
,
GlBadge
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
folderQuery
from
'
../graphql/queries/folder.query.graphql
'
;
export
default
{
components
:
{
GlButton
,
GlCollapse
,
GlIcon
,
GlBadge
,
...
...
@@ -26,12 +28,20 @@ export default {
},
},
},
i18n
:
{
collapse
:
__
(
'
Collapse
'
),
expand
:
__
(
'
Expand
'
),
link
:
s__
(
'
Environments|Show all
'
),
},
computed
:
{
icons
()
{
return
this
.
visible
?
{
caret
:
'
angle-down
'
,
folder
:
'
folder-open
'
}
:
{
caret
:
'
angle-right
'
,
folder
:
'
folder-o
'
};
},
label
()
{
return
this
.
visible
?
this
.
$options
.
i18n
.
collapse
:
this
.
$options
.
i18n
.
expand
;
},
count
()
{
return
this
.
folder
?.
availableCount
??
0
;
},
...
...
@@ -51,18 +61,21 @@ export default {
</
script
>
<
template
>
<div
class=
"gl-border-b-solid gl-border-gray-100 gl-border-1 gl-px-3 gl-pt-3 gl-pb-5"
>
<div
class=
"gl-w-full gl-display-flex gl-align-items-center"
@
click=
"toggleCollapse"
>
<gl-icon
class=
"gl-mr-2 gl-fill-current-color gl-text-gray-500"
:name=
"icons.caret"
:size=
"12"
<div
class=
"gl-w-full gl-display-flex gl-align-items-center"
>
<gl-button
class=
"gl-mr-4 gl-fill-current-color gl-text-gray-500"
:aria-label=
"label"
:icon=
"icons.caret"
size=
"small"
category=
"tertiary"
@
click=
"toggleCollapse"
/>
<gl-icon
class=
"gl-mr-2 gl-fill-current-color gl-text-gray-500"
:name=
"icons.folder"
/>
<div
class=
"gl-mr-2 gl-text-gray-500"
:class=
"folderClass"
>
{{
nestedEnvironment
.
name
}}
</div>
<gl-badge
size=
"sm"
class=
"gl-mr-auto"
>
{{
count
}}
</gl-badge>
<gl-link
v-if=
"visible"
:href=
"folderPath"
>
{{
s__
(
'
Environments|Show all
'
)
}}
</gl-link>
<gl-link
v-if=
"visible"
:href=
"folderPath"
>
{{
$options
.
i18n
.
link
}}
</gl-link>
</div>
<gl-collapse
:visible=
"visible"
/>
</div>
...
...
spec/frontend/environments/new_environment_folder_spec.js
View file @
8de5b9a8
...
...
@@ -3,8 +3,8 @@ import Vue from 'vue';
import
{
GlCollapse
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
EnvironmentsFolder
from
'
~/environments/components/new_environment_folder.vue
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
resolvedEnvironmentsApp
,
resolvedFolder
}
from
'
./graphql/mock_data
'
;
Vue
.
use
(
VueApollo
);
...
...
@@ -14,6 +14,7 @@ describe('~/environments/components/new_environments_folder.vue', () => {
let
environmentFolderMock
;
let
nestedEnvironment
;
let
folderName
;
let
button
;
const
findLink
=
()
=>
wrapper
.
findByRole
(
'
link
'
,
{
name
:
s__
(
'
Environments|Show all
'
)
});
...
...
@@ -32,6 +33,7 @@ describe('~/environments/components/new_environments_folder.vue', () => {
environmentFolderMock
.
mockReturnValue
(
resolvedFolder
);
wrapper
=
createWrapper
({
nestedEnvironment
},
createApolloProvider
());
folderName
=
wrapper
.
findByText
(
nestedEnvironment
.
name
);
button
=
wrapper
.
findByRole
(
'
button
'
,
{
name
:
__
(
'
Expand
'
)
});
});
afterEach
(()
=>
{
...
...
@@ -61,10 +63,11 @@ describe('~/environments/components/new_environments_folder.vue', () => {
});
it
(
'
opens on click
'
,
async
()
=>
{
await
folderName
.
trigger
(
'
click
'
);
await
button
.
trigger
(
'
click
'
);
const
link
=
findLink
();
expect
(
button
.
attributes
(
'
aria-label
'
)).
toBe
(
__
(
'
Collapse
'
));
expect
(
collapse
.
attributes
(
'
visible
'
)).
toBe
(
'
true
'
);
expect
(
icons
.
wrappers
.
map
((
i
)
=>
i
.
props
(
'
name
'
))).
toEqual
([
'
angle-down
'
,
'
folder-open
'
]);
expect
(
folderName
.
classes
(
'
gl-font-weight-bold
'
)).
toBe
(
true
);
...
...
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