/*jshint node: true */
'use strict';

/*
* Name :  MapChartController.js
* Module : UnitTest
* Location : /frontend/test/unit/Controller
*
* History :
* Version       Date        Programmer                  Description
* =================================================================================================
* 0.1.0         2015-05-25  Maria Giovanna Chinellato   Add all attributes and all methods
*
* 0.0.1         2015-05-25  Maria Giovanna Chinellato   Initial code      
* =================================================================================================
*
*/

describe('MapChartController', function(){
	beforeEach(angular.mock.module('app', ['MapChartFactory']));

	var scope;
	var controller;
	//var notify;
	var json = {
			'title' : 'graficonuovo',
			'url' : 'localhost',
			'height' : 400,
			'width' : 400,
			'enabledLegend' : false,
			'horizontalGrid' : false,
			'verticalGrid' : false,
			'legendOnPoint' : false,
			'latitude' : 3,
			'longitude' : 3,
			'scale' : 999,
			'mapType' : 'terrain',
			'zoom' : false,
			'flows' : [{'ID' : '1'},{'ID' : '2'},{'ID' : '3'}]
	};	

    beforeEach(inject(function ($rootScope, $controller, MapChartFactory) {
        scope = $rootScope.$new();
        scope.mapChart = MapChartFactory.build(json);
        //notify = _notify_;
        controller = $controller('MapChartController', {
            $scope : scope
        });
    }));

    afterEach(function(){
    	scope = null;
    });

	//describe('socketConnection', function(){

	//});

	describe('listenOnEvent', function(){

		/*var data = [
			{
				'ID' : '1',
				'records' : [{ 'NorrisRecordID' : '234321', 'value' : [0,1]},{}]
			}
		];*/

		it ('listenOnEvent works fine', function(){
			expect(scope.mapChart.getTitle()).toEqual('graficonuovo');
			/*notify.receive('configGraph',{
				'properties' : {
					'title' : 'titolocambiato'
				},
				'data' : data
			});
			expect(scope.mapChart.getTitle()).toEqual('titolocambiato');
			expect(scope.mapChart.getFlowList()[0].flow.getData()[0].value[0]).toEqual(0);*/
		});
	});

});
@@ -670,29 +670,8 @@
 app'
-, %5B'MapChartFactory'%5D
 ));%0A
@@ -700,16 +700,38 @@
 roller;%0A
+%09var MapChartFactory;%0A
 %09//var n
@@ -1176,239 +1176,174 @@
 er, 
-MapChartFactory) %7B%0A        scope = $rootScope.$new();%0A        scope.mapChart = MapChartFactory.build(json);%0A        //notify = _notify_;%0A        controller = $controller('MapChartController', %7B%0A            $scope : scope%0A        %7D)
+$injector) %7B%0A    %09MapChartFactory = $injector.get('MapChartFactory');%0A        scope = $rootScope.$new();%0A        //notify = _notify_;%0A        controller = $controller
 ;%0A  
@@ -1617,16 +1617,235 @@
 %09%09%5D;*/%0A%0A
+%09%09beforeEach(function()%7B%0A%09%09%09scope.mapChart = MapChartFactory.build(json);%0A%09%09%09controller('MapChartController', %7B%0A%09            $scope : scope%0A%09        %7D);%0A%09%09%7D);%0A%0A%09%09afterEach(function()%7B%0A%09%09%09scope.mapChart = null;%0A%09%09%7D);%0A%09%09%0A
 %09%09it ('l

fix test