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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ce847d9d
Commit
ce847d9d
authored
Mar 19, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests for dahboard.vue
parent
8d1be1af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
34 deletions
+13
-34
spec/javascripts/monitoring/dashboard_spec.js
spec/javascripts/monitoring/dashboard_spec.js
+1
-0
spec/javascripts/monitoring/dashboard_state_spec.js
spec/javascripts/monitoring/dashboard_state_spec.js
+12
-34
No files found.
spec/javascripts/monitoring/dashboard_spec.js
View file @
ce847d9d
...
@@ -18,6 +18,7 @@ describe('Dashboard', () => {
...
@@ -18,6 +18,7 @@ describe('Dashboard', () => {
deploymentEndpoint
:
null
,
deploymentEndpoint
:
null
,
emptyGettingStartedSvgPath
:
'
/path/to/getting-started.svg
'
,
emptyGettingStartedSvgPath
:
'
/path/to/getting-started.svg
'
,
emptyLoadingSvgPath
:
'
/path/to/loading.svg
'
,
emptyLoadingSvgPath
:
'
/path/to/loading.svg
'
,
emptyNoDataSvgPath
:
'
/path/to/no-data.svg
'
,
emptyUnableToConnectSvgPath
:
'
/path/to/unable-to-connect.svg
'
,
emptyUnableToConnectSvgPath
:
'
/path/to/unable-to-connect.svg
'
,
};
};
...
...
spec/javascripts/monitoring/dashboard_state_spec.js
View file @
ce847d9d
...
@@ -2,13 +2,22 @@ import Vue from 'vue';
...
@@ -2,13 +2,22 @@ import Vue from 'vue';
import
EmptyState
from
'
~/monitoring/components/empty_state.vue
'
;
import
EmptyState
from
'
~/monitoring/components/empty_state.vue
'
;
import
{
statePaths
}
from
'
./mock_data
'
;
import
{
statePaths
}
from
'
./mock_data
'
;
const
createComponent
=
(
propsData
)
=>
{
function
createComponent
(
props
)
{
const
Component
=
Vue
.
extend
(
EmptyState
);
const
Component
=
Vue
.
extend
(
EmptyState
);
return
new
Component
({
return
new
Component
({
propsData
,
propsData
:
{
...
props
,
settingsPath
:
statePaths
.
settingsPath
,
clustersPath
:
statePaths
.
clustersPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
/path/to/getting-started.svg
'
,
emptyLoadingSvgPath
:
'
/path/to/loading.svg
'
,
emptyNoDataSvgPath
:
'
/path/to/no-data.svg
'
,
emptyUnableToConnectSvgPath
:
'
/path/to/unable-to-connect.svg
'
,
},
}).
$mount
();
}).
$mount
();
}
;
}
function
getTextFromNode
(
component
,
selector
)
{
function
getTextFromNode
(
component
,
selector
)
{
return
component
.
$el
.
querySelector
(
selector
).
firstChild
.
nodeValue
.
trim
();
return
component
.
$el
.
querySelector
(
selector
).
firstChild
.
nodeValue
.
trim
();
...
@@ -19,11 +28,6 @@ describe('EmptyState', () => {
...
@@ -19,11 +28,6 @@ describe('EmptyState', () => {
it
(
'
currentState
'
,
()
=>
{
it
(
'
currentState
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
gettingStarted
'
,
selectedState
:
'
gettingStarted
'
,
settingsPath
:
statePaths
.
settingsPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
currentState
).
toBe
(
component
.
states
.
gettingStarted
);
expect
(
component
.
currentState
).
toBe
(
component
.
states
.
gettingStarted
);
...
@@ -32,11 +36,6 @@ describe('EmptyState', () => {
...
@@ -32,11 +36,6 @@ describe('EmptyState', () => {
it
(
'
showButtonDescription returns a description with a link for the unableToConnect state
'
,
()
=>
{
it
(
'
showButtonDescription returns a description with a link for the unableToConnect state
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
unableToConnect
'
,
selectedState
:
'
unableToConnect
'
,
settingsPath
:
statePaths
.
settingsPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
showButtonDescription
).
toEqual
(
true
);
expect
(
component
.
showButtonDescription
).
toEqual
(
true
);
...
@@ -45,11 +44,6 @@ describe('EmptyState', () => {
...
@@ -45,11 +44,6 @@ describe('EmptyState', () => {
it
(
'
showButtonDescription returns the description without a link for any other state
'
,
()
=>
{
it
(
'
showButtonDescription returns the description without a link for any other state
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
loading
'
,
selectedState
:
'
loading
'
,
settingsPath
:
statePaths
.
settingsPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
showButtonDescription
).
toEqual
(
false
);
expect
(
component
.
showButtonDescription
).
toEqual
(
false
);
...
@@ -59,12 +53,6 @@ describe('EmptyState', () => {
...
@@ -59,12 +53,6 @@ describe('EmptyState', () => {
it
(
'
should show the gettingStarted state
'
,
()
=>
{
it
(
'
should show the gettingStarted state
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
gettingStarted
'
,
selectedState
:
'
gettingStarted
'
,
settingsPath
:
statePaths
.
settingsPath
,
clustersPath
:
statePaths
.
clustersPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
...
@@ -76,11 +64,6 @@ describe('EmptyState', () => {
...
@@ -76,11 +64,6 @@ describe('EmptyState', () => {
it
(
'
should show the loading state
'
,
()
=>
{
it
(
'
should show the loading state
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
loading
'
,
selectedState
:
'
loading
'
,
settingsPath
:
statePaths
.
settingsPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
...
@@ -92,11 +75,6 @@ describe('EmptyState', () => {
...
@@ -92,11 +75,6 @@ describe('EmptyState', () => {
it
(
'
should show the unableToConnect state
'
,
()
=>
{
it
(
'
should show the unableToConnect state
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
selectedState
:
'
unableToConnect
'
,
selectedState
:
'
unableToConnect
'
,
settingsPath
:
statePaths
.
settingsPath
,
documentationPath
:
statePaths
.
documentationPath
,
emptyGettingStartedSvgPath
:
'
foo
'
,
emptyLoadingSvgPath
:
'
foo
'
,
emptyUnableToConnectSvgPath
:
'
foo
'
,
});
});
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
...
...
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