robeaux 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +41 -61
- data/css/application.css +2 -0
- data/css/application.css.map +7 -0
- data/index.html +5 -39
- data/js/script.js +7 -0
- data/robeaux.gemspec +16 -8
- metadata +11 -104
- data/.gitignore +0 -1
- data/Gruntfile.js +0 -43
- data/Makefile +0 -22
- data/css/fonts.css +0 -59
- data/css/main.css +0 -1
- data/css/normalize.css +0 -425
- data/css/style.css +0 -558
- data/css/themes/artoo.css +0 -3
- data/css/themes/blackboard.css +0 -1
- data/css/themes/cylon.css +0 -3
- data/css/themes/dark.css +0 -1
- data/css/themes/gobot.css +0 -3
- data/css/themes/gray.css +0 -1
- data/css/themes/whiteboard.css +0 -1
- data/js/app.js +0 -1
- data/js/controllers/device_commands_ctrl.js +0 -81
- data/js/controllers/device_events_ctrl.js +0 -31
- data/js/controllers/index_ctrl.js +0 -9
- data/js/controllers/nav_ctrl.js +0 -5
- data/js/controllers/robot_commands_ctrl.js +0 -33
- data/js/controllers/robot_ctrl.js +0 -25
- data/js/controllers/themes_ctrl.js +0 -36
- data/js/controllers/widget_editor_ctrl.js +0 -44
- data/js/controllers/widgets_ctrl.js +0 -40
- data/js/directives/widget.js +0 -50
- data/js/router.js +0 -27
- data/js/services/themes.js +0 -90
- data/js/services/widgets.js +0 -86
- data/js/vendor/angular-route.min.js +0 -13
- data/js/vendor/angular.min.js +0 -212
- data/js/widgets/attitude.html +0 -32
- data/js/widgets/attitude.js +0 -27
- data/js/widgets/mindwave.html +0 -51
- data/js/widgets/mindwave.js +0 -23
- data/less/app.less +0 -21
- data/less/objects/buttons.less +0 -32
- data/less/objects/connections.less +0 -28
- data/less/objects/device.less +0 -30
- data/less/objects/forms.less +0 -29
- data/less/objects/list.less +0 -27
- data/less/objects/nav.less +0 -33
- data/less/objects/robot.less +0 -43
- data/less/objects/themes.less +0 -18
- data/less/objects/widgets.less +0 -85
- data/less/support/buttons.less +0 -39
- data/less/support/container.less +0 -9
- data/less/support/forms.less +0 -18
- data/less/support/mixins.less +0 -3
- data/less/themes/blackboard.less +0 -158
- data/less/themes/dark.less +0 -148
- data/less/themes/default.less +0 -52
- data/less/themes/gray.less +0 -121
- data/less/themes/whiteboard.less +0 -152
- data/less/vendor/elements.less +0 -156
- data/less/vendor/normalize.less +0 -425
- data/less/vendor/semantic-grid.less +0 -67
- data/less/views/devices.less +0 -47
- data/less/views/robots.less +0 -132
- data/less/views/themes.less +0 -31
- data/less/views/widgets.less +0 -50
- data/package.json +0 -21
- data/partials/device.html +0 -76
- data/partials/index.html +0 -17
- data/partials/robot.html +0 -127
- data/partials/themes.html +0 -42
- data/partials/widget_editor.html +0 -68
- data/test/controllers/device_commands_ctrl.js +0 -129
- data/test/controllers/device_events_ctrl.js +0 -82
- data/test/controllers/index_ctrl.js +0 -48
- data/test/controllers/nav_ctrl.js +0 -40
- data/test/controllers/robot_commands_ctrl.js +0 -127
- data/test/controllers/robot_ctrl.js +0 -62
- data/test/controllers/themes_ctrl.js +0 -96
- data/test/controllers/widget_editor_ctrl.js +0 -111
- data/test/controllers/widgets_ctrl.js +0 -74
- data/test/functions/functions.js +0 -30
- data/test/karma.conf.js +0 -76
- data/test/karma_test_all.conf.js +0 -23
- data/test/karma_test_controllers.conf.js +0 -19
- data/test/karma_test_functions.conf.js +0 -14
- data/test/karma_test_services.conf.js +0 -17
- data/test/services/themes.js +0 -122
- data/test/services/widgets.js +0 -104
- data/test/support/myDevice.json +0 -15
- data/test/support/myRobot.json +0 -31
- data/test/support/robots.json +0 -33
- data/test/support/themes.json +0 -9
- data/test/support/widgets.json +0 -18
- data/test/vendor/angular-mocks.js +0 -2163
- data/test/vendor/jasmine-jquery.js +0 -704
- data/test/vendor/jquery.js +0 -8755
@@ -1,74 +0,0 @@
|
|
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
|
-
});
|
data/test/functions/functions.js
DELETED
@@ -1,30 +0,0 @@
|
|
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
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
// Karma configuration
|
2
|
-
// Generated on Tue Jul 01 2014 13:33:46 GMT-0700 (PDT)
|
3
|
-
|
4
|
-
module.exports = function(config) {
|
5
|
-
return {
|
6
|
-
|
7
|
-
// base path that will be used to resolve all patterns (eg. files, exclude)
|
8
|
-
basePath: '../',
|
9
|
-
|
10
|
-
// frameworks to use
|
11
|
-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
12
|
-
frameworks: ['jasmine'],
|
13
|
-
|
14
|
-
// list of files / patterns to load in the browser
|
15
|
-
files: [
|
16
|
-
'js/vendor/angular.min.js',
|
17
|
-
'js/vendor/angular-route.min.js',
|
18
|
-
'test/vendor/angular-mocks.js',
|
19
|
-
'test/vendor/jquery.js',
|
20
|
-
'test/vendor/jasmine-jquery.js',
|
21
|
-
'js/app.js',
|
22
|
-
'js/router.js',
|
23
|
-
'js/*.js',
|
24
|
-
'js/**/!(attitude|mindwave).js'
|
25
|
-
|
26
|
-
],
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
// list of files to exclude
|
31
|
-
exclude: [
|
32
|
-
|
33
|
-
],
|
34
|
-
|
35
|
-
|
36
|
-
// preprocess matching files before serving them to the browser
|
37
|
-
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
38
|
-
preprocessors: {
|
39
|
-
|
40
|
-
},
|
41
|
-
|
42
|
-
|
43
|
-
// test results reporter to use
|
44
|
-
// possible values: 'dots', 'progress'
|
45
|
-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
46
|
-
reporters: ['progress'],
|
47
|
-
|
48
|
-
|
49
|
-
// web server port
|
50
|
-
port: 9000,
|
51
|
-
|
52
|
-
|
53
|
-
// enable / disable colors in the output (reporters and logs)
|
54
|
-
colors: true,
|
55
|
-
|
56
|
-
|
57
|
-
// level of logging
|
58
|
-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
59
|
-
logLevel: config.LOG_INFO,
|
60
|
-
|
61
|
-
|
62
|
-
// enable / disable watching file and executing tests whenever any file changes
|
63
|
-
autoWatch: true,
|
64
|
-
|
65
|
-
|
66
|
-
// start these browsers
|
67
|
-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
68
|
-
browsers: ['PhantomJS'],
|
69
|
-
|
70
|
-
|
71
|
-
// Continuous Integration mode
|
72
|
-
// if true, Karma captures browsers, runs the tests and exits
|
73
|
-
singleRun: true
|
74
|
-
|
75
|
-
}
|
76
|
-
};
|
data/test/karma_test_all.conf.js
DELETED
@@ -1,23 +0,0 @@
|
|
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
|
-
};
|
@@ -1,19 +0,0 @@
|
|
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
|
-
};
|
@@ -1,17 +0,0 @@
|
|
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
|
-
};
|
data/test/services/themes.js
DELETED
@@ -1,122 +0,0 @@
|
|
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
|
-
});
|
data/test/services/widgets.js
DELETED
@@ -1,104 +0,0 @@
|
|
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
|
-
});
|