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
c3fa8470
Commit
c3fa8470
authored
Oct 08, 2020
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add IssuableShowRoot component
Adds IssuableShowRoot component to use with Issuable Show app.
parent
9d239b1a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
221 additions
and
0 deletions
+221
-0
app/assets/javascripts/issuable_show/components/issuable_show_root.vue
...vascripts/issuable_show/components/issuable_show_root.vue
+98
-0
spec/frontend/issuable_show/components/issuable_show_root_spec.js
...ntend/issuable_show/components/issuable_show_root_spec.js
+123
-0
No files found.
app/assets/javascripts/issuable_show/components/issuable_show_root.vue
0 → 100644
View file @
c3fa8470
<
script
>
import
IssuableSidebar
from
'
~/issuable_sidebar/components/issuable_sidebar_root.vue
'
;
import
IssuableHeader
from
'
./issuable_header.vue
'
;
import
IssuableBody
from
'
./issuable_body.vue
'
;
export
default
{
components
:
{
IssuableSidebar
,
IssuableHeader
,
IssuableBody
,
},
props
:
{
issuable
:
{
type
:
Object
,
required
:
true
,
},
statusBadgeClass
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
statusIcon
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
enableEdit
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
enableAutocomplete
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
editFormVisible
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
descriptionPreviewPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
descriptionHelpPath
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
};
</
script
>
<
template
>
<div
class=
"issuable-show-container"
>
<issuable-header
:status-badge-class=
"statusBadgeClass"
:status-icon=
"statusIcon"
:blocked=
"issuable.blocked"
:confidential=
"issuable.confidential"
:created-at=
"issuable.createdAt"
:author=
"issuable.author"
>
<template
#status-badge
>
<slot
name=
"status-badge"
></slot>
</
template
>
<
template
#header-actions
>
<slot
name=
"header-actions"
></slot>
</
template
>
</issuable-header>
<issuable-body
:issuable=
"issuable"
:status-badge-class=
"statusBadgeClass"
:status-icon=
"statusIcon"
:enable-edit=
"enableEdit"
:enable-autocomplete=
"enableAutocomplete"
:edit-form-visible=
"editFormVisible"
:description-preview-path=
"descriptionPreviewPath"
:description-help-path=
"descriptionHelpPath"
@
edit-issuable=
"$emit('edit-issuable', $event)"
>
<
template
#status-badge
>
<slot
name=
"status-badge"
></slot>
</
template
>
<
template
#edit-form-actions=
"actionsProps"
>
<slot
name=
"edit-form-actions"
v-bind=
"actionsProps"
></slot>
</
template
>
</issuable-body>
<issuable-sidebar
@
sidebar-toggle=
"$emit('sidebar-toggle', $event)"
>
<
template
#right-sidebar-items=
"sidebarProps"
>
<slot
name=
"right-sidebar-items"
v-bind=
"sidebarProps"
></slot>
</
template
>
</issuable-sidebar>
</div>
</template>
spec/frontend/issuable_show/components/issuable_show_root_spec.js
0 → 100644
View file @
c3fa8470
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
IssuableShowRoot
from
'
~/issuable_show/components/issuable_show_root.vue
'
;
import
IssuableHeader
from
'
~/issuable_show/components/issuable_header.vue
'
;
import
IssuableBody
from
'
~/issuable_show/components/issuable_body.vue
'
;
import
IssuableSidebar
from
'
~/issuable_sidebar/components/issuable_sidebar_root.vue
'
;
import
{
mockIssuableShowProps
,
mockIssuable
}
from
'
../mock_data
'
;
const
createComponent
=
(
propsData
=
mockIssuableShowProps
)
=>
shallowMount
(
IssuableShowRoot
,
{
propsData
,
stubs
:
{
IssuableHeader
,
IssuableBody
,
IssuableSidebar
,
},
slots
:
{
'
status-badge
'
:
'
Open
'
,
'
header-actions
'
:
`
<button class="js-close">Close issuable</button>
<a class="js-new" href="/gitlab-org/gitlab-shell/-/issues/new">New issuable</a>
`
,
'
edit-form-actions
'
:
`
<button class="js-save">Save changes</button>
<button class="js-cancel">Cancel</button>
`
,
'
right-sidebar-items
'
:
`
<div class="js-todo">
To Do <button class="js-add-todo">Add a To Do</button>
</div>
`
,
},
});
describe
(
'
IssuableShowRoot
'
,
()
=>
{
let
wrapper
;
beforeEach
(()
=>
{
wrapper
=
createComponent
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
template
'
,
()
=>
{
const
{
statusBadgeClass
,
statusIcon
,
enableEdit
,
enableAutocomplete
,
editFormVisible
,
descriptionPreviewPath
,
descriptionHelpPath
,
}
=
mockIssuableShowProps
;
const
{
blocked
,
confidential
,
createdAt
,
author
}
=
mockIssuable
;
it
(
'
renders component container element with class `issuable-show-container`
'
,
()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
issuable-show-container
'
);
});
it
(
'
renders issuable-header component
'
,
()
=>
{
const
issuableHeader
=
wrapper
.
find
(
IssuableHeader
);
expect
(
issuableHeader
.
exists
()).
toBe
(
true
);
expect
(
issuableHeader
.
props
()).
toMatchObject
({
statusBadgeClass
,
statusIcon
,
blocked
,
confidential
,
createdAt
,
author
,
});
expect
(
issuableHeader
.
find
(
'
.issuable-status-box
'
).
text
()).
toContain
(
'
Open
'
);
expect
(
issuableHeader
.
find
(
'
.detail-page-header-actions button.js-close
'
).
exists
()).
toBe
(
true
,
);
expect
(
issuableHeader
.
find
(
'
.detail-page-header-actions a.js-new
'
).
exists
()).
toBe
(
true
);
});
it
(
'
renders issuable-body component
'
,
()
=>
{
const
issuableBody
=
wrapper
.
find
(
IssuableBody
);
expect
(
issuableBody
.
exists
()).
toBe
(
true
);
expect
(
issuableBody
.
props
()).
toMatchObject
({
issuable
:
mockIssuable
,
statusBadgeClass
,
statusIcon
,
enableEdit
,
enableAutocomplete
,
editFormVisible
,
descriptionPreviewPath
,
descriptionHelpPath
,
});
});
it
(
'
renders issuable-sidebar component
'
,
()
=>
{
const
issuableSidebar
=
wrapper
.
find
(
IssuableSidebar
);
expect
(
issuableSidebar
.
exists
()).
toBe
(
true
);
});
describe
(
'
events
'
,
()
=>
{
it
(
'
component emits `edit-issuable` event bubbled via issuable-body
'
,
()
=>
{
const
issuableBody
=
wrapper
.
find
(
IssuableBody
);
issuableBody
.
vm
.
$emit
(
'
edit-issuable
'
);
expect
(
wrapper
.
emitted
(
'
edit-issuable
'
)).
toBeTruthy
();
});
it
(
'
component emits `sidebar-toggle` event bubbled via issuable-sidebar
'
,
()
=>
{
const
issuableSidebar
=
wrapper
.
find
(
IssuableSidebar
);
issuableSidebar
.
vm
.
$emit
(
'
sidebar-toggle
'
,
true
);
expect
(
wrapper
.
emitted
(
'
sidebar-toggle
'
)).
toBeTruthy
();
});
});
});
});
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