Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
53377567
Commit
53377567
authored
Aug 07, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on overview panel and unit tests
parent
8ed4859b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
30 deletions
+46
-30
src/app/panels/overview/module.js
+2
-0
src/test/specs/overview-ctrl-specs.js
+44
-30
No files found.
src/app/panels/overview/module.js
View file @
53377567
...
...
@@ -37,7 +37,9 @@ function (angular, app, _) {
$scope
.
init
=
function
()
{
panelSrv
.
init
(
this
);
if
(
!
$scope
.
skipDataOnInit
)
{
$scope
.
get_data
();
}
//$scope.$on('refresh', $scope.render);
//$scope.render();
};
...
...
src/test/specs/overview-ctrl-specs.js
View file @
53377567
...
...
@@ -3,46 +3,60 @@ define([
],
function
()
{
'use strict'
;
describe
(
'OverviewCtrl'
,
function
()
{
var
_controller
;
var
_scope
;
var
_datasource
;
function
ControllerTestContext
()
{
var
self
=
this
;
beforeEach
(
module
(
'grafana.services'
));
beforeEach
(
module
(
'grafana.panels.overview'
));
this
.
datasource
=
{};
this
.
datasourceSrv
=
{
getMetricSources
:
function
()
{},
get
:
function
()
{
return
self
.
datasource
;
}
};
beforeEach
(
module
(
function
(
$provide
){
$provide
.
value
(
'datasourceSrv'
,{
getMetricSources
:
function
()
{
},
get
:
function
()
{
return
_datasource
;
}
this
.
providePhase
=
function
()
{
return
module
(
function
(
$provide
)
{
$provide
.
value
(
'datasourceSrv'
,
self
.
datasourceSrv
);
});
}));
beforeEach
(
inject
(
function
(
$controller
,
$rootScope
,
$q
)
{
_scope
=
$rootScope
.
$new
();
_scope
.
panel
=
{
targets
:
[]
};
_scope
.
filter
=
{
timeRange
:
function
()
{
}
};
_scope
.
datasource
=
{
query
:
function
()
{
return
$q
.
resolve
(
'hej'
);
}
this
.
createControllerPhase
=
function
(
controllerName
)
{
return
inject
(
function
(
$controller
,
$rootScope
,
$q
)
{
self
.
scope
=
$rootScope
.
$new
();
self
.
scope
.
panel
=
{};
self
.
scope
.
filter
=
{
timeRange
:
function
()
{}
};
_controller
=
$controller
(
'OverviewCtrl'
,
{
$scope
:
_scope
self
.
$q
=
$q
;
self
.
scope
.
skipDataOnInit
=
true
;
self
.
controller
=
$controller
(
controllerName
,
{
$scope
:
self
.
scope
});
}));
describe
(
'init'
,
function
()
{
beforeEach
(
function
()
{
});
};
it
(
'description'
,
function
()
{
}
describe
(
'OverviewCtrl'
,
function
()
{
var
ctx
=
new
ControllerTestContext
();
beforeEach
(
module
(
'grafana.services'
));
beforeEach
(
module
(
'grafana.panels.overview'
));
beforeEach
(
ctx
.
providePhase
());
beforeEach
(
ctx
.
createControllerPhase
(
'OverviewCtrl'
));
describe
(
'when query return error'
,
function
()
{
beforeEach
(
function
()
{
ctx
.
datasource
.
query
=
function
()
{
return
ctx
.
$q
.
reject
({
message
:
'Some error'
});
};
ctx
.
scope
.
get_data
();
ctx
.
scope
.
$digest
();
});
it
(
'panel.error should be set'
,
function
()
{
expect
(
ctx
.
scope
.
panel
.
error
).
to
.
be
(
"Some error"
);
});
});
});
...
...
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