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
eef506d8
Commit
eef506d8
authored
Jan 29, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests(playlist): add more test for playlist ui
parent
7f15e2c1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
public/app/features/playlist/playlist_edit_ctrl.ts
+5
-1
public/app/features/playlist/specs/playlist_edit_ctrl_specs.ts
+16
-13
No files found.
public/app/features/playlist/playlist_edit_ctrl.ts
View file @
eef506d8
...
@@ -41,7 +41,11 @@ export class PlaylistEditCtrl {
...
@@ -41,7 +41,11 @@ export class PlaylistEditCtrl {
});
});
});
});
this
.
filteredTags
=
this
.
tagresult
;
this
.
filteredTags
=
_
.
reject
(
this
.
tagresult
,
(
tag
)
=>
{
return
_
.
findWhere
(
this
.
playlistItems
,
(
listPlaylistItem
)
=>
{
return
listPlaylistItem
.
value
===
tag
.
term
;
});
});
}
}
addPlaylistItem
(
playlistItem
)
{
addPlaylistItem
(
playlistItem
)
{
...
...
public/app/features/playlist/specs/playlist_edit_ctrl_specs.ts
View file @
eef506d8
...
@@ -2,7 +2,7 @@ import '../playlist_edit_ctrl';
...
@@ -2,7 +2,7 @@ import '../playlist_edit_ctrl';
import
{
describe
,
beforeEach
,
it
,
expect
}
from
'test/lib/common'
;
import
{
describe
,
beforeEach
,
it
,
expect
}
from
'test/lib/common'
;
import
{
PlaylistEditCtrl
}
from
'../playlist_edit_ctrl'
;
import
{
PlaylistEditCtrl
}
from
'../playlist_edit_ctrl'
;
describe
.
only
(
'PlaylistEditCtrl'
,
function
()
{
describe
(
'PlaylistEditCtrl'
,
()
=>
{
var
ctx
:
any
;
var
ctx
:
any
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctx
=
new
PlaylistEditCtrl
(
null
,
null
,
null
,
null
,
{
current
:
{
params
:
{}
}
});
ctx
=
new
PlaylistEditCtrl
(
null
,
null
,
null
,
null
,
{
current
:
{
params
:
{}
}
});
...
@@ -13,42 +13,46 @@ describe.only('PlaylistEditCtrl', function() {
...
@@ -13,42 +13,46 @@ describe.only('PlaylistEditCtrl', function() {
];
];
ctx
.
tagresult
=
[
ctx
.
tagresult
=
[
{
term
:
'graphie'
,
count
:
1
},
{
term
:
'graphi
t
e'
,
count
:
1
},
{
term
:
'nyc'
,
count
:
2
}
{
term
:
'nyc'
,
count
:
2
}
];
];
});
});
describe
(
'searchresult returns 2 dashboards
'
,
function
()
{
describe
(
'searchresult returns 2 dashboards
, '
,
()
=>
{
it
(
'found dashboard should be 2'
,
function
()
{
it
(
'found dashboard should be 2'
,
()
=>
{
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
});
});
it
(
'filtred
dashboard should be 2'
,
function
()
{
it
(
'filtred
result should be 2'
,
()
=>
{
ctx
.
filterFoundPlaylistItems
();
ctx
.
filterFoundPlaylistItems
();
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
filteredTags
.
length
).
to
.
be
(
2
);
});
});
describe
(
'adds one dashboard to playlist'
,
()
=>
{
describe
(
'adds one dashboard to playlist
,
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctx
.
addPlaylistItem
({
id
:
2
,
title
:
'dashboard: 2'
});
ctx
.
addPlaylistItem
({
id
:
2
,
title
:
'dashboard: 2'
});
ctx
.
addTagPlaylistItem
({
term
:
'graphite'
});
ctx
.
filterFoundPlaylistItems
();
ctx
.
filterFoundPlaylistItems
();
});
});
it
(
'playlistitems should be increased by one'
,
()
=>
{
it
(
'playlistitems should be increased by one'
,
()
=>
{
expect
(
ctx
.
playlistItems
.
length
).
to
.
be
(
1
);
expect
(
ctx
.
playlistItems
.
length
).
to
.
be
(
2
);
});
});
it
(
'filtred playlistitems should be reduced by one'
,
()
=>
{
it
(
'filtred playlistitems should be reduced by one'
,
()
=>
{
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
1
);
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
1
);
expect
(
ctx
.
filteredTags
.
length
).
to
.
be
(
1
);
});
});
it
(
'found dashboard should be 2'
,
function
()
{
it
(
'found dashboard should be 2'
,
()
=>
{
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
});
});
describe
(
'removes one dashboard from playlist'
,
()
=>
{
describe
(
'removes one dashboard from playlist
,
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctx
.
removePlaylistItem
(
ctx
.
playlistItems
[
0
]);
ctx
.
removePlaylistItem
(
ctx
.
playlistItems
[
0
]);
ctx
.
removePlaylistItem
(
ctx
.
playlistItems
[
0
]);
ctx
.
filterFoundPlaylistItems
();
ctx
.
filterFoundPlaylistItems
();
});
});
...
@@ -56,12 +60,11 @@ describe.only('PlaylistEditCtrl', function() {
...
@@ -56,12 +60,11 @@ describe.only('PlaylistEditCtrl', function() {
expect
(
ctx
.
playlistItems
.
length
).
to
.
be
(
0
);
expect
(
ctx
.
playlistItems
.
length
).
to
.
be
(
0
);
});
});
it
(
'found dashboard should be 2'
,
function
()
{
it
(
'found dashboard should be 2'
,
()
=>
{
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
dashboardresult
.
length
).
to
.
be
(
2
);
});
it
(
'filtred playlist should be reduced by one'
,
()
=>
{
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
filteredDashboards
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
filteredTags
.
length
).
to
.
be
(
2
);
expect
(
ctx
.
tagresult
.
length
).
to
.
be
(
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