/*! grafana - v4.2.0 - 2017-03-24
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["../playlist_edit_ctrl","test/lib/common"],function(a,b){"use strict";var c,d;b&&b.id;return{setters:[function(a){d=a},function(a){c=a}],execute:function(){c.describe("PlaylistEditCtrl",function(){var a;c.beforeEach(function(){a=new d.PlaylistEditCtrl(null,null,null,null,{current:{params:{}}}),a.dashboardresult=[{id:2,title:"dashboard: 2"},{id:3,title:"dashboard: 3"}],a.tagresult=[{term:"graphite",count:1},{term:"nyc",count:2}]}),c.describe("searchresult returns 2 dashboards, ",function(){c.it("found dashboard should be 2",function(){c.expect(a.dashboardresult.length).to.be(2)}),c.it("filtred result should be 2",function(){a.filterFoundPlaylistItems(),c.expect(a.filteredDashboards.length).to.be(2),c.expect(a.filteredTags.length).to.be(2)}),c.describe("adds one dashboard to playlist, ",function(){c.beforeEach(function(){a.addPlaylistItem({id:2,title:"dashboard: 2"}),a.addTagPlaylistItem({term:"graphite"}),a.filterFoundPlaylistItems()}),c.it("playlistitems should be increased by one",function(){c.expect(a.playlistItems.length).to.be(2)}),c.it("filtred playlistitems should be reduced by one",function(){c.expect(a.filteredDashboards.length).to.be(1),c.expect(a.filteredTags.length).to.be(1)}),c.it("found dashboard should be 2",function(){c.expect(a.dashboardresult.length).to.be(2)}),c.describe("removes one dashboard from playlist, ",function(){c.beforeEach(function(){a.removePlaylistItem(a.playlistItems[0]),a.removePlaylistItem(a.playlistItems[0]),a.filterFoundPlaylistItems()}),c.it("playlistitems should be increased by one",function(){c.expect(a.playlistItems.length).to.be(0)}),c.it("found dashboard should be 2",function(){c.expect(a.dashboardresult.length).to.be(2),c.expect(a.filteredDashboards.length).to.be(2),c.expect(a.filteredTags.length).to.be(2),c.expect(a.tagresult.length).to.be(2)})})})})})}}});