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
308a0562
Commit
308a0562
authored
Oct 05, 2020
by
Marvin Karegyeya
Committed by
Jose Ivan Vargas
Oct 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace GlDeprecatedDropdown in app/assets/javascripts/ci variable list
parent
4c1368a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
32 deletions
+31
-32
app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue
.../ci_variable_list/components/ci_environments_dropdown.vue
+15
-25
changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-ci.yml
...Dropdown-with-GlDropdown-in-app-assets-javascripts-ci.yml
+5
-0
spec/frontend/ci_variable_list/components/ci_enviroments_dropdown_spec.js
..._variable_list/components/ci_enviroments_dropdown_spec.js
+11
-7
No files found.
app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue
View file @
308a0562
<
script
>
import
{
GlDeprecatedDropdown
,
GlDeprecatedDropdownItem
,
GlDeprecatedDropdownDivider
,
GlSearchBoxByType
,
GlIcon
,
}
from
'
@gitlab/ui
'
;
import
{
GlDropdown
,
GlDropdownItem
,
GlDropdownDivider
,
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
mapGetters
}
from
'
vuex
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
name
:
'
CiEnvironmentsDropdown
'
,
components
:
{
GlD
eprecatedD
ropdown
,
GlD
eprecatedD
ropdownItem
,
GlD
eprecatedD
ropdownDivider
,
GlDropdown
,
GlDropdownItem
,
GlDropdownDivider
,
GlSearchBoxByType
,
GlIcon
,
},
props
:
{
value
:
{
...
...
@@ -66,28 +59,25 @@ export default {
};
</
script
>
<
template
>
<gl-d
eprecated-d
ropdown
:text=
"value"
>
<gl-dropdown
:text=
"value"
>
<gl-search-box-by-type
v-model.trim=
"searchTerm"
class=
"gl-m-3"
/>
<gl-d
eprecated-d
ropdown-item
<gl-dropdown-item
v-for=
"environment in filteredResults"
:key=
"environment"
:is-checked=
"isSelected(environment)"
is-check-item
@
click=
"selectEnvironment(environment)"
>
<gl-icon
:class=
"
{ invisible: !isSelected(environment) }"
name="mobile-issue-close"
class="vertical-align-middle"
/>
{{
environment
}}
</gl-d
eprecated-d
ropdown-item>
<gl-d
eprecated-d
ropdown-item
v-if=
"!filteredResults.length"
ref=
"noMatchingResults"
>
{{
</gl-dropdown-item>
<gl-dropdown-item
v-if=
"!filteredResults.length"
ref=
"noMatchingResults"
>
{{
__
(
'
No matching results
'
)
}}
</gl-d
eprecated-d
ropdown-item>
}}
</gl-dropdown-item>
<template
v-if=
"shouldRenderCreateButton"
>
<gl-d
eprecated-d
ropdown-divider
/>
<gl-d
eprecated-d
ropdown-item
@
click=
"createClicked"
>
<gl-dropdown-divider
/>
<gl-dropdown-item
@
click=
"createClicked"
>
{{
composedCreateButtonLabel
}}
</gl-d
eprecated-d
ropdown-item>
</gl-dropdown-item>
</
template
>
</gl-d
eprecated-d
ropdown>
</gl-dropdown>
</template>
changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-ci.yml
0 → 100644
View file @
308a0562
---
title
:
Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/ci_variable_list
merge_request
:
41413
author
:
nuwe1
type
:
other
spec/frontend/ci_variable_list/components/ci_enviroments_dropdown_spec.js
View file @
308a0562
import
Vuex
from
'
vuex
'
;
import
{
shallowM
ount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
GlD
eprecatedD
ropdownItem
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
m
ount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
GlDropdownItem
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
CiEnvironmentsDropdown
from
'
~/ci_variable_list/components/ci_environments_dropdown.vue
'
;
const
localVue
=
createLocalVue
();
...
...
@@ -17,7 +17,7 @@ describe('Ci environments dropdown', () => {
},
});
wrapper
=
shallowM
ount
(
CiEnvironmentsDropdown
,
{
wrapper
=
m
ount
(
CiEnvironmentsDropdown
,
{
store
,
localVue
,
propsData
:
{
...
...
@@ -26,9 +26,9 @@ describe('Ci environments dropdown', () => {
});
};
const
findAllDropdownItems
=
()
=>
wrapper
.
findAll
(
GlD
eprecatedD
ropdownItem
);
const
findDropdownItemByIndex
=
index
=>
wrapper
.
findAll
(
GlD
eprecatedD
ropdownItem
).
at
(
index
);
const
findActiveIconByIndex
=
index
=>
wrapper
.
findAll
(
GlIcon
).
at
(
index
);
const
findAllDropdownItems
=
()
=>
wrapper
.
findAll
(
GlDropdownItem
);
const
findDropdownItemByIndex
=
index
=>
wrapper
.
findAll
(
GlDropdownItem
).
at
(
index
);
const
findActiveIconByIndex
=
index
=>
findDropdownItemByIndex
(
index
).
find
(
GlIcon
);
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
@@ -61,6 +61,10 @@ describe('Ci environments dropdown', () => {
expect
(
findDropdownItemByIndex
(
1
).
text
()).
toBe
(
'
prod
'
);
expect
(
findDropdownItemByIndex
(
2
).
text
()).
toBe
(
'
staging
'
);
});
it
(
'
should not display active checkmark on the inactive stage
'
,
()
=>
{
expect
(
findActiveIconByIndex
(
0
).
classes
(
'
gl-visibility-hidden
'
)).
toBe
(
true
);
});
});
describe
(
'
Enviroments found
'
,
()
=>
{
...
...
@@ -84,7 +88,7 @@ describe('Ci environments dropdown', () => {
});
it
(
'
should display active checkmark if active
'
,
()
=>
{
expect
(
findActiveIconByIndex
(
0
).
classes
(
'
invisible
'
)).
toBe
(
false
);
expect
(
findActiveIconByIndex
(
0
).
classes
(
'
gl-visibility-hidden
'
)).
toBe
(
false
);
});
describe
(
'
Custom events
'
,
()
=>
{
...
...
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