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
f7b6f7f3
Commit
f7b6f7f3
authored
Feb 08, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Roadmap Shell Component
parent
9d46d31e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
0 deletions
+126
-0
ee/app/assets/javascripts/roadmap/components/roadmap_shell.vue
...p/assets/javascripts/roadmap/components/roadmap_shell.vue
+71
-0
spec/javascripts/roadmap/components/roadmap_shell_spec.js
spec/javascripts/roadmap/components/roadmap_shell_spec.js
+55
-0
No files found.
ee/app/assets/javascripts/roadmap/components/roadmap_shell.vue
0 → 100644
View file @
f7b6f7f3
<
script
>
import
{
SCROLL_BAR_SIZE
}
from
'
../constants
'
;
import
epicsListSection
from
'
./epics_list_section.vue
'
;
import
roadmapTimelineSection
from
'
./roadmap_timeline_section.vue
'
;
export
default
{
components
:
{
epicsListSection
,
roadmapTimelineSection
,
},
props
:
{
epics
:
{
type
:
Array
,
required
:
true
,
},
timeframe
:
{
type
:
Array
,
required
:
true
,
},
currentGroupId
:
{
type
:
Number
,
required
:
true
,
},
},
data
()
{
return
{
shellWidth
:
0
,
};
},
computed
:
{
tableStyles
()
{
// return width after deducting size of vertical scrollbar
// to hide the scrollbar while preserving ability to scroll
return
`width:
${
this
.
shellWidth
-
SCROLL_BAR_SIZE
}
px;`
;
},
},
mounted
()
{
this
.
$nextTick
(()
=>
{
// Client width at the time of component mount will not
// provide accurate size of viewport until child contents are
// actually loaded and rendered into the DOM, hence
// we wait for nextTick which ensures DOM update has completed
// before setting shellWidth
// see https://vuejs.org/v2/api/#Vue-nextTick
if
(
this
.
$el
.
parentElement
)
{
this
.
shellWidth
=
this
.
$el
.
parentElement
.
clientWidth
;
}
});
},
};
</
script
>
<
template
>
<table
class=
"roadmap-shell"
:style=
"tableStyles"
>
<roadmap-timeline-section
:epics=
"epics"
:timeframe=
"timeframe"
:shell-width=
"shellWidth"
/>
<epics-list-section
:epics=
"epics"
:timeframe=
"timeframe"
:shell-width=
"shellWidth"
:current-group-id=
"currentGroupId"
/>
</table>
</
template
>
spec/javascripts/roadmap/components/roadmap_shell_spec.js
0 → 100644
View file @
f7b6f7f3
import
Vue
from
'
vue
'
;
import
roadmapShellComponent
from
'
ee/roadmap/components/roadmap_shell.vue
'
;
import
{
mockEpic
,
mockTimeframe
,
mockGroupId
}
from
'
../mock_data
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
const
createComponent
=
({
epics
=
[
mockEpic
],
timeframe
=
mockTimeframe
,
currentGroupId
=
mockGroupId
,
})
=>
{
const
Component
=
Vue
.
extend
(
roadmapShellComponent
);
return
mountComponent
(
Component
,
{
epics
,
timeframe
,
currentGroupId
,
});
};
describe
(
'
RoadmapShellComponent
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
createComponent
({});
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
data
'
,
()
=>
{
it
(
'
returns default data props
'
,
()
=>
{
expect
(
vm
.
shellWidth
).
toBe
(
0
);
});
});
describe
(
'
tableStyles
'
,
()
=>
{
it
(
'
returns style string based on shellWidth and Scollbar size
'
,
()
=>
{
// Since shellWidth is initialized on component mount
// from parentElement.clientWidth, it will always be Zero
// as parentElement is not available during tests.
// so end result is 0 - scrollbar_size = -15
expect
(
vm
.
tableStyles
).
toBe
(
'
width: -15px;
'
);
});
});
describe
(
'
template
'
,
()
=>
{
it
(
'
renders component container element with class `roadmap-shell`
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
roadmap-shell
'
)).
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