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
2bb1c2a7
Commit
2bb1c2a7
authored
Dec 16, 2020
by
Alexis Ginsberg
Committed by
Natalia Tepluhina
Dec 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate requirements tabs to gl-tabs
MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45736
parent
604e8d44
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
88 deletions
+76
-88
ee/app/assets/javascripts/requirements/components/requirements_tabs.vue
...javascripts/requirements/components/requirements_tabs.vue
+38
-38
ee/changelogs/unreleased/230727-yet-another-requiremnets-tab-migration.yml
...eleased/230727-yet-another-requiremnets-tab-migration.yml
+5
-0
ee/spec/features/projects/requirements_management/requirements_list_spec.rb
...rojects/requirements_management/requirements_list_spec.rb
+23
-26
ee/spec/frontend/requirements/components/requirements_tabs_spec.js
...rontend/requirements/components/requirements_tabs_spec.js
+10
-15
locale/gitlab.pot
locale/gitlab.pot
+0
-9
No files found.
ee/app/assets/javascripts/requirements/components/requirements_tabs.vue
View file @
2bb1c2a7
<
script
>
<
script
>
import
{
Gl
Link
,
GlBadge
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
Gl
Badge
,
GlButton
,
GlTabs
,
GlTab
}
from
'
@gitlab/ui
'
;
import
{
FilterState
}
from
'
../constants
'
;
import
{
FilterState
}
from
'
../constants
'
;
export
default
{
export
default
{
FilterState
,
FilterState
,
components
:
{
components
:
{
GlLink
,
GlBadge
,
GlBadge
,
GlButton
,
GlButton
,
GlTabs
,
GlTab
,
},
},
props
:
{
props
:
{
filterBy
:
{
filterBy
:
{
...
@@ -43,42 +44,41 @@ export default {
...
@@ -43,42 +44,41 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"top-area"
>
<div
class=
"gl-display-flex gl-align-items-center gl-justify-content-space-between"
>
<ul
class=
"nav-links mobile-separator requirements-state-filters js-requirements-state-filters"
>
<gl-tabs
content-class=
"gl-p-0"
>
<li
:class=
"
{ active: isOpenTab }">
<gl-tab
<gl-link
:title-link-attributes=
"
{ 'data-testid': 'state-opened' }"
id=
"state-opened"
:active="isOpenTab"
data-state=
"opened"
@click="$emit('click-tab', { filterBy: $options.FilterState.opened })"
:title=
"__('Filter by requirements that are currently opened.')"
>
@
click=
"$emit('click-tab',
{ filterBy: $options.FilterState.opened })"
<template
#title
>
>
<span>
{{
__
(
'
Open
'
)
}}
</span>
{{
__
(
'
Open
'
)
}}
<gl-badge
size=
"sm"
class=
"gl-tab-counter-badge"
>
{{
requirementsCount
.
OPENED
}}
</gl-badge>
<gl-badge>
{{
requirementsCount
.
OPENED
}}
</gl-badge>
</
template
>
</gl-link>
</gl-tab>
</li>
<gl-tab
<li
:class=
"
{ active: isArchivedTab }">
:title-link-attributes=
"{ 'data-testid': 'state-archived' }"
<gl-link
:active=
"isArchivedTab"
id=
"state-archived"
@
click=
"$emit('click-tab', { filterBy: $options.FilterState.archived })"
data-state=
"archived"
>
:title=
"__('Filter by requirements that are currently archived.')"
<
template
#title
>
@
click=
"$emit('click-tab',
{ filterBy: $options.FilterState.archived })"
<span>
{{
__
(
'
Archived
'
)
}}
</span>
>
<gl-badge
size=
"sm"
class=
"gl-tab-counter-badge"
>
{{
{{
__
(
'
Archived
'
)
}}
requirementsCount
.
ARCHIVED
<gl-badge>
{{
requirementsCount
.
ARCHIVED
}}
</gl-badge>
}}
</gl-badge>
</gl-link>
</
template
>
</li>
</gl-tab>
<li
:class=
"
{ active: isAllTab }">
<gl-tab
<gl-link
:title-link-attributes=
"{ 'data-testid': 'state-all' }"
id=
"state-all"
:active=
"isAllTab"
data-state=
"all"
@
click=
"$emit('click-tab', { filterBy: $options.FilterState.all })"
:title=
"__('Show all requirements.')"
>
@
click=
"$emit('click-tab',
{ filterBy: $options.FilterState.all })"
<
template
#title
>
>
<span>
{{
__
(
'
All
'
)
}}
</span>
{{
__
(
'
All
'
)
}}
<gl-badge
size=
"sm"
class=
"gl-tab-counter-badge"
>
{{
requirementsCount
.
ALL
}}
</gl-badge>
<gl-badge>
{{
requirementsCount
.
ALL
}}
</gl-badge>
</
template
>
</gl-link>
</gl-tab>
</li>
</gl-tabs>
</ul>
<div
v-if=
"isOpenTab && canCreateRequirement"
class=
"nav-controls"
>
<div
v-if=
"isOpenTab && canCreateRequirement"
class=
"nav-controls"
>
<gl-button
<gl-button
category=
"primary"
category=
"primary"
...
...
ee/changelogs/unreleased/230727-yet-another-requiremnets-tab-migration.yml
0 → 100644
View file @
2bb1c2a7
---
title
:
Migrate requirements tabs to gltab
merge_request
:
45736
author
:
type
:
changed
ee/spec/features/projects/requirements_management/requirements_list_spec.rb
View file @
2bb1c2a7
...
@@ -44,18 +44,15 @@ RSpec.describe 'Requirements list', :js do
...
@@ -44,18 +44,15 @@ RSpec.describe 'Requirements list', :js do
end
end
it
'shows requirements tabs for each status type'
do
it
'shows requirements tabs for each status type'
do
page
.
within
(
'.requirements-state-filters'
)
do
page
.
within
(
'.gl-tabs'
)
do
expect
(
page
).
to
have_selector
(
'li > a#state-opened'
)
expect
(
page
).
to
have_selector
(
'li > a[data-testid="state-opened"]'
)
expect
(
find
(
'li > a#state-opened'
)[
:title
]).
to
eq
(
'Filter by requirements that are currently opened.'
)
expect
(
find
(
'li > a[data-testid="state-opened"] .badge'
)).
to
have_content
(
'3'
)
expect
(
find
(
'li > a#state-opened .badge'
)).
to
have_content
(
'3'
)
expect
(
page
).
to
have_selector
(
'li > a[data-testid="state-archived"]'
)
expect
(
page
).
to
have_selector
(
'li > a#state-archived'
)
expect
(
find
(
'li > a[data-testid="state-archived"] .badge'
)).
to
have_content
(
'1'
)
expect
(
find
(
'li > a#state-archived'
)[
:title
]).
to
eq
(
'Filter by requirements that are currently archived.'
)
expect
(
find
(
'li > a#state-archived .badge'
)).
to
have_content
(
'1'
)
expect
(
page
).
to
have_selector
(
'li > a[data-testid="state-all"]'
)
expect
(
find
(
'li > a[data-testid="state-all"] .badge'
)).
to
have_content
(
'4'
)
expect
(
page
).
to
have_selector
(
'li > a#state-all'
)
expect
(
find
(
'li > a#state-all'
)[
:title
]).
to
eq
(
'Show all requirements.'
)
expect
(
find
(
'li > a#state-all .badge'
)).
to
have_content
(
'4'
)
end
end
end
end
...
@@ -91,16 +88,16 @@ RSpec.describe 'Requirements list', :js do
...
@@ -91,16 +88,16 @@ RSpec.describe 'Requirements list', :js do
end
end
it
'updates requirements count in nav sidebar and opened and all tab badges'
do
it
'updates requirements count in nav sidebar and opened and all tab badges'
do
page
.
within
(
'.
requirements-state-filter
s'
)
do
page
.
within
(
'.
gl-tab
s'
)
do
expect
(
find
(
'li > a
#state-opened
.badge'
)).
to
have_content
(
'3'
)
expect
(
find
(
'li > a
[data-testid="state-opened"]
.badge'
)).
to
have_content
(
'3'
)
expect
(
find
(
'li > a
#state-all
.badge'
)).
to
have_content
(
'4'
)
expect
(
find
(
'li > a
[data-testid="state-all"]
.badge'
)).
to
have_content
(
'4'
)
end
end
create_requirement
(
'Foobar'
)
create_requirement
(
'Foobar'
)
page
.
within
(
'.
requirements-state-filter
s'
)
do
page
.
within
(
'.
gl-tab
s'
)
do
expect
(
find
(
'li > a
#state-opened
.badge'
)).
to
have_content
(
'4'
)
expect
(
find
(
'li > a
[data-testid="state-opened"]
.badge'
)).
to
have_content
(
'4'
)
expect
(
find
(
'li > a
#state-all
.badge'
)).
to
have_content
(
'5'
)
expect
(
find
(
'li > a
[data-testid="state-all"]
.badge'
)).
to
have_content
(
'5'
)
end
end
end
end
end
end
...
@@ -187,16 +184,16 @@ RSpec.describe 'Requirements list', :js do
...
@@ -187,16 +184,16 @@ RSpec.describe 'Requirements list', :js do
end
end
expect
(
page
.
find
(
'.requirements-list-container'
)).
to
have_selector
(
'li.requirement'
,
count:
2
)
expect
(
page
.
find
(
'.requirements-list-container'
)).
to
have_selector
(
'li.requirement'
,
count:
2
)
page
.
within
(
'.
requirements-state-filter
s'
)
do
page
.
within
(
'.
gl-tab
s'
)
do
expect
(
find
(
'li > a
#state-opened
.badge'
)).
to
have_content
(
'2'
)
expect
(
find
(
'li > a
[data-testid="state-opened"]
.badge'
)).
to
have_content
(
'2'
)
expect
(
find
(
'li > a
#state-archived
.badge'
)).
to
have_content
(
'2'
)
expect
(
find
(
'li > a
[data-testid="state-archived"]
.badge'
)).
to
have_content
(
'2'
)
end
end
end
end
end
end
context
'archived tab'
do
context
'archived tab'
do
before
do
before
do
find
(
'li > a
#state-archived
'
).
click
find
(
'li > a
[data-testid="state-archived"]
'
).
click
wait_for_requests
wait_for_requests
end
end
...
@@ -230,16 +227,16 @@ RSpec.describe 'Requirements list', :js do
...
@@ -230,16 +227,16 @@ RSpec.describe 'Requirements list', :js do
end
end
expect
(
page
.
find
(
'.requirements-list-container'
)).
to
have_selector
(
'li.requirement'
,
count:
0
)
expect
(
page
.
find
(
'.requirements-list-container'
)).
to
have_selector
(
'li.requirement'
,
count:
0
)
page
.
within
(
'.
requirements-state-filter
s'
)
do
page
.
within
(
'.
gl-tab
s'
)
do
expect
(
find
(
'li > a
#state-opened
.badge'
)).
to
have_content
(
'4'
)
expect
(
find
(
'li > a
[data-testid="state-opened"]
.badge'
)).
to
have_content
(
'4'
)
expect
(
find
(
'li > a
#state-archived
.badge'
)).
to
have_content
(
'0'
)
expect
(
find
(
'li > a
[data-testid="state-archived"]
.badge'
)).
to
have_content
(
'0'
)
end
end
end
end
end
end
context
'all tab'
do
context
'all tab'
do
before
do
before
do
find
(
'li > a
#state-all
'
).
click
find
(
'li > a
[data-testid="state-all"]
'
).
click
wait_for_requests
wait_for_requests
end
end
...
...
ee/spec/frontend/requirements/components/requirements_tabs_spec.js
View file @
2bb1c2a7
import
{
Gl
Link
,
GlBadge
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
Gl
Tab
,
GlBadge
,
GlButton
,
GlTabs
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
RequirementsTabs
from
'
ee/requirements/components/requirements_tabs.vue
'
;
import
RequirementsTabs
from
'
ee/requirements/components/requirements_tabs.vue
'
;
...
@@ -19,6 +19,10 @@ const createComponent = ({
...
@@ -19,6 +19,10 @@ const createComponent = ({
showCreateForm
,
showCreateForm
,
canCreateRequirement
,
canCreateRequirement
,
},
},
stubs
:
{
GlTabs
,
GlTab
,
},
});
});
describe
(
'
RequirementsTabs
'
,
()
=>
{
describe
(
'
RequirementsTabs
'
,
()
=>
{
...
@@ -34,39 +38,30 @@ describe('RequirementsTabs', () => {
...
@@ -34,39 +38,30 @@ describe('RequirementsTabs', () => {
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
renders "Open" tab
'
,
()
=>
{
it
(
'
renders "Open" tab
'
,
()
=>
{
const
tabEl
=
wrapper
.
findAll
(
Gl
Link
).
at
(
0
);
const
tabEl
=
wrapper
.
findAll
(
Gl
Tab
).
at
(
0
);
expect
(
tabEl
.
attributes
(
'
id
'
)).
toBe
(
'
state-opened
'
);
expect
(
tabEl
.
attributes
(
'
data-state
'
)).
toBe
(
'
opened
'
);
expect
(
tabEl
.
attributes
(
'
title
'
)).
toBe
(
'
Filter by requirements that are currently opened.
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
Open
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
Open
'
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
OPENED
}
`
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
OPENED
}
`
);
});
});
it
(
'
renders "Archived" tab
'
,
()
=>
{
it
(
'
renders "Archived" tab
'
,
()
=>
{
const
tabEl
=
wrapper
.
findAll
(
Gl
Link
).
at
(
1
);
const
tabEl
=
wrapper
.
findAll
(
Gl
Tab
).
at
(
1
);
expect
(
tabEl
.
attributes
(
'
id
'
)).
toBe
(
'
state-archived
'
);
expect
(
tabEl
.
attributes
(
'
data-state
'
)).
toBe
(
'
archived
'
);
expect
(
tabEl
.
attributes
(
'
title
'
)).
toBe
(
'
Filter by requirements that are currently archived.
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
Archived
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
Archived
'
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
ARCHIVED
}
`
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
ARCHIVED
}
`
);
});
});
it
(
'
renders "All" tab
'
,
()
=>
{
it
(
'
renders "All" tab
'
,
()
=>
{
const
tabEl
=
wrapper
.
findAll
(
Gl
Link
).
at
(
2
);
const
tabEl
=
wrapper
.
findAll
(
Gl
Tab
).
at
(
2
);
expect
(
tabEl
.
attributes
(
'
id
'
)).
toBe
(
'
state-all
'
);
expect
(
tabEl
.
attributes
(
'
data-state
'
)).
toBe
(
'
all
'
);
expect
(
tabEl
.
attributes
(
'
title
'
)).
toBe
(
'
Show all requirements.
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
All
'
);
expect
(
tabEl
.
text
()).
toContain
(
'
All
'
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
ALL
}
`
);
expect
(
tabEl
.
find
(
GlBadge
).
text
()).
toBe
(
`
${
mockRequirementsCount
.
ALL
}
`
);
});
});
it
(
'
renders class `active` on currently selected tab
'
,
()
=>
{
it
(
'
renders class `active` on currently selected tab
'
,
()
=>
{
const
tabEl
=
wrapper
.
findAll
(
'
li
'
).
at
(
0
);
const
tabEl
=
wrapper
.
findAll
(
GlTab
).
at
(
0
);
expect
(
tabEl
.
classes
()).
toContain
(
'
active
'
);
expect
(
tabEl
.
attributes
(
'
active
'
)).
toBeDefined
(
);
});
});
it
(
'
renders "New requirement" button when current tab is "Open" tab
'
,
()
=>
{
it
(
'
renders "New requirement" button when current tab is "Open" tab
'
,
()
=>
{
...
...
locale/gitlab.pot
View file @
2bb1c2a7
...
@@ -12182,12 +12182,6 @@ msgstr ""
...
@@ -12182,12 +12182,6 @@ msgstr ""
msgid "Filter by name"
msgid "Filter by name"
msgstr ""
msgstr ""
msgid "Filter by requirements that are currently archived."
msgstr ""
msgid "Filter by requirements that are currently opened."
msgstr ""
msgid "Filter by status"
msgid "Filter by status"
msgstr ""
msgstr ""
...
@@ -25405,9 +25399,6 @@ msgstr ""
...
@@ -25405,9 +25399,6 @@ msgstr ""
msgid "Show all members"
msgid "Show all members"
msgstr ""
msgstr ""
msgid "Show all requirements."
msgstr ""
msgid "Show all test cases."
msgid "Show all test cases."
msgstr ""
msgstr ""
...
...
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