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
93c84858
Commit
93c84858
authored
Mar 29, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added image component to design detail view
parent
da0d31c0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
11 deletions
+120
-11
ee/app/assets/javascripts/design_management/components/image.vue
...assets/javascripts/design_management/components/image.vue
+32
-0
ee/app/assets/javascripts/design_management/graphql.js
ee/app/assets/javascripts/design_management/graphql.js
+1
-1
ee/app/assets/javascripts/design_management/pages/design/index.vue
...sets/javascripts/design_management/pages/design/index.vue
+4
-1
ee/spec/features/projects/issues/design_management/user_views_design_spec.rb
...ojects/issues/design_management/user_views_design_spec.rb
+2
-0
ee/spec/frontend/design_management/components/__snapshots__/image_spec.js.snap
...gn_management/components/__snapshots__/image_spec.js.snap
+26
-0
ee/spec/frontend/design_management/components/image_spec.js
ee/spec/frontend/design_management/components/image_spec.js
+34
-0
ee/spec/frontend/design_management/pages/design/__snapshots__/index_spec.js.snap
..._management/pages/design/__snapshots__/index_spec.js.snap
+19
-8
ee/spec/frontend/design_management/pages/design/index_spec.js
...pec/frontend/design_management/pages/design/index_spec.js
+2
-1
No files found.
ee/app/assets/javascripts/design_management/components/image.vue
0 → 100644
View file @
93c84858
<
script
>
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
export
default
{
components
:
{
GlLoadingIcon
,
},
props
:
{
image
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
name
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
isLoading
:
{
type
:
Boolean
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<div
class=
"d-flex align-items-center h-100 w-100 p-3 overflow-hidden js-design-image"
>
<gl-loading-icon
v-if=
"isLoading"
class=
"ml-auto mr-auto"
size=
"md"
color=
"light"
/>
<img
v-else
:src=
"image"
:alt=
"name"
class=
"ml-auto mr-auto img-fluid mh-100"
/>
</div>
</
template
>
ee/app/assets/javascripts/design_management/graphql.js
View file @
93c84858
...
...
@@ -8,7 +8,7 @@ Vue.use(VueApollo);
const
createMockDesign
=
id
=>
({
id
:
Number
(
id
),
image
:
'
http://via.placeholder.com/
3
00
'
,
image
:
'
http://via.placeholder.com/
10
00
'
,
name
:
'
test.jpg
'
,
commentsCount
:
2
,
updatedAt
:
new
Date
().
toString
(),
...
...
ee/app/assets/javascripts/design_management/pages/design/index.vue
View file @
93c84858
<
script
>
import
Toolbar
from
'
../../components/toolbar/index.vue
'
;
import
DesignImage
from
'
../../components/image.vue
'
;
import
getDesignQuery
from
'
../../queries/getDesign.graphql
'
;
export
default
{
components
:
{
DesignImage
,
Toolbar
,
},
props
:
{
...
...
@@ -36,12 +38,13 @@ export default {
</
script
>
<
template
>
<div
class=
"design-detail fixed-top w-100
h-100
"
>
<div
class=
"design-detail fixed-top w-100
position-bottom-0 d-flex flex-column
"
>
<toolbar
:is-loading=
"isLoading"
:name=
"design.name"
:updated-at=
"design.updatedAt"
:updated-by=
"design.updatedBy"
/>
<design-image
:is-loading=
"isLoading"
:image=
"design.image"
:name=
"design.name"
/>
</div>
</
template
>
ee/spec/features/projects/issues/design_management/user_views_design_spec.rb
View file @
93c84858
...
...
@@ -19,5 +19,7 @@ describe 'User views issue designs', :js do
expect
(
page
).
to
have_content
(
'test.jpg'
)
expect
(
page
).
to
have_content
(
'Test Name'
)
end
expect
(
page
).
to
have_selector
(
'.js-design-image'
)
end
end
ee/spec/frontend/design_management/components/__snapshots__/image_spec.js.snap
0 → 100644
View file @
93c84858
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Design management large image component renders image 1`] = `
<div
class="d-flex align-items-center h-100 w-100 p-3 overflow-hidden js-design-image"
>
<img
alt="test"
class="ml-auto mr-auto img-fluid mh-100"
src="test.jpg"
/>
</div>
`;
exports[`Design management large image component renders loading state 1`] = `
<div
class="d-flex align-items-center h-100 w-100 p-3 overflow-hidden js-design-image"
>
<glloadingicon-stub
class="ml-auto mr-auto"
color="light"
label="Loading"
size="md"
/>
</div>
`;
ee/spec/frontend/design_management/components/image_spec.js
0 → 100644
View file @
93c84858
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
DesignImage
from
'
ee/design_management/components/image.vue
'
;
describe
(
'
Design management large image component
'
,
()
=>
{
let
vm
;
function
createComponent
(
propsData
)
{
vm
=
shallowMount
(
DesignImage
,
{
propsData
,
});
}
afterEach
(()
=>
{
vm
.
destroy
();
});
it
(
'
renders loading state
'
,
()
=>
{
createComponent
({
isLoading
:
true
,
});
expect
(
vm
.
element
).
toMatchSnapshot
();
});
it
(
'
renders image
'
,
()
=>
{
createComponent
({
isLoading
:
false
,
image
:
'
test.jpg
'
,
name
:
'
test
'
,
});
expect
(
vm
.
element
).
toMatchSnapshot
();
});
});
ee/spec/frontend/design_management/pages/design/__snapshots__/index_spec.js.snap
View file @
93c84858
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Design management design index page
sets loading state
1`] = `
exports[`Design management design index page
renders design index
1`] = `
<div
class="design-detail fixed-top w-100
h-100
"
class="design-detail fixed-top w-100
position-bottom-0 d-flex flex-column
"
>
<toolbar-stub
isloading="true"
name=""
name="test.jpg"
updatedat=""
updatedby="[object Object]"
/>
<designimage-stub
image="test.jpg"
name="test.jpg"
/>
</div>
`;
exports[`Design management design index page sets loading state
2
`] = `
exports[`Design management design index page sets loading state
1
`] = `
<div
class="design-detail fixed-top w-100
h-100
"
class="design-detail fixed-top w-100
position-bottom-0 d-flex flex-column
"
>
<toolbar-stub
name="test.jpg"
updatedat="01-01-2019"
isloading="true"
name=""
updatedat=""
updatedby="[object Object]"
/>
<designimage-stub
image=""
isloading="true"
name=""
/>
</div>
`;
ee/spec/frontend/design_management/pages/design/index_spec.js
View file @
93c84858
...
...
@@ -25,12 +25,13 @@ describe('Design management design index page', () => {
expect
(
vm
.
element
).
toMatchSnapshot
();
});
it
(
'
sets loading state
'
,
()
=>
{
it
(
'
renders design index
'
,
()
=>
{
createComponent
();
vm
.
setData
({
design
:
{
name
:
'
test.jpg
'
,
image
:
'
test.jpg
'
,
updatedAt
:
'
01-01-2019
'
,
updatedBy
:
{
name
:
'
test
'
,
...
...
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