robeaux 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Gruntfile.js +43 -0
  3. data/Makefile +11 -2
  4. data/README.markdown +2 -0
  5. data/css/main.css +1 -0
  6. data/css/style.css +113 -24
  7. data/css/themes/blackboard.css +1 -0
  8. data/css/themes/dark.css +1 -0
  9. data/css/themes/gray.css +1 -0
  10. data/css/themes/whiteboard.css +1 -0
  11. data/images/bullet-connections-2.png +0 -0
  12. data/images/bullet-connections.png +0 -0
  13. data/images/bullet-devices-2.png +0 -0
  14. data/images/bullet-devices.png +0 -0
  15. data/images/devices-image-2.png +0 -0
  16. data/images/devices-image.png +0 -0
  17. data/images/logo-robeaux.png +0 -0
  18. data/images/robots-icon_03.png +0 -0
  19. data/index.html +15 -8
  20. data/js/controllers/widget_editor_ctrl.js +44 -0
  21. data/js/controllers/widgets_ctrl.js +40 -0
  22. data/js/directives/widget.js +50 -0
  23. data/js/router.js +5 -0
  24. data/js/services/themes.js +9 -5
  25. data/js/services/widgets.js +86 -0
  26. data/js/vendor/angular-route.min.js +1 -2
  27. data/js/vendor/angular.min.js +208 -206
  28. data/js/widgets/attitude.html +32 -0
  29. data/js/widgets/attitude.js +27 -0
  30. data/js/widgets/mindwave.html +51 -0
  31. data/js/widgets/mindwave.js +23 -0
  32. data/less/app.less +21 -0
  33. data/less/objects/buttons.less +32 -0
  34. data/less/objects/connections.less +28 -0
  35. data/less/objects/device.less +30 -0
  36. data/less/objects/forms.less +29 -0
  37. data/less/objects/list.less +27 -0
  38. data/less/objects/nav.less +33 -0
  39. data/less/objects/robot.less +43 -0
  40. data/less/objects/themes.less +18 -0
  41. data/less/objects/widgets.less +85 -0
  42. data/less/support/buttons.less +39 -0
  43. data/less/support/container.less +9 -0
  44. data/less/support/forms.less +18 -0
  45. data/less/support/mixins.less +3 -0
  46. data/less/themes/blackboard.less +158 -0
  47. data/less/themes/dark.less +148 -0
  48. data/less/themes/default.less +52 -0
  49. data/less/themes/gray.less +121 -0
  50. data/less/themes/whiteboard.less +152 -0
  51. data/less/vendor/elements.less +156 -0
  52. data/less/vendor/normalize.less +425 -0
  53. data/less/vendor/semantic-grid.less +67 -0
  54. data/less/views/devices.less +47 -0
  55. data/less/views/robots.less +132 -0
  56. data/less/views/themes.less +31 -0
  57. data/less/views/widgets.less +50 -0
  58. data/package.json +6 -3
  59. data/partials/device.html +66 -57
  60. data/partials/index.html +12 -6
  61. data/partials/robot.html +104 -51
  62. data/partials/themes.html +32 -29
  63. data/partials/widget_editor.html +68 -0
  64. data/robeaux.gemspec +1 -1
  65. data/test/controllers/device_commands_ctrl.js +129 -0
  66. data/test/controllers/device_events_ctrl.js +82 -0
  67. data/test/controllers/index_ctrl.js +48 -0
  68. data/test/controllers/nav_ctrl.js +40 -0
  69. data/test/controllers/robot_commands_ctrl.js +127 -0
  70. data/test/controllers/robot_ctrl.js +62 -0
  71. data/test/controllers/themes_ctrl.js +96 -0
  72. data/test/controllers/widget_editor_ctrl.js +111 -0
  73. data/test/controllers/widgets_ctrl.js +74 -0
  74. data/test/functions/functions.js +30 -0
  75. data/test/karma.conf.js +3 -7
  76. data/test/karma_test_all.conf.js +23 -0
  77. data/test/karma_test_controllers.conf.js +19 -0
  78. data/test/karma_test_functions.conf.js +14 -0
  79. data/test/karma_test_services.conf.js +17 -0
  80. data/test/services/themes.js +122 -0
  81. data/test/services/widgets.js +104 -0
  82. data/test/support/themes.json +9 -0
  83. data/test/support/widgets.json +18 -0
  84. data/test/vendor/angular-mocks.js +13 -13
  85. data/test/vendor/jquery.js +8 -8
  86. metadata +69 -3
  87. data/test/main.js +0 -248
@@ -0,0 +1,111 @@
1
+ describe("Testing Controllers", function() {
2
+ describe('Controller WidgetEditorCtrl:', function() {
3
+
4
+ beforeEach(module('robeaux'));
5
+
6
+ var $scope, $rootScope, $httpBackend, $timeout, testController, data;
7
+
8
+ beforeEach(inject(function($injector) {
9
+ localStorage.clear();
10
+ $timeout = $injector.get('$timeout');
11
+ $httpBackend = $injector.get('$httpBackend');
12
+ $rootScope = $injector.get('$rootScope');
13
+ $scope = $rootScope.$new();
14
+ $scope.widgets = $injector.get('Widgets');
15
+
16
+ var $controller = $injector.get('$controller');
17
+
18
+ testController = function() {
19
+ return $controller('WidgetEditorCtrl', {
20
+ '$scope': $scope
21
+ });
22
+ };
23
+
24
+ var controller = testController();
25
+ jasmine.getJSONFixtures().fixturesPath='base/test/support';
26
+ data = loadJSONFixtures('widgets.json')['widgets.json'];
27
+
28
+ }));
29
+
30
+ afterEach(function() {
31
+ $httpBackend.verifyNoOutstandingExpectation();
32
+ $httpBackend.verifyNoOutstandingRequest();
33
+ });
34
+
35
+ it('should get array of widgets', function() {
36
+ expect($scope.widgets.list).toEqual(data.widgets);
37
+ });
38
+
39
+ describe('add:', function() {
40
+ it('should not add widget with empty name', function() {
41
+ expect($scope.widgets.list.length).toEqual(2);
42
+ $scope.add();
43
+ expect($scope.widgets.list.length).toEqual(2);
44
+ $scope.add('');
45
+ expect($scope.widgets.list.length).toEqual(2);
46
+ });
47
+
48
+ it('should add widget', function() {
49
+ expect($scope.widgets.list.length).toEqual(2);
50
+ $scope.add('new widget');
51
+ expect($scope.widgets.list.length).toEqual(3);
52
+ });
53
+
54
+ it('should add widget and put it on edit mode', function() {
55
+ expect($scope.editing).toEqual(null);
56
+ $scope.add('second widget');
57
+ expect($scope.editing.name).toEqual('second widget');
58
+ });
59
+ });
60
+
61
+ describe('edit:', function() {
62
+ it('should not set widget on edit mode if is not a custom widget', function() {
63
+ expect($scope.editing).toEqual(null);
64
+ $scope.edit(data.widgets[0].name)
65
+ expect($scope.editing).toEqual(null);
66
+ });
67
+
68
+ it('should not set widget on edit mode if widget is already being edited', function() {
69
+ expect($scope.editing).toEqual(null);
70
+ $scope.add('third widget')
71
+ expect($scope.editing.name).toEqual('third widget');
72
+
73
+ $scope.edit('third widget');
74
+ expect($scope.editing).toEqual(null);
75
+ });
76
+ });
77
+
78
+ describe('addAttr:', function() {
79
+ it('should not add attr to the widget if widget is not on edit mode', function() {
80
+ $scope.newAttr = 'new attr';
81
+ expect($scope.editing).toEqual(null);
82
+ $scope.addAttr();
83
+ expect($scope.editing).toEqual(null);
84
+ });
85
+
86
+ it('should add attr to the widget if widget is on edit mode', function() {
87
+ $scope.editing = $scope.widgets.list[0];
88
+ $scope.newAttr = 'new attr';
89
+ expect($scope.editing.attrs.length).toEqual(3);
90
+ $scope.addAttr();
91
+ expect($scope.editing.attrs.length).toEqual(4);
92
+ });
93
+ });
94
+
95
+ describe('removeAttr:', function() {
96
+ it('should not remove attr to the widget if widget is not on edit mode', function() {
97
+ $scope.newAttr = 'new attr';
98
+ expect($scope.editing).toEqual(null);
99
+ $scope.removeAttr();
100
+ expect($scope.editing).toEqual(null);
101
+ });
102
+
103
+ it('should remove attr to the widget if widget is on edit mode', function() {
104
+ $scope.editing = $scope.widgets.list[0];
105
+ expect($scope.editing.attrs.length).toEqual(3);
106
+ $scope.removeAttr();
107
+ expect($scope.editing.attrs.length).toEqual(2);
108
+ });
109
+ });
110
+ });
111
+ });
@@ -0,0 +1,74 @@
1
+ describe("Testing Controllers", function() {
2
+ describe('Controller WidgetsCtrl:', function() {
3
+
4
+ beforeEach(module('robeaux'));
5
+
6
+ var $scope, $rootScope, $httpBackend, $timeout, testController, data;
7
+
8
+ beforeEach(inject(function($injector) {
9
+ localStorage.clear();
10
+ $timeout = $injector.get('$timeout');
11
+ $httpBackend = $injector.get('$httpBackend');
12
+ $rootScope = $injector.get('$rootScope');
13
+ $scope = $rootScope.$new();
14
+
15
+
16
+ var $controller = $injector.get('$controller');
17
+
18
+ testController = function() {
19
+ return $controller('WidgetsCtrl', {
20
+ '$scope': $scope
21
+ });
22
+ };
23
+
24
+ var controller = testController();
25
+ jasmine.getJSONFixtures().fixturesPath='base/test/support';
26
+ data = loadJSONFixtures('widgets.json')['widgets.json'];
27
+
28
+ $scope.widgets = $injector.get('Widgets');
29
+ $scope.activeWidgets = [];
30
+ $scope.newWidget = false;
31
+
32
+ }));
33
+
34
+ afterEach(function() {
35
+ $httpBackend.verifyNoOutstandingExpectation();
36
+ $httpBackend.verifyNoOutstandingRequest();
37
+ });
38
+
39
+ it('should get array of widgets', function() {
40
+ expect($scope.widgets.list).toEqual(data.widgets);
41
+ });
42
+
43
+ describe('newActiveWidget:', function() {
44
+ it('should not activate widget if base is not provided', function() {
45
+ expect($scope.activeWidgets.length).toEqual(0);
46
+ var new_widget = {base: ''}
47
+ $scope.newActiveWidget(new_widget);
48
+ expect($scope.activeWidgets.length).toEqual(0);
49
+ });
50
+
51
+ it('should activate widget if base is provided', function() {
52
+ expect($scope.activeWidgets.length).toEqual(0);
53
+
54
+ var new_widget = {base: $scope.widgets.list[0]}
55
+ $scope.newActiveWidget(new_widget);
56
+ expect($scope.activeWidgets.length).toEqual(1);
57
+ });
58
+ });
59
+
60
+ describe('removeWidget:', function() {
61
+ it('should remove widget form active list', function() {
62
+ expect($scope.activeWidgets.length).toEqual(0);
63
+
64
+ var new_widget = {base: $scope.widgets.list[0]}
65
+ $scope.newActiveWidget(new_widget);
66
+ expect($scope.activeWidgets.length).toEqual(1);
67
+
68
+ $scope.removeWidget(0);
69
+ expect($scope.activeWidgets.length).toEqual(0);
70
+ });
71
+ });
72
+
73
+ });
74
+ });
@@ -0,0 +1,30 @@
1
+ describe('parseParams', function(){
2
+
3
+ beforeEach(module('robeaux'));
4
+
5
+
6
+ it('should set param name to value', function(){
7
+ var form = [
8
+ { 'name': 'bool', 'value': 'TRUE', 'type': 'boolean' },
9
+ { 'name': 'boole', 'value': 'sadg', 'type': 'boolean' },
10
+ { 'name': 'str', 'value': 'isOn', 'type': 'string' },
11
+ { 'name': 'num', 'value': 100, 'type': 'number' }
12
+ ];
13
+ var params = parseParams(form);
14
+ expect(params['num']).toEqual(100);
15
+ expect(params['bool']).toEqual(true);
16
+ expect(params['boole']).toEqual(false);
17
+ expect(params['str']).toEqual('isOn');
18
+ });
19
+
20
+ it('should set empty params to true', function(){
21
+ var form = [
22
+ { 'name': '', 'value': '', 'type': 'boolean' },
23
+ { 'name': '21', 'value': '12','type': 'boolean' },
24
+ ];
25
+
26
+ expect(paramsAreEmpty([form[1]])).toEqual(false);
27
+ expect(paramsAreEmpty([form[0]])).toEqual(true);
28
+ });
29
+
30
+ });
data/test/karma.conf.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Generated on Tue Jul 01 2014 13:33:46 GMT-0700 (PDT)
3
3
 
4
4
  module.exports = function(config) {
5
- config.set({
5
+ return {
6
6
 
7
7
  // base path that will be used to resolve all patterns (eg. files, exclude)
8
8
  basePath: '../',
@@ -21,12 +21,8 @@ module.exports = function(config) {
21
21
  'js/app.js',
22
22
  'js/router.js',
23
23
  'js/*.js',
24
- 'js/**/*.js',
25
- 'test/main.js',
24
+ 'js/**/!(attitude|mindwave).js'
26
25
 
27
- {pattern: 'test/support/robots.json', watched: true, served: true, included: false},
28
- {pattern: 'test/support/myRobot.json', watched: true, served: true, included: false},
29
- {pattern: 'test/support/myDevice.json', watched: true, served: true, included: false}
30
26
  ],
31
27
 
32
28
 
@@ -76,5 +72,5 @@ module.exports = function(config) {
76
72
  // if true, Karma captures browsers, runs the tests and exits
77
73
  singleRun: true
78
74
 
79
- });
75
+ }
80
76
  };
@@ -0,0 +1,23 @@
1
+ var karmaConfig = require('./karma.conf');
2
+
3
+ module.exports = function(config) {
4
+ var conf = karmaConfig(config);
5
+
6
+ conf.files = conf.files.concat([
7
+
8
+ //test files
9
+ 'test/controllers/*.js',
10
+ 'test/directives/*.js',
11
+ 'test/services/*.js',
12
+ 'test/widgets/*.js',
13
+ 'test/functions/*.js',
14
+
15
+ {pattern: 'test/support/robots.json', watched: true, served: true, included: false},
16
+ {pattern: 'test/support/myRobot.json', watched: true, served: true, included: false},
17
+ {pattern: 'test/support/myDevice.json', watched: true, served: true, included: false},
18
+ {pattern: 'test/support/widgets.json', watched: true, served: true, included: false},
19
+ {pattern: 'test/support/themes.json', watched: true, served: true, included: false}
20
+ ]);
21
+
22
+ config.set(conf);
23
+ };
@@ -0,0 +1,19 @@
1
+ var karmaConfig = require('./karma.conf');
2
+
3
+ module.exports = function(config) {
4
+ var conf = karmaConfig(config);
5
+
6
+ conf.files = conf.files.concat([
7
+
8
+ //test files
9
+ 'test/controllers/*.js',
10
+
11
+ {pattern: 'test/support/robots.json', watched: true, served: true, included: false},
12
+ {pattern: 'test/support/myRobot.json', watched: true, served: true, included: false},
13
+ {pattern: 'test/support/myDevice.json', watched: true, served: true, included: false},
14
+ {pattern: 'test/support/widgets.json', watched: true, served: true, included: false},
15
+ {pattern: 'test/support/themes.json', watched: true, served: true, included: false}
16
+ ]);
17
+
18
+ config.set(conf);
19
+ };
@@ -0,0 +1,14 @@
1
+ var karmaConfig = require('./karma.conf');
2
+
3
+ module.exports = function(config) {
4
+ var conf = karmaConfig(config);
5
+
6
+ conf.files = conf.files.concat([
7
+
8
+ //test files
9
+ 'test/functions/*.js'
10
+
11
+ ]);
12
+
13
+ config.set(conf);
14
+ };
@@ -0,0 +1,17 @@
1
+ var karmaConfig = require('./karma.conf');
2
+
3
+ module.exports = function(config) {
4
+ var conf = karmaConfig(config);
5
+
6
+ conf.files = conf.files.concat([
7
+
8
+ //test files
9
+ 'test/services/*.js',
10
+
11
+ {pattern: 'test/support/widgets.json', watched: true, served: true, included: false},
12
+ {pattern: 'test/support/themes.json', watched: true, served: true, included: false}
13
+
14
+ ]);
15
+
16
+ config.set(conf);
17
+ };
@@ -0,0 +1,122 @@
1
+ describe("Testing Services:", function() {
2
+ describe('Service Themes:', function() {
3
+
4
+ beforeEach(module('robeaux'));
5
+
6
+ var $service, data;
7
+
8
+ beforeEach(inject(function($injector) {
9
+ localStorage.clear();
10
+ $service = $injector.get('Themes')
11
+
12
+ jasmine.getJSONFixtures().fixturesPath='base/test/support';
13
+ data = loadJSONFixtures('themes.json')['themes.json'];
14
+ }));
15
+
16
+ it('should contain a Themes service', function() {
17
+ expect($service).not.toEqual(null);
18
+ });
19
+
20
+ describe('load:', function() {
21
+ it('should initialize default and active if nothing is on local storage', function() {
22
+ $service.load();
23
+ expect($service.list).toEqual(data.themes);
24
+ expect($service.active).toEqual(data.themes[0]);
25
+ expect(localStorage['themes']).toEqual(undefined);
26
+ expect(localStorage['active']).toEqual(undefined);
27
+ });
28
+ it('should set default and active with local storage values', function() {
29
+ expect(localStorage['themes']).toEqual(undefined);
30
+ expect(localStorage['active']).toEqual(undefined);
31
+
32
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
33
+ localStorage.setItem('themes', angular.toJson(new_themes));
34
+ localStorage.setItem('active', 'cylon');
35
+
36
+ $service.load();
37
+ expect($service.list).toEqual(new_themes);
38
+ expect($service.active).toEqual(new_themes[1]);
39
+ });
40
+ });
41
+
42
+ describe('save:', function() {
43
+ it('should save values on local storage', function() {
44
+ expect(localStorage['themes']).toEqual(undefined);
45
+ expect(localStorage['active']).toEqual(undefined);
46
+
47
+
48
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
49
+ $service.list = new_themes;
50
+ $service.active = new_themes[1];
51
+
52
+ $service.save();
53
+ expect(localStorage['themes']).toEqual(angular.toJson(new_themes));
54
+ expect(localStorage['active']).toEqual('cylon');
55
+ });
56
+ });
57
+
58
+ describe('find:', function() {
59
+ it('should find a specific theme by name', function() {
60
+
61
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
62
+ $service.list = new_themes;
63
+ $service.save();
64
+
65
+ expect($service.find('cylon')).toEqual(new_themes[1]);
66
+ });
67
+ });
68
+
69
+ describe('add:', function() {
70
+ it('should not add new theme if name already exists', function() {
71
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
72
+ $service.list = new_themes;
73
+ $service.save();
74
+
75
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(2);
76
+ expect($service.add('cylon')).toEqual(false);
77
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(2);
78
+ });
79
+
80
+ it('should add new theme ', function() {
81
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
82
+ $service.list = new_themes;
83
+ $service.save();
84
+
85
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(2);
86
+ expect($service.add('my-new-theme')).toEqual($service.find('my-new-theme'));
87
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(3);
88
+ });
89
+ });
90
+
91
+ describe('remove:', function() {
92
+ it('should remove theme', function() {
93
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
94
+ $service.list = new_themes;
95
+ $service.save();
96
+
97
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(2);
98
+ $service.remove('artoo')
99
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(1);
100
+ });
101
+ });
102
+
103
+ describe('reset:', function() {
104
+ it('should clear local storage themes and active vars', function() {
105
+ expect(localStorage['themes']).toEqual(undefined);
106
+ expect(localStorage['active']).toEqual(undefined);
107
+
108
+ var new_themes = [{ name: 'artoo', custom: false, url: '/css/themes/artoo.css'}, { name: 'cylon', custom: false, url: '/css/themes/cylon.css'}];
109
+ $service.list = new_themes;
110
+ $service.active = new_themes[1];
111
+ $service.save();
112
+
113
+ expect(angular.fromJson(localStorage['themes']).length).toEqual(2);
114
+ expect(localStorage['active']).toEqual('cylon');
115
+
116
+ $service.reset();
117
+ expect(localStorage['themes']).toEqual(undefined);
118
+ expect(localStorage['active']).toEqual(undefined);
119
+ });
120
+ });
121
+ });
122
+ });
@@ -0,0 +1,104 @@
1
+ describe("Testing Services:", function() {
2
+ describe('Service Widgets:', function() {
3
+
4
+ beforeEach(module('robeaux'));
5
+
6
+ var $service, data, new_widgets;
7
+
8
+ beforeEach(inject(function($injector) {
9
+ localStorage.clear();
10
+ $service = $injector.get('Widgets')
11
+
12
+ jasmine.getJSONFixtures().fixturesPath='base/test/support';
13
+ data = loadJSONFixtures('widgets.json')['widgets.json'];
14
+
15
+ new_widgets = [{name: 'mindwave',custom: false,template_url: '/js/widgets/mindwave.html',script_url: '/js/widgets/mindwave.js',attrs: ['robot', 'device', 'event']}];
16
+
17
+ }));
18
+
19
+ it('should contain a Widgets service', function() {
20
+ expect($service).not.toEqual(null);
21
+ });
22
+
23
+ describe('load:', function() {
24
+ it('should initialize default and activeWidgets if nothing is on local storage', function() {
25
+ $service.load();
26
+ expect($service.list).toEqual(data.widgets);
27
+ expect($service.activeWidgets).toEqual({});
28
+ expect(localStorage['widgets']).toEqual(undefined);
29
+ expect(localStorage['activeWidgets']).toEqual(undefined);
30
+ });
31
+ it('should set default and activeWidgets with local storage values', function() {
32
+ expect(localStorage['widgets']).toEqual(undefined);
33
+ expect(localStorage['activeWidgets']).toEqual(undefined);
34
+
35
+ localStorage.setItem('widgets', angular.toJson(new_widgets));
36
+ localStorage.setItem('activeWidgets', angular.toJson(new_widgets[0]));
37
+
38
+ $service.load();
39
+ expect($service.list).toEqual(new_widgets);
40
+ expect($service.activeWidgets).toEqual(new_widgets[0]);
41
+ });
42
+ });
43
+
44
+ describe('save:', function() {
45
+ it('should save values on local storage', function() {
46
+ expect(localStorage['widgets']).toEqual(undefined);
47
+ expect(localStorage['activeWidgets']).toEqual(undefined);
48
+
49
+ $service.list = new_widgets;
50
+ $service.activeWidgets = new_widgets[0];
51
+
52
+ $service.save();
53
+ expect(localStorage['widgets']).toEqual(angular.toJson(new_widgets));
54
+ expect(localStorage['activeWidgets']).toEqual(angular.toJson(new_widgets[0]));
55
+ });
56
+ });
57
+
58
+ describe('find:', function() {
59
+ it('should find a specific widget by name', function() {
60
+
61
+ $service.list = new_widgets;
62
+ $service.save();
63
+
64
+ expect($service.find('mindwave')).toEqual(new_widgets[0]);
65
+ });
66
+ });
67
+
68
+ describe('add:', function() {
69
+ it('should add new widget ', function() {
70
+ $service.list = new_widgets;
71
+ $service.save();
72
+
73
+ expect(angular.fromJson(localStorage['widgets']).length).toEqual(1);
74
+ expect($service.add('my-new-widget')).toEqual($service.find('my-new-widget'));
75
+ expect(angular.fromJson(localStorage['widgets']).length).toEqual(2);
76
+ });
77
+ });
78
+
79
+ describe('remove:', function() {
80
+ it('should remove widget', function() {
81
+ $service.list = new_widgets;
82
+ $service.save();
83
+
84
+ expect(angular.fromJson(localStorage['widgets']).length).toEqual(1);
85
+ $service.remove('mindwave')
86
+ expect(angular.fromJson(localStorage['widgets']).length).toEqual(0);
87
+ });
88
+ });
89
+
90
+ describe('reset:', function() {
91
+ it('should clear local storage widgets vars', function() {
92
+ expect(localStorage['widgets']).toEqual(undefined);
93
+
94
+ $service.list = new_widgets;
95
+ $service.save();
96
+
97
+ expect(angular.fromJson(localStorage['widgets']).length).toEqual(1);
98
+
99
+ $service.reset();
100
+ expect(localStorage['widgets']).toEqual(undefined);
101
+ });
102
+ });
103
+ });
104
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "themes": [
3
+ { "name": "default", "custom": false, "css": "" },
4
+ { "name": "artoo", "custom": false, "url": "/css/themes/artoo.css"},
5
+ { "name": "cylon", "custom": false, "url": "/css/themes/cylon.css"},
6
+ { "name": "gobot", "custom": false, "url": "/css/themes/gobot.css"},
7
+ { "name": "custom", "custom": true, "css": ""}
8
+ ]
9
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "widgets": [
3
+ {
4
+ "name": "mindwave",
5
+ "custom": false,
6
+ "template_url": "/js/widgets/mindwave.html",
7
+ "script_url": "/js/widgets/mindwave.js",
8
+ "attrs": ["robot", "device", "event"]
9
+ },
10
+ {
11
+ "name": "attitude",
12
+ "custom": false,
13
+ "template_url": "/js/widgets/attitude.html",
14
+ "script_url": "/js/widgets/attitude.js",
15
+ "attrs": ["robot", "device", "event"]
16
+ }
17
+ ]
18
+ }
@@ -411,7 +411,7 @@ angular.mock.$LogProvider = function() {
411
411
  angular.forEach(['error', 'warn', 'info', 'log', 'debug'], function(logLevel) {
412
412
  angular.forEach($log[logLevel].logs, function(log) {
413
413
  angular.forEach(log, function (logItem) {
414
- errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' +
414
+ errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n'
415
415
  (logItem.stack || ''));
416
416
  });
417
417
  });
@@ -730,12 +730,12 @@ angular.mock.TzDate = function (offset, timestamp) {
730
730
  // provide this method only on browsers that already have it
731
731
  if (self.toISOString) {
732
732
  self.toISOString = function() {
733
- return padNumber(self.origDate.getUTCFullYear(), 4) + '-' +
734
- padNumber(self.origDate.getUTCMonth() + 1, 2) + '-' +
735
- padNumber(self.origDate.getUTCDate(), 2) + 'T' +
736
- padNumber(self.origDate.getUTCHours(), 2) + ':' +
737
- padNumber(self.origDate.getUTCMinutes(), 2) + ':' +
738
- padNumber(self.origDate.getUTCSeconds(), 2) + '.' +
733
+ return padNumber(self.origDate.getUTCFullYear(), 4) + '-'
734
+ padNumber(self.origDate.getUTCMonth() + 1, 2) + '-'
735
+ padNumber(self.origDate.getUTCDate(), 2) + 'T'
736
+ padNumber(self.origDate.getUTCHours(), 2) + ':'
737
+ padNumber(self.origDate.getUTCMinutes(), 2) + ':'
738
+ padNumber(self.origDate.getUTCSeconds(), 2) + '.'
739
739
  padNumber(self.origDate.getUTCMilliseconds(), 3) + 'Z';
740
740
  };
741
741
  }
@@ -1144,12 +1144,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1144
1144
 
1145
1145
  if (expectation && expectation.match(method, url)) {
1146
1146
  if (!expectation.matchData(data))
1147
- throw new Error('Expected ' + expectation + ' with different data\n' +
1147
+ throw new Error('Expected ' + expectation + ' with different data\n'
1148
1148
  'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data);
1149
1149
 
1150
1150
  if (!expectation.matchHeaders(headers))
1151
- throw new Error('Expected ' + expectation + ' with different headers\n' +
1152
- 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' +
1151
+ throw new Error('Expected ' + expectation + ' with different headers\n'
1152
+ 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: '
1153
1153
  prettyPrint(headers));
1154
1154
 
1155
1155
  expectations.shift();
@@ -1175,7 +1175,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1175
1175
  }
1176
1176
  throw wasExpected ?
1177
1177
  new Error('No response defined !') :
1178
- new Error('Unexpected request: ' + method + ' ' + url + '\n' +
1178
+ new Error('Unexpected request: ' + method + ' ' + url + '\n'
1179
1179
  (expectation ? 'Expected ' + expectation : 'No more request expected'));
1180
1180
  }
1181
1181
 
@@ -1651,7 +1651,7 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) {
1651
1651
  */
1652
1652
  $delegate.verifyNoPendingTasks = function() {
1653
1653
  if ($browser.deferredFns.length) {
1654
- throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): ' +
1654
+ throw new Error('Deferred tasks to flush (' + $browser.deferredFns.length + '): '
1655
1655
  formatPendingTasksAsString($browser.deferredFns));
1656
1656
  }
1657
1657
  };
@@ -2160,4 +2160,4 @@ if(window.jasmine || window.mocha) {
2160
2160
  }
2161
2161
 
2162
2162
 
2163
- })(window, window.angular);
2163
+ })(window, window.angular);