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
610a90b7
Unverified
Commit
610a90b7
authored
Jun 12, 2018
by
Daniel Lee
Committed by
GitHub
Jun 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12231 from dehrax/12224-graph-tooltip
Karma to Jest: graph-tooltip
parents
d8f26995
da9a28f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
public/app/plugins/panel/graph/specs/graph_tooltip.jest.ts
+15
-15
No files found.
public/app/plugins/panel/graph/specs/
tooltip_specs
.ts
→
public/app/plugins/panel/graph/specs/
graph_tooltip.jest
.ts
View file @
610a90b7
import
{
describe
,
beforeEach
,
it
,
sinon
,
expect
}
from
'../../../../../test/lib/common'
;
jest
.
mock
(
'app/core/core'
,
()
=>
({}))
;
import
$
from
'jquery'
;
import
GraphTooltip
from
'../graph_tooltip'
;
var
scope
=
{
appEvent
:
sinon
.
spy
(),
onAppEvent
:
sinon
.
spy
(),
appEvent
:
jest
.
fn
(),
onAppEvent
:
jest
.
fn
(),
ctrl
:
{},
};
...
...
@@ -47,22 +47,22 @@ describe('findHoverIndexFromData', function() {
it
(
'should return 0 if posX out of lower bounds'
,
function
()
{
var
posX
=
99
;
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
.
b
e
(
0
);
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
B
e
(
0
);
});
it
(
'should return n - 1 if posX out of upper bounds'
,
function
()
{
var
posX
=
108
;
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
.
b
e
(
series
.
data
.
length
-
1
);
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
B
e
(
series
.
data
.
length
-
1
);
});
it
(
'should return i if posX in series'
,
function
()
{
var
posX
=
104
;
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
.
b
e
(
4
);
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
B
e
(
4
);
});
it
(
'should return i if posX not in series and i + 1 > posX'
,
function
()
{
var
posX
=
104.9
;
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
.
b
e
(
4
);
expect
(
tooltip
.
findHoverIndexFromData
(
posX
,
series
)).
to
B
e
(
4
);
});
});
...
...
@@ -73,17 +73,17 @@ describeSharedTooltip('steppedLine false, stack false', function(ctx) {
});
it
(
'should return 2 series'
,
function
()
{
expect
(
ctx
.
results
.
length
).
to
.
b
e
(
2
);
expect
(
ctx
.
results
.
length
).
to
B
e
(
2
);
});
it
(
'should add time to results array'
,
function
()
{
expect
(
ctx
.
results
.
time
).
to
.
b
e
(
10
);
expect
(
ctx
.
results
.
time
).
to
B
e
(
10
);
});
it
(
'should set value and hoverIndex'
,
function
()
{
expect
(
ctx
.
results
[
0
].
value
).
to
.
b
e
(
15
);
expect
(
ctx
.
results
[
1
].
value
).
to
.
b
e
(
2
);
expect
(
ctx
.
results
[
0
].
hoverIndex
).
to
.
b
e
(
0
);
expect
(
ctx
.
results
[
0
].
value
).
to
B
e
(
15
);
expect
(
ctx
.
results
[
1
].
value
).
to
B
e
(
2
);
expect
(
ctx
.
results
[
0
].
hoverIndex
).
to
B
e
(
0
);
});
});
...
...
@@ -121,7 +121,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false', functio
});
it
(
'should show stacked value'
,
function
()
{
expect
(
ctx
.
results
[
1
].
value
).
to
.
b
e
(
17
);
expect
(
ctx
.
results
[
1
].
value
).
to
B
e
(
17
);
});
});
...
...
@@ -152,7 +152,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false, series s
});
it
(
'should not show stacked value'
,
function
()
{
expect
(
ctx
.
results
[
1
].
value
).
to
.
b
e
(
2
);
expect
(
ctx
.
results
[
1
].
value
).
to
B
e
(
2
);
});
});
...
...
@@ -184,6 +184,6 @@ describeSharedTooltip('steppedLine false, stack true, individual true', function
});
it
(
'should not show stacked value'
,
function
()
{
expect
(
ctx
.
results
[
1
].
value
).
to
.
b
e
(
2
);
expect
(
ctx
.
results
[
1
].
value
).
to
B
e
(
2
);
});
});
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