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
25bc2b8a
Commit
25bc2b8a
authored
Nov 15, 2021
by
Nicolò Maria Mezzopera
Committed by
Olena Horal-Koretska
Nov 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Registry Title: fix tag and spacing
parent
4f587105
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
38 deletions
+52
-38
app/assets/javascripts/vue_shared/components/registry/title_area.vue
...javascripts/vue_shared/components/registry/title_area.vue
+7
-4
spec/features/projects/infrastructure_registry_spec.rb
spec/features/projects/infrastructure_registry_spec.rb
+1
-1
spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap
...mponents/details/__snapshots__/package_title_spec.js.snap
+8
-8
spec/frontend/vue_shared/components/registry/title_area_spec.js
...rontend/vue_shared/components/registry/title_area_spec.js
+35
-24
spec/support/shared_examples/features/packages_shared_examples.rb
...port/shared_examples/features/packages_shared_examples.rb
+1
-1
No files found.
app/assets/javascripts/vue_shared/components/registry/title_area.vue
View file @
25bc2b8a
...
@@ -69,20 +69,23 @@ export default {
...
@@ -69,20 +69,23 @@ export default {
/>
/>
<div
class=
"gl-display-flex gl-flex-direction-column"
>
<div
class=
"gl-display-flex gl-flex-direction-column"
>
<h
1
class=
"gl-font-size-h1 gl-mt-3 gl-mb-2
"
data-testid=
"title"
>
<h
2
class=
"gl-font-size-h1 gl-mt-3 gl-mb-0
"
data-testid=
"title"
>
<slot
name=
"title"
>
{{
title
}}
</slot>
<slot
name=
"title"
>
{{
title
}}
</slot>
</h
1
>
</h
2
>
<div
<div
v-if=
"$slots['sub-header']"
v-if=
"$slots['sub-header']"
class=
"gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
1
"
class=
"gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
3
"
>
>
<slot
name=
"sub-header"
></slot>
<slot
name=
"sub-header"
></slot>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"gl-display-flex gl-flex-wrap gl-align-items-center gl-mt-3"
>
<div
v-if=
"metadataSlots.length > 0"
class=
"gl-display-flex gl-flex-wrap gl-align-items-center gl-mt-3"
>
<template
v-if=
"!metadataLoading"
>
<template
v-if=
"!metadataLoading"
>
<div
<div
v-for=
"(row, metadataIndex) in metadataSlots"
v-for=
"(row, metadataIndex) in metadataSlots"
...
...
spec/features/projects/infrastructure_registry_spec.rb
View file @
25bc2b8a
...
@@ -43,7 +43,7 @@ RSpec.describe 'Infrastructure Registry' do
...
@@ -43,7 +43,7 @@ RSpec.describe 'Infrastructure Registry' do
expect
(
page
).
to
have_current_path
(
project_infrastructure_registry_path
(
terraform_module
.
project
,
terraform_module
))
expect
(
page
).
to
have_current_path
(
project_infrastructure_registry_path
(
terraform_module
.
project
,
terraform_module
))
expect
(
page
).
to
have_css
(
'.packages-app h
1
[data-testid="title"]'
,
text:
terraform_module
.
name
)
expect
(
page
).
to
have_css
(
'.packages-app h
2
[data-testid="title"]'
,
text:
terraform_module
.
name
)
expect
(
page
).
to
have_content
(
'Provision instructions'
)
expect
(
page
).
to
have_content
(
'Provision instructions'
)
expect
(
page
).
to
have_content
(
'Registry setup'
)
expect
(
page
).
to
have_content
(
'Registry setup'
)
...
...
spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap
View file @
25bc2b8a
...
@@ -19,15 +19,15 @@ exports[`PackageTitle renders with tags 1`] = `
...
@@ -19,15 +19,15 @@ exports[`PackageTitle renders with tags 1`] = `
<div
<div
class="gl-display-flex gl-flex-direction-column"
class="gl-display-flex gl-flex-direction-column"
>
>
<h
1
<h
2
class="gl-font-size-h1 gl-mt-3 gl-mb-
2
"
class="gl-font-size-h1 gl-mt-3 gl-mb-
0
"
data-testid="title"
data-testid="title"
>
>
@gitlab-org/package-15
@gitlab-org/package-15
</h
1
>
</h
2
>
<div
<div
class="gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
1
"
class="gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
3
"
>
>
<gl-icon-stub
<gl-icon-stub
class="gl-mr-3"
class="gl-mr-3"
...
@@ -117,15 +117,15 @@ exports[`PackageTitle renders without tags 1`] = `
...
@@ -117,15 +117,15 @@ exports[`PackageTitle renders without tags 1`] = `
<div
<div
class="gl-display-flex gl-flex-direction-column"
class="gl-display-flex gl-flex-direction-column"
>
>
<h
1
<h
2
class="gl-font-size-h1 gl-mt-3 gl-mb-
2
"
class="gl-font-size-h1 gl-mt-3 gl-mb-
0
"
data-testid="title"
data-testid="title"
>
>
@gitlab-org/package-15
@gitlab-org/package-15
</h
1
>
</h
2
>
<div
<div
class="gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
1
"
class="gl-display-flex gl-align-items-center gl-text-gray-500 gl-mt-
3
"
>
>
<gl-icon-stub
<gl-icon-stub
class="gl-mr-3"
class="gl-mr-3"
...
...
spec/frontend/vue_shared/components/registry/title_area_spec.js
View file @
25bc2b8a
import
{
GlAvatar
,
GlSprintf
,
GlLink
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlAvatar
,
GlSprintf
,
GlLink
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
component
from
'
~/vue_shared/components/registry/title_area.vue
'
;
import
component
from
'
~/vue_shared/components/registry/title_area.vue
'
;
describe
(
'
title area
'
,
()
=>
{
describe
(
'
title area
'
,
()
=>
{
...
@@ -7,18 +8,18 @@ describe('title area', () => {
...
@@ -7,18 +8,18 @@ describe('title area', () => {
const
DYNAMIC_SLOT
=
'
metadata-dynamic-slot
'
;
const
DYNAMIC_SLOT
=
'
metadata-dynamic-slot
'
;
const
findSubHeaderSlot
=
()
=>
wrapper
.
find
(
'
[data-testid="sub-header"]
'
);
const
findSubHeaderSlot
=
()
=>
wrapper
.
find
ByTestId
(
'
sub-header
'
);
const
findRightActionsSlot
=
()
=>
wrapper
.
find
(
'
[data-testid="right-actions"]
'
);
const
findRightActionsSlot
=
()
=>
wrapper
.
find
ByTestId
(
'
right-actions
'
);
const
findMetadataSlot
=
(
name
)
=>
wrapper
.
find
(
`[data-testid="
${
name
}
"]`
);
const
findMetadataSlot
=
(
name
)
=>
wrapper
.
find
ByTestId
(
name
);
const
findTitle
=
()
=>
wrapper
.
find
(
'
[data-testid="title"]
'
);
const
findTitle
=
()
=>
wrapper
.
find
ByTestId
(
'
title
'
);
const
findAvatar
=
()
=>
wrapper
.
find
(
GlAvatar
);
const
findAvatar
=
()
=>
wrapper
.
find
Component
(
GlAvatar
);
const
findInfoMessages
=
()
=>
wrapper
.
findAll
(
'
[data-testid="info-message"]
'
);
const
findInfoMessages
=
()
=>
wrapper
.
findAll
ByTestId
(
'
info-message
'
);
const
findDynamicSlot
=
()
=>
wrapper
.
find
(
`[data-testid="
${
DYNAMIC_SLOT
}
`
);
const
findDynamicSlot
=
()
=>
wrapper
.
find
ByTestId
(
DYNAMIC_SLOT
);
const
findSlotOrderElements
=
()
=>
wrapper
.
findAll
(
'
[slot-test]
'
);
const
findSlotOrderElements
=
()
=>
wrapper
.
findAll
(
'
[slot-test]
'
);
const
findSkeletonLoader
=
()
=>
wrapper
.
find
(
GlSkeletonLoader
);
const
findSkeletonLoader
=
()
=>
wrapper
.
find
Component
(
GlSkeletonLoader
);
const
mountComponent
=
({
propsData
=
{
title
:
'
foo
'
},
slots
}
=
{})
=>
{
const
mountComponent
=
({
propsData
=
{
title
:
'
foo
'
},
slots
}
=
{})
=>
{
wrapper
=
shallowMount
(
component
,
{
wrapper
=
shallowMount
Extended
(
component
,
{
propsData
,
propsData
,
stubs
:
{
GlSprintf
},
stubs
:
{
GlSprintf
},
slots
:
{
slots
:
{
...
@@ -29,6 +30,12 @@ describe('title area', () => {
...
@@ -29,6 +30,12 @@ describe('title area', () => {
});
});
};
};
const
generateSlotMocks
=
(
names
)
=>
names
.
reduce
((
acc
,
current
)
=>
{
acc
[
current
]
=
`<div data-testid="
${
current
}
" />`
;
return
acc
;
},
{});
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
wrapper
=
null
;
wrapper
=
null
;
...
@@ -40,6 +47,7 @@ describe('title area', () => {
...
@@ -40,6 +47,7 @@ describe('title area', () => {
expect
(
findTitle
().
text
()).
toBe
(
'
foo
'
);
expect
(
findTitle
().
text
()).
toBe
(
'
foo
'
);
});
});
it
(
'
if slot is present uses slot
'
,
()
=>
{
it
(
'
if slot is present uses slot
'
,
()
=>
{
mountComponent
({
mountComponent
({
slots
:
{
slots
:
{
...
@@ -88,24 +96,21 @@ describe('title area', () => {
...
@@ -88,24 +96,21 @@ describe('title area', () => {
${[
'
metadata-foo
'
,
'
metadata-bar
'
]}
${[
'
metadata-foo
'
,
'
metadata-bar
'
]}
${[
'
metadata-foo
'
,
'
metadata-bar
'
,
'
metadata-baz
'
]}
${[
'
metadata-foo
'
,
'
metadata-bar
'
,
'
metadata-baz
'
]}
`
(
'
$slotNames metadata slots
'
,
({
slotNames
})
=>
{
`
(
'
$slotNames metadata slots
'
,
({
slotNames
})
=>
{
const
slotMocks
=
slotNames
.
reduce
((
acc
,
current
)
=>
{
const
slots
=
generateSlotMocks
(
slotNames
);
acc
[
current
]
=
`<div data-testid="
${
current
}
" />`
;
return
acc
;
},
{});
it
(
'
exist when the slot is present
'
,
async
()
=>
{
it
(
'
exist when the slot is present
'
,
async
()
=>
{
mountComponent
({
slots
:
slotMocks
});
mountComponent
({
slots
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
slotNames
.
forEach
((
name
)
=>
{
slotNames
.
forEach
((
name
)
=>
{
expect
(
findMetadataSlot
(
name
).
exists
()).
toBe
(
true
);
expect
(
findMetadataSlot
(
name
).
exists
()).
toBe
(
true
);
});
});
});
});
it
(
'
is/are hidden when metadata-loading is true
'
,
async
()
=>
{
it
(
'
is/are hidden when metadata-loading is true
'
,
async
()
=>
{
mountComponent
({
slots
:
slotMocks
,
propsData
:
{
title
:
'
foo
'
,
metadataLoading
:
true
}
});
mountComponent
({
slots
,
propsData
:
{
title
:
'
foo
'
,
metadataLoading
:
true
}
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
slotNames
.
forEach
((
name
)
=>
{
slotNames
.
forEach
((
name
)
=>
{
expect
(
findMetadataSlot
(
name
).
exists
()).
toBe
(
false
);
expect
(
findMetadataSlot
(
name
).
exists
()).
toBe
(
false
);
});
});
...
@@ -113,14 +118,20 @@ describe('title area', () => {
...
@@ -113,14 +118,20 @@ describe('title area', () => {
});
});
describe
(
'
metadata skeleton loader
'
,
()
=>
{
describe
(
'
metadata skeleton loader
'
,
()
=>
{
it
(
'
is hidden when metadata loading is false
'
,
()
=>
{
const
slots
=
generateSlotMocks
([
'
metadata-foo
'
]);
mountComponent
();
it
(
'
is hidden when metadata loading is false
'
,
async
()
=>
{
mountComponent
({
slots
});
await
nextTick
();
expect
(
findSkeletonLoader
().
exists
()).
toBe
(
false
);
expect
(
findSkeletonLoader
().
exists
()).
toBe
(
false
);
});
});
it
(
'
is shown when metadata loading is true
'
,
()
=>
{
it
(
'
is shown when metadata loading is true
'
,
async
()
=>
{
mountComponent
({
propsData
:
{
metadataLoading
:
true
}
});
mountComponent
({
propsData
:
{
metadataLoading
:
true
},
slots
});
await
nextTick
();
expect
(
findSkeletonLoader
().
exists
()).
toBe
(
true
);
expect
(
findSkeletonLoader
().
exists
()).
toBe
(
true
);
});
});
...
@@ -143,7 +154,7 @@ describe('title area', () => {
...
@@ -143,7 +154,7 @@ describe('title area', () => {
// updating the slots like we do on line 141 does not cause the updated lifecycle-hook to be triggered
// updating the slots like we do on line 141 does not cause the updated lifecycle-hook to be triggered
wrapper
.
vm
.
$forceUpdate
();
wrapper
.
vm
.
$forceUpdate
();
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
findDynamicSlot
().
exists
()).
toBe
(
true
);
expect
(
findDynamicSlot
().
exists
()).
toBe
(
true
);
});
});
...
@@ -163,7 +174,7 @@ describe('title area', () => {
...
@@ -163,7 +174,7 @@ describe('title area', () => {
// updating the slots like we do on line 159 does not cause the updated lifecycle-hook to be triggered
// updating the slots like we do on line 159 does not cause the updated lifecycle-hook to be triggered
wrapper
.
vm
.
$forceUpdate
();
wrapper
.
vm
.
$forceUpdate
();
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
findSlotOrderElements
().
at
(
0
).
attributes
(
'
data-testid
'
)).
toBe
(
DYNAMIC_SLOT
);
expect
(
findSlotOrderElements
().
at
(
0
).
attributes
(
'
data-testid
'
)).
toBe
(
DYNAMIC_SLOT
);
expect
(
findSlotOrderElements
().
at
(
1
).
attributes
(
'
data-testid
'
)).
toBe
(
'
metadata-foo
'
);
expect
(
findSlotOrderElements
().
at
(
1
).
attributes
(
'
data-testid
'
)).
toBe
(
'
metadata-foo
'
);
...
...
spec/support/shared_examples/features/packages_shared_examples.rb
View file @
25bc2b8a
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'package details link' do |property|
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'package details link' do |property|
expect
(
page
).
to
have_current_path
(
project_package_path
(
package
.
project
,
package
))
expect
(
page
).
to
have_current_path
(
project_package_path
(
package
.
project
,
package
))
expect
(
page
).
to
have_css
(
'.packages-app h
1
[data-testid="title"]'
,
text:
package
.
name
)
expect
(
page
).
to
have_css
(
'.packages-app h
2
[data-testid="title"]'
,
text:
package
.
name
)
expect
(
page
).
to
have_content
(
'Installation'
)
expect
(
page
).
to
have_content
(
'Installation'
)
expect
(
page
).
to
have_content
(
'Registry setup'
)
expect
(
page
).
to
have_content
(
'Registry setup'
)
...
...
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