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,48 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller IndexCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $location, $timeout, testController, data;
|
7
|
-
|
8
|
-
beforeEach(inject(function($injector) {
|
9
|
-
$timeout = $injector.get('$timeout');
|
10
|
-
$httpBackend = $injector.get('$httpBackend');
|
11
|
-
$rootScope = $injector.get('$rootScope');
|
12
|
-
$location = $injector.get('$location');
|
13
|
-
$scope = $rootScope.$new();
|
14
|
-
|
15
|
-
var $controller = $injector.get('$controller');
|
16
|
-
|
17
|
-
testController = function() {
|
18
|
-
return $controller('IndexCtrl', {
|
19
|
-
'$scope': $scope
|
20
|
-
});
|
21
|
-
};
|
22
|
-
|
23
|
-
var controller = testController();
|
24
|
-
|
25
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
26
|
-
data = loadJSONFixtures('robots.json')['robots.json'];
|
27
|
-
$httpBackend.expect('GET', '/api/robots').respond(data);
|
28
|
-
$httpBackend.flush();
|
29
|
-
}));
|
30
|
-
|
31
|
-
afterEach(function() {
|
32
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
33
|
-
$httpBackend.verifyNoOutstandingRequest();
|
34
|
-
});
|
35
|
-
|
36
|
-
it('should get array of robots', function() {
|
37
|
-
expect($scope.robots).toEqual(data.robots);
|
38
|
-
});
|
39
|
-
|
40
|
-
describe('details:', function() {
|
41
|
-
it('should redirect to robot show page', function() {
|
42
|
-
expect($location.path()).toEqual('');
|
43
|
-
$scope.details(data.robots[0].name);
|
44
|
-
expect($location.path()).toEqual('/robots/' + data.robots[0].name);
|
45
|
-
});
|
46
|
-
});
|
47
|
-
});
|
48
|
-
});
|
@@ -1,40 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller NavCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $location, $timeout, testController;
|
7
|
-
|
8
|
-
beforeEach(inject(function($injector) {
|
9
|
-
$timeout = $injector.get('$timeout');
|
10
|
-
$httpBackend = $injector.get('$httpBackend');
|
11
|
-
$rootScope = $injector.get('$rootScope');
|
12
|
-
$location = $injector.get('$location');
|
13
|
-
$scope = $rootScope.$new();
|
14
|
-
|
15
|
-
var $controller = $injector.get('$controller');
|
16
|
-
|
17
|
-
testController = function() {
|
18
|
-
return $controller('NavCtrl', {
|
19
|
-
'$scope': $scope
|
20
|
-
});
|
21
|
-
};
|
22
|
-
|
23
|
-
var controller = testController();
|
24
|
-
}));
|
25
|
-
|
26
|
-
afterEach(function() {
|
27
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
28
|
-
$httpBackend.verifyNoOutstandingRequest();
|
29
|
-
});
|
30
|
-
|
31
|
-
describe('active:', function() {
|
32
|
-
it('should return if current path is the same as the location path', function() {
|
33
|
-
$location.path('robots');
|
34
|
-
|
35
|
-
expect($scope.active('robots')).toEqual(true);
|
36
|
-
expect($scope.active('robots/myRobot')).toEqual(false);
|
37
|
-
});
|
38
|
-
});
|
39
|
-
});
|
40
|
-
});
|
@@ -1,127 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller RobotCommandsCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $timeout, $routeParams, testController;
|
7
|
-
var $injector = angular.injector(['robeaux', 'ng']);
|
8
|
-
|
9
|
-
beforeEach(inject(function($injector) {
|
10
|
-
$timeout = $injector.get('$timeout');
|
11
|
-
$httpBackend = $injector.get('$httpBackend');
|
12
|
-
$rootScope = $injector.get('$rootScope');
|
13
|
-
$routeParams = $injector.get('$routeParams');
|
14
|
-
$scope = $rootScope.$new();
|
15
|
-
|
16
|
-
var $controller = $injector.get('$controller');
|
17
|
-
|
18
|
-
testController = function() {
|
19
|
-
return $controller('RobotCommandsCtrl', {
|
20
|
-
'$scope': $scope
|
21
|
-
});
|
22
|
-
};
|
23
|
-
var controller = testController();
|
24
|
-
|
25
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
26
|
-
var data = loadJSONFixtures('myRobot.json')['myRobot.json'];
|
27
|
-
$scope.robot = data.robot;
|
28
|
-
$scope.robot.params = [ { name: '', value: '', type: 'string' } ];
|
29
|
-
$scope.robot.results = [];
|
30
|
-
}));
|
31
|
-
|
32
|
-
afterEach(function() {
|
33
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
34
|
-
$httpBackend.verifyNoOutstandingRequest();
|
35
|
-
});
|
36
|
-
|
37
|
-
describe('command:', function() {
|
38
|
-
it('should be an empty string', function (){
|
39
|
-
expect($scope.command).toBe("");
|
40
|
-
});
|
41
|
-
});
|
42
|
-
|
43
|
-
describe('command types:', function() {
|
44
|
-
it('should be an array of string, boolean and number', function (){
|
45
|
-
var command_types = [ 'string', 'boolean', 'number' ];
|
46
|
-
expect($scope.types).toEqual(command_types);
|
47
|
-
});
|
48
|
-
});
|
49
|
-
|
50
|
-
describe('isDisabled:', function() {
|
51
|
-
it('should return true if command is empty', function (){
|
52
|
-
expect($scope.isDisabled()).toBe(true);
|
53
|
-
});
|
54
|
-
|
55
|
-
it('should return false if command exist', function (){
|
56
|
-
$scope.command = 'test_command'
|
57
|
-
expect($scope.isDisabled()).toBe(false);
|
58
|
-
});
|
59
|
-
});
|
60
|
-
|
61
|
-
describe('addParam:', function() {
|
62
|
-
it('should add params if last', function (){
|
63
|
-
expect($scope.robot.params.length).toBe(1)
|
64
|
-
$scope.addParam($scope.robot);
|
65
|
-
expect($scope.robot.params.length).toBe(2)
|
66
|
-
});
|
67
|
-
|
68
|
-
it('should not add params if not last', function (){
|
69
|
-
expect($scope.robot.params.length).toBe(1)
|
70
|
-
$scope.addParam();
|
71
|
-
expect($scope.robot.params.length).toBe(1)
|
72
|
-
});
|
73
|
-
});
|
74
|
-
|
75
|
-
describe('removeParam:', function() {
|
76
|
-
it('should remove param if there is more than one', function (){
|
77
|
-
$scope.robot.params = [
|
78
|
-
{ name: '', value: '', type: 'string' },
|
79
|
-
{ name: '', value: '', type: 'string' }
|
80
|
-
];
|
81
|
-
|
82
|
-
expect($scope.robot.params.length).toBe(2)
|
83
|
-
$scope.removeParam($scope.robot);
|
84
|
-
expect($scope.robot.params.length).toBe(1)
|
85
|
-
});
|
86
|
-
|
87
|
-
it('should not remove param if there just one', function (){
|
88
|
-
$scope.robot.params = [
|
89
|
-
{ name: '', value: '', type: 'string' }
|
90
|
-
];
|
91
|
-
|
92
|
-
expect($scope.robot.params.length).toBe(1)
|
93
|
-
$scope.removeParam($scope.robot);
|
94
|
-
expect($scope.robot.params.length).toBe(1)
|
95
|
-
});
|
96
|
-
|
97
|
-
it('should remove the correct param passed to the function', function (){
|
98
|
-
$scope.robot.params = [
|
99
|
-
{ name: 'param1', value: 'value1', type: 'string' },
|
100
|
-
{ name: 'param2', value: 'value2', type: 'string' }
|
101
|
-
];
|
102
|
-
|
103
|
-
var param_to_remove = { name: 'param1', value: 'value1', type: 'string' };
|
104
|
-
var param_to_keep = { name: 'param2', value: 'value2', type: 'string' };
|
105
|
-
|
106
|
-
expect($scope.robot.params[0]).toEqual(param_to_remove)
|
107
|
-
$scope.removeParam(param_to_remove);
|
108
|
-
expect($scope.robot.params[0]).toEqual(param_to_keep)
|
109
|
-
});
|
110
|
-
});
|
111
|
-
|
112
|
-
describe('submit:', function() {
|
113
|
-
it('should run command and return results', function (){
|
114
|
-
$scope.robot.name = "myRobot";
|
115
|
-
$scope.command = "relax";
|
116
|
-
$scope.robot.params= [{'name': 'relax', 'value':'true', 'type':'string'}];
|
117
|
-
var params = {'relax': 'true'};
|
118
|
-
var data= {'result': "myRobot says relax"};
|
119
|
-
|
120
|
-
$scope.submit();
|
121
|
-
$httpBackend.expectPOST('/api/robots/myRobot/commands/relax', params).respond(data);
|
122
|
-
$httpBackend.flush();
|
123
|
-
expect($scope.robot.results).toEqual([{'result': "myRobot says relax"}])
|
124
|
-
});
|
125
|
-
});
|
126
|
-
});
|
127
|
-
});
|
@@ -1,62 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller RobotCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $timeout, $routeParams, testController;
|
7
|
-
|
8
|
-
beforeEach(inject(function($injector) {
|
9
|
-
$timeout = $injector.get('$timeout');
|
10
|
-
$httpBackend = $injector.get('$httpBackend');
|
11
|
-
$rootScope = $injector.get('$rootScope');
|
12
|
-
$routeParams = $injector.get('$routeParams');
|
13
|
-
$scope = $rootScope.$new();
|
14
|
-
|
15
|
-
var $controller = $injector.get('$controller');
|
16
|
-
|
17
|
-
testController = function() {
|
18
|
-
return $controller('RobotCtrl', {
|
19
|
-
'$scope': $scope
|
20
|
-
|
21
|
-
});
|
22
|
-
};
|
23
|
-
var controller = testController();
|
24
|
-
|
25
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
26
|
-
$httpBackend.expect('GET', '/api/robots/' + $routeParams.robot).respond(loadJSONFixtures('myRobot.json')['myRobot.json']);
|
27
|
-
$httpBackend.flush();
|
28
|
-
|
29
|
-
}));
|
30
|
-
|
31
|
-
afterEach(function() {
|
32
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
33
|
-
$httpBackend.verifyNoOutstandingRequest();
|
34
|
-
});
|
35
|
-
|
36
|
-
it('should get robot details', function() {
|
37
|
-
var data = loadJSONFixtures('myRobot.json')['myRobot.json'];
|
38
|
-
data.robot.params = [ { name: '', value: '', type: 'string' } ];
|
39
|
-
data.robot.results = [];
|
40
|
-
expect($scope.robot).toEqual(data.robot);
|
41
|
-
});
|
42
|
-
|
43
|
-
describe('select:', function() {
|
44
|
-
it('should select a device', function (){
|
45
|
-
var robotArray= [{"name": "robo1"},{"name":"robo2"}];
|
46
|
-
$scope.robot = robotArray;
|
47
|
-
$scope.select($scope.robot[1]);
|
48
|
-
expect($scope.robot[1]).toEqual($scope.device);
|
49
|
-
expect($scope.robot[0]).toNotEqual($scope.device);
|
50
|
-
});
|
51
|
-
});
|
52
|
-
|
53
|
-
describe('selected:', function() {
|
54
|
-
it('should return if device is still selected', function (){
|
55
|
-
var robotArray= [{"name": "robo1"},{"name":"robo2"}];
|
56
|
-
$scope.robot = robotArray;
|
57
|
-
$scope.select($scope.robot);
|
58
|
-
expect($scope.selected($scope.robot)).toBeTruthy();
|
59
|
-
});
|
60
|
-
});
|
61
|
-
});
|
62
|
-
});
|
@@ -1,96 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller ThemesCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $timeout, $routeParams, 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
|
-
$routeParams = $injector.get('$routeParams');
|
14
|
-
$scope = $rootScope.$new();
|
15
|
-
$scope.themes = $injector.get('Themes')
|
16
|
-
|
17
|
-
var $controller = $injector.get('$controller');
|
18
|
-
|
19
|
-
testController = function() {
|
20
|
-
return $controller('ThemesCtrl', {
|
21
|
-
'$scope': $scope
|
22
|
-
|
23
|
-
});
|
24
|
-
};
|
25
|
-
var controller = testController();
|
26
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
27
|
-
data = loadJSONFixtures('themes.json')['themes.json'];
|
28
|
-
|
29
|
-
}));
|
30
|
-
|
31
|
-
afterEach(function() {
|
32
|
-
$scope.themes = null;
|
33
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
34
|
-
$httpBackend.verifyNoOutstandingRequest();
|
35
|
-
});
|
36
|
-
|
37
|
-
it('should get array of themes', function() {
|
38
|
-
expect($scope.themes.list).toEqual(data.themes);
|
39
|
-
});
|
40
|
-
|
41
|
-
describe('add:', function() {
|
42
|
-
it('should not add theme with empty name', function() {
|
43
|
-
expect($scope.themes.list.length).toEqual(5);
|
44
|
-
$scope.add('');
|
45
|
-
expect($scope.themes.list.length).toEqual(5);
|
46
|
-
$scope.add();
|
47
|
-
expect($scope.themes.list.length).toEqual(5);
|
48
|
-
});
|
49
|
-
|
50
|
-
it('should not add theme if name already exist', function() {
|
51
|
-
expect($scope.themes.list.length).toEqual(5);
|
52
|
-
$scope.add('artoo');
|
53
|
-
expect($scope.themes.list.length).toEqual(5);
|
54
|
-
});
|
55
|
-
|
56
|
-
it('should add theme', function() {
|
57
|
-
expect($scope.themes.list.length).toEqual(5);
|
58
|
-
$scope.add('first theme');
|
59
|
-
expect($scope.themes.list.length).toEqual(6);
|
60
|
-
});
|
61
|
-
|
62
|
-
it('should add theme and put it on edit mode', function() {
|
63
|
-
expect($scope.editing).toEqual(null);
|
64
|
-
$scope.add('second theme');
|
65
|
-
expect($scope.editing.name).toEqual('second theme');
|
66
|
-
});
|
67
|
-
});
|
68
|
-
|
69
|
-
describe('edit:', function() {
|
70
|
-
it('should not set theme on edit mode if is not a custom theme', function() {
|
71
|
-
expect($scope.editing).toEqual(null);
|
72
|
-
$scope.edit(data.themes[0].name)
|
73
|
-
expect($scope.editing).toEqual(null);
|
74
|
-
});
|
75
|
-
|
76
|
-
it('should not set theme on edit mode if theme is already being edited', function() {
|
77
|
-
expect($scope.editing).toEqual(null);
|
78
|
-
$scope.add('third theme')
|
79
|
-
expect($scope.editing.name).toEqual('third theme');
|
80
|
-
|
81
|
-
$scope.edit('third theme');
|
82
|
-
expect($scope.editing).toEqual(null);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
describe('remove:', function() {
|
87
|
-
it('should remove theme', function() {
|
88
|
-
expect($scope.themes.list.length).toEqual(5);
|
89
|
-
$scope.remove('artoo');
|
90
|
-
expect($scope.themes.list.length).toEqual(4);
|
91
|
-
});
|
92
|
-
});
|
93
|
-
|
94
|
-
|
95
|
-
});
|
96
|
-
});
|
@@ -1,111 +0,0 @@
|
|
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
|
-
});
|