robeaux 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gruntfile.js +43 -0
- data/Makefile +11 -2
- data/README.markdown +2 -0
- data/css/main.css +1 -0
- data/css/style.css +113 -24
- data/css/themes/blackboard.css +1 -0
- data/css/themes/dark.css +1 -0
- data/css/themes/gray.css +1 -0
- data/css/themes/whiteboard.css +1 -0
- data/images/bullet-connections-2.png +0 -0
- data/images/bullet-connections.png +0 -0
- data/images/bullet-devices-2.png +0 -0
- data/images/bullet-devices.png +0 -0
- data/images/devices-image-2.png +0 -0
- data/images/devices-image.png +0 -0
- data/images/logo-robeaux.png +0 -0
- data/images/robots-icon_03.png +0 -0
- data/index.html +15 -8
- data/js/controllers/widget_editor_ctrl.js +44 -0
- data/js/controllers/widgets_ctrl.js +40 -0
- data/js/directives/widget.js +50 -0
- data/js/router.js +5 -0
- data/js/services/themes.js +9 -5
- data/js/services/widgets.js +86 -0
- data/js/vendor/angular-route.min.js +1 -2
- data/js/vendor/angular.min.js +208 -206
- data/js/widgets/attitude.html +32 -0
- data/js/widgets/attitude.js +27 -0
- data/js/widgets/mindwave.html +51 -0
- data/js/widgets/mindwave.js +23 -0
- data/less/app.less +21 -0
- data/less/objects/buttons.less +32 -0
- data/less/objects/connections.less +28 -0
- data/less/objects/device.less +30 -0
- data/less/objects/forms.less +29 -0
- data/less/objects/list.less +27 -0
- data/less/objects/nav.less +33 -0
- data/less/objects/robot.less +43 -0
- data/less/objects/themes.less +18 -0
- data/less/objects/widgets.less +85 -0
- data/less/support/buttons.less +39 -0
- data/less/support/container.less +9 -0
- data/less/support/forms.less +18 -0
- data/less/support/mixins.less +3 -0
- data/less/themes/blackboard.less +158 -0
- data/less/themes/dark.less +148 -0
- data/less/themes/default.less +52 -0
- data/less/themes/gray.less +121 -0
- data/less/themes/whiteboard.less +152 -0
- data/less/vendor/elements.less +156 -0
- data/less/vendor/normalize.less +425 -0
- data/less/vendor/semantic-grid.less +67 -0
- data/less/views/devices.less +47 -0
- data/less/views/robots.less +132 -0
- data/less/views/themes.less +31 -0
- data/less/views/widgets.less +50 -0
- data/package.json +6 -3
- data/partials/device.html +66 -57
- data/partials/index.html +12 -6
- data/partials/robot.html +104 -51
- data/partials/themes.html +32 -29
- data/partials/widget_editor.html +68 -0
- data/robeaux.gemspec +1 -1
- data/test/controllers/device_commands_ctrl.js +129 -0
- data/test/controllers/device_events_ctrl.js +82 -0
- data/test/controllers/index_ctrl.js +48 -0
- data/test/controllers/nav_ctrl.js +40 -0
- data/test/controllers/robot_commands_ctrl.js +127 -0
- data/test/controllers/robot_ctrl.js +62 -0
- data/test/controllers/themes_ctrl.js +96 -0
- data/test/controllers/widget_editor_ctrl.js +111 -0
- data/test/controllers/widgets_ctrl.js +74 -0
- data/test/functions/functions.js +30 -0
- data/test/karma.conf.js +3 -7
- data/test/karma_test_all.conf.js +23 -0
- data/test/karma_test_controllers.conf.js +19 -0
- data/test/karma_test_functions.conf.js +14 -0
- data/test/karma_test_services.conf.js +17 -0
- data/test/services/themes.js +122 -0
- data/test/services/widgets.js +104 -0
- data/test/support/themes.json +9 -0
- data/test/support/widgets.json +18 -0
- data/test/vendor/angular-mocks.js +13 -13
- data/test/vendor/jquery.js +8 -8
- metadata +69 -3
- data/test/main.js +0 -248
data/test/vendor/jquery.js
CHANGED
@@ -944,7 +944,7 @@ var i,
|
|
944
944
|
identifier = characterEncoding.replace( "w", "w#" ),
|
945
945
|
|
946
946
|
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
|
947
|
-
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace
|
947
|
+
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace
|
948
948
|
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
|
949
949
|
|
950
950
|
// Prefer arguments quoted,
|
@@ -973,13 +973,13 @@ var i,
|
|
973
973
|
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
|
974
974
|
"ATTR": new RegExp( "^" + attributes ),
|
975
975
|
"PSEUDO": new RegExp( "^" + pseudos ),
|
976
|
-
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace
|
977
|
-
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace
|
976
|
+
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace
|
977
|
+
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace
|
978
978
|
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
|
979
979
|
"boolean": new RegExp( "^(?:" + booleans + ")$", "i" ),
|
980
980
|
// For use in libraries implementing .is()
|
981
981
|
// We use this for POS matching in `select`
|
982
|
-
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("
|
982
|
+
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("
|
983
983
|
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
|
984
984
|
},
|
985
985
|
|
@@ -6389,7 +6389,7 @@ function getWidthOrHeight( elem, name, extra ) {
|
|
6389
6389
|
}
|
6390
6390
|
|
6391
6391
|
// use the active box-sizing model to add/subtract irrelevant styles
|
6392
|
-
return ( val
|
6392
|
+
return ( val
|
6393
6393
|
augmentWidthOrHeight(
|
6394
6394
|
elem,
|
6395
6395
|
name,
|
@@ -6646,8 +6646,8 @@ function buildParams( prefix, obj, traditional, add ) {
|
|
6646
6646
|
add( prefix, obj );
|
6647
6647
|
}
|
6648
6648
|
}
|
6649
|
-
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick "
|
6650
|
-
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "
|
6649
|
+
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick "
|
6650
|
+
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "
|
6651
6651
|
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
|
6652
6652
|
|
6653
6653
|
// Handle event binding
|
@@ -8752,4 +8752,4 @@ if ( typeof window === "object" && typeof window.document === "object" ) {
|
|
8752
8752
|
window.jQuery = window.$ = jQuery;
|
8753
8753
|
}
|
8754
8754
|
|
8755
|
-
})( window );
|
8755
|
+
})( window );
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robeaux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-
|
16
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: Angular-based front end for the CPPP-IO API spec
|
19
19
|
email:
|
@@ -23,14 +23,20 @@ extensions: []
|
|
23
23
|
extra_rdoc_files: []
|
24
24
|
files:
|
25
25
|
- ".gitignore"
|
26
|
+
- Gruntfile.js
|
26
27
|
- Makefile
|
27
28
|
- README.markdown
|
28
29
|
- css/fonts.css
|
30
|
+
- css/main.css
|
29
31
|
- css/normalize.css
|
30
32
|
- css/style.css
|
31
33
|
- css/themes/artoo.css
|
34
|
+
- css/themes/blackboard.css
|
32
35
|
- css/themes/cylon.css
|
36
|
+
- css/themes/dark.css
|
33
37
|
- css/themes/gobot.css
|
38
|
+
- css/themes/gray.css
|
39
|
+
- css/themes/whiteboard.css
|
34
40
|
- fonts/inconsolata-bold-webfont.eot
|
35
41
|
- fonts/inconsolata-bold-webfont.svg
|
36
42
|
- fonts/inconsolata-bold-webfont.ttf
|
@@ -51,7 +57,15 @@ files:
|
|
51
57
|
- fonts/robotoslab-bold-webfont.svg
|
52
58
|
- fonts/robotoslab-bold-webfont.ttf
|
53
59
|
- fonts/robotoslab-bold-webfont.woff
|
60
|
+
- images/bullet-connections-2.png
|
61
|
+
- images/bullet-connections.png
|
62
|
+
- images/bullet-devices-2.png
|
63
|
+
- images/bullet-devices.png
|
54
64
|
- images/delete.png
|
65
|
+
- images/devices-image-2.png
|
66
|
+
- images/devices-image.png
|
67
|
+
- images/logo-robeaux.png
|
68
|
+
- images/robots-icon_03.png
|
55
69
|
- index.html
|
56
70
|
- js/app.js
|
57
71
|
- js/controllers/device_commands_ctrl.js
|
@@ -61,21 +75,73 @@ files:
|
|
61
75
|
- js/controllers/robot_commands_ctrl.js
|
62
76
|
- js/controllers/robot_ctrl.js
|
63
77
|
- js/controllers/themes_ctrl.js
|
78
|
+
- js/controllers/widget_editor_ctrl.js
|
79
|
+
- js/controllers/widgets_ctrl.js
|
80
|
+
- js/directives/widget.js
|
64
81
|
- js/router.js
|
65
82
|
- js/services/themes.js
|
83
|
+
- js/services/widgets.js
|
66
84
|
- js/vendor/angular-route.min.js
|
67
85
|
- js/vendor/angular.min.js
|
86
|
+
- js/widgets/attitude.html
|
87
|
+
- js/widgets/attitude.js
|
88
|
+
- js/widgets/mindwave.html
|
89
|
+
- js/widgets/mindwave.js
|
90
|
+
- less/app.less
|
91
|
+
- less/objects/buttons.less
|
92
|
+
- less/objects/connections.less
|
93
|
+
- less/objects/device.less
|
94
|
+
- less/objects/forms.less
|
95
|
+
- less/objects/list.less
|
96
|
+
- less/objects/nav.less
|
97
|
+
- less/objects/robot.less
|
98
|
+
- less/objects/themes.less
|
99
|
+
- less/objects/widgets.less
|
100
|
+
- less/support/buttons.less
|
101
|
+
- less/support/container.less
|
102
|
+
- less/support/forms.less
|
103
|
+
- less/support/mixins.less
|
104
|
+
- less/themes/blackboard.less
|
105
|
+
- less/themes/dark.less
|
106
|
+
- less/themes/default.less
|
107
|
+
- less/themes/gray.less
|
108
|
+
- less/themes/whiteboard.less
|
109
|
+
- less/vendor/elements.less
|
110
|
+
- less/vendor/normalize.less
|
111
|
+
- less/vendor/semantic-grid.less
|
112
|
+
- less/views/devices.less
|
113
|
+
- less/views/robots.less
|
114
|
+
- less/views/themes.less
|
115
|
+
- less/views/widgets.less
|
68
116
|
- package.json
|
69
117
|
- partials/device.html
|
70
118
|
- partials/index.html
|
71
119
|
- partials/robot.html
|
72
120
|
- partials/themes.html
|
121
|
+
- partials/widget_editor.html
|
73
122
|
- robeaux.gemspec
|
123
|
+
- test/controllers/device_commands_ctrl.js
|
124
|
+
- test/controllers/device_events_ctrl.js
|
125
|
+
- test/controllers/index_ctrl.js
|
126
|
+
- test/controllers/nav_ctrl.js
|
127
|
+
- test/controllers/robot_commands_ctrl.js
|
128
|
+
- test/controllers/robot_ctrl.js
|
129
|
+
- test/controllers/themes_ctrl.js
|
130
|
+
- test/controllers/widget_editor_ctrl.js
|
131
|
+
- test/controllers/widgets_ctrl.js
|
132
|
+
- test/functions/functions.js
|
74
133
|
- test/karma.conf.js
|
75
|
-
- test/
|
134
|
+
- test/karma_test_all.conf.js
|
135
|
+
- test/karma_test_controllers.conf.js
|
136
|
+
- test/karma_test_functions.conf.js
|
137
|
+
- test/karma_test_services.conf.js
|
138
|
+
- test/services/themes.js
|
139
|
+
- test/services/widgets.js
|
76
140
|
- test/support/myDevice.json
|
77
141
|
- test/support/myRobot.json
|
78
142
|
- test/support/robots.json
|
143
|
+
- test/support/themes.json
|
144
|
+
- test/support/widgets.json
|
79
145
|
- test/vendor/angular-mocks.js
|
80
146
|
- test/vendor/jasmine-jquery.js
|
81
147
|
- test/vendor/jquery.js
|
data/test/main.js
DELETED
@@ -1,248 +0,0 @@
|
|
1
|
-
describe('IndexCtrl', function() {
|
2
|
-
var $scope, $rootScope, $httpBackend, $timeout, testController;
|
3
|
-
beforeEach(inject(function($injector) {
|
4
|
-
$timeout = $injector.get('$timeout');
|
5
|
-
$httpBackend = $injector.get('$httpBackend');
|
6
|
-
$rootScope = $injector.get('$rootScope');
|
7
|
-
$scope = $rootScope.$new();
|
8
|
-
|
9
|
-
var $controller = $injector.get('$controller');
|
10
|
-
|
11
|
-
testController = function() {
|
12
|
-
return $controller('IndexCtrl', {
|
13
|
-
'$scope': $scope
|
14
|
-
});
|
15
|
-
};
|
16
|
-
}));
|
17
|
-
|
18
|
-
afterEach(function() {
|
19
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
20
|
-
$httpBackend.verifyNoOutstandingRequest();
|
21
|
-
});
|
22
|
-
|
23
|
-
it('IndexCtrl should get array of robots', function() {
|
24
|
-
var controller = testController();
|
25
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
26
|
-
var data = loadJSONFixtures('robots.json')['robots.json'];
|
27
|
-
$httpBackend.expect('GET', '/api/robots').respond(data);
|
28
|
-
$httpBackend.flush();
|
29
|
-
expect($scope.robots).toEqual(data.robots);
|
30
|
-
});
|
31
|
-
});
|
32
|
-
|
33
|
-
describe('RobotCtrl', function() {
|
34
|
-
beforeEach(module('robeaux'));
|
35
|
-
var $scope, $rootScope, $httpBackend, $timeout, $routeParams, testController;
|
36
|
-
beforeEach(inject(function($injector) {
|
37
|
-
$timeout = $injector.get('$timeout');
|
38
|
-
$httpBackend = $injector.get('$httpBackend');
|
39
|
-
$rootScope = $injector.get('$rootScope');
|
40
|
-
$routeParams = $injector.get('$routeParams');
|
41
|
-
$scope = $rootScope.$new();
|
42
|
-
|
43
|
-
var $controller = $injector.get('$controller');
|
44
|
-
|
45
|
-
testController = function() {
|
46
|
-
return $controller('RobotCtrl', {
|
47
|
-
'$scope': $scope
|
48
|
-
|
49
|
-
});
|
50
|
-
};
|
51
|
-
var controller = testController();
|
52
|
-
|
53
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
54
|
-
$httpBackend.expect('GET', '/api/robots/' + $routeParams.robot).respond(loadJSONFixtures('myRobot.json')['myRobot.json']);
|
55
|
-
$httpBackend.flush();
|
56
|
-
|
57
|
-
}));
|
58
|
-
|
59
|
-
afterEach(function() {
|
60
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
61
|
-
$httpBackend.verifyNoOutstandingRequest();
|
62
|
-
});
|
63
|
-
|
64
|
-
it('RobotCtrl should get robot data', function() {
|
65
|
-
var data = loadJSONFixtures('myRobot.json')['myRobot.json'];
|
66
|
-
data.robot.params = [ { name: '', value: '', type: 'string' } ];
|
67
|
-
data.robot.results = [];
|
68
|
-
expect($scope.robot).toEqual(data.robot);
|
69
|
-
});
|
70
|
-
|
71
|
-
it('RobotCtrl should select device', function (){
|
72
|
-
var robotArray= [{"name": "robo1"},{"name":"robo2"}];
|
73
|
-
$scope.robot = robotArray;
|
74
|
-
$scope.select($scope.robot[1]);
|
75
|
-
expect($scope.robot[1]).toEqual($scope.device);
|
76
|
-
expect($scope.robot[0]).toNotEqual($scope.device);
|
77
|
-
});
|
78
|
-
|
79
|
-
|
80
|
-
it('RobotCtrl should keep device selected', function (){
|
81
|
-
var robotArray= [{"name": "robo1"},{"name":"robo2"}];
|
82
|
-
$scope.robot = robotArray;
|
83
|
-
$scope.select($scope.robot);
|
84
|
-
expect($scope.selected($scope.robot)).toBeTruthy();
|
85
|
-
});
|
86
|
-
});
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
describe('parseParams', function(){
|
91
|
-
|
92
|
-
beforeEach(module('robeaux'));
|
93
|
-
|
94
|
-
|
95
|
-
it('should set param name to value', function(){
|
96
|
-
var form = [
|
97
|
-
{ 'name': 'bool', 'value': 'TRUE', 'type': 'boolean' },
|
98
|
-
{ 'name': 'boole', 'value': 'sadg', 'type': 'boolean' },
|
99
|
-
{ 'name': 'str', 'value': 'isOn', 'type': 'string' },
|
100
|
-
{ 'name': 'num', 'value': 100, 'type': 'number' }
|
101
|
-
];
|
102
|
-
var params = parseParams(form);
|
103
|
-
expect(params['num']).toEqual(100);
|
104
|
-
expect(params['bool']).toEqual(true);
|
105
|
-
expect(params['boole']).toEqual(false);
|
106
|
-
expect(params['str']).toEqual('isOn');
|
107
|
-
});
|
108
|
-
|
109
|
-
it('should set empty params to true', function(){
|
110
|
-
var form = [
|
111
|
-
{ 'name': '', 'value': '', 'type': 'boolean' },
|
112
|
-
{ 'name': '21', 'value': '12','type': 'boolean' },
|
113
|
-
];
|
114
|
-
|
115
|
-
expect(paramsAreEmpty([form[1]])).toEqual(false);
|
116
|
-
expect(paramsAreEmpty([form[0]])).toEqual(true);
|
117
|
-
});
|
118
|
-
|
119
|
-
});
|
120
|
-
|
121
|
-
describe('RobotCommandsCtrl', function() {
|
122
|
-
beforeEach(module('robeaux'));
|
123
|
-
var $scope, $rootScope, $httpBackend, $timeout, testController;
|
124
|
-
var $injector = angular.injector(['robeaux', 'ng']);
|
125
|
-
beforeEach(inject(function($injector) {
|
126
|
-
$timeout = $injector.get('$timeout');
|
127
|
-
$httpBackend = $injector.get('$httpBackend');
|
128
|
-
$rootScope = $injector.get('$rootScope');
|
129
|
-
$scope = $rootScope.$new();
|
130
|
-
|
131
|
-
var $controller = $injector.get('$controller');
|
132
|
-
|
133
|
-
testController = function() {
|
134
|
-
return $controller('RobotCommandsCtrl', {
|
135
|
-
'$scope': $scope
|
136
|
-
});
|
137
|
-
};
|
138
|
-
var controller = testController();
|
139
|
-
|
140
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
141
|
-
var data = loadJSONFixtures('myRobot.json')['myRobot.json'];
|
142
|
-
$scope.robot = data.robot;
|
143
|
-
}));
|
144
|
-
|
145
|
-
afterEach(function() {
|
146
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
147
|
-
$httpBackend.verifyNoOutstandingRequest();
|
148
|
-
});
|
149
|
-
|
150
|
-
it('RobotCommandsCtrl command should be an empty string', function (){
|
151
|
-
$scope.command = "";
|
152
|
-
expect($scope.isDisabled()).toBe(true);
|
153
|
-
});
|
154
|
-
|
155
|
-
it('RobotCommandsCtrl should add params if last', function (){
|
156
|
-
expect($scope.robot.params.length).toBe(1)
|
157
|
-
$scope.addParam($scope.robot);
|
158
|
-
expect($scope.robot.params.length).toBe(2)
|
159
|
-
});
|
160
|
-
|
161
|
-
it('RobotCommandsCtrl command should be an empty string', function (){
|
162
|
-
expect($scope.robot.params.length).toBe(2)
|
163
|
-
$scope.removeParam($scope.robot);
|
164
|
-
expect($scope.robot.params.length).toBe(1)
|
165
|
-
});
|
166
|
-
|
167
|
-
it('RobotCommandsCtrl should get robot command results', function (){
|
168
|
-
$scope.robot.name = "myRobot";
|
169
|
-
$scope.command = "relax";
|
170
|
-
$scope.robot.params= [{'name': 'relax', 'value':'true', 'type':'string'}];
|
171
|
-
var params = {'relax': 'true'};
|
172
|
-
var data= {'result': "myRobot says relax"};
|
173
|
-
|
174
|
-
$scope.submit();
|
175
|
-
$httpBackend.expectPOST('/api/robots/myRobot/commands/relax', params).respond(data);
|
176
|
-
$httpBackend.flush();
|
177
|
-
expect($scope.robot.results).toEqual([{'result': "myRobot says relax"}])
|
178
|
-
});
|
179
|
-
});
|
180
|
-
|
181
|
-
describe('DeviceCommandsCtrl', function() {
|
182
|
-
beforeEach(module('robeaux'));
|
183
|
-
var $scope, $rootScope, $httpBackend, $timeout, testController;
|
184
|
-
beforeEach(inject(function($injector) {
|
185
|
-
$timeout = $injector.get('$timeout');
|
186
|
-
$httpBackend = $injector.get('$httpBackend');
|
187
|
-
$rootScope = $injector.get('$rootScope');
|
188
|
-
$scope = $rootScope.$new();
|
189
|
-
|
190
|
-
var $controller = $injector.get('$controller');
|
191
|
-
|
192
|
-
testController = function() {
|
193
|
-
return $controller('DeviceCommandsCtrl', {
|
194
|
-
'$scope': $scope
|
195
|
-
});
|
196
|
-
};
|
197
|
-
var controller = testController();
|
198
|
-
|
199
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
200
|
-
|
201
|
-
var data = loadJSONFixtures('myDevice.json')['myDevice.json'];
|
202
|
-
|
203
|
-
$scope.device = data[0];
|
204
|
-
$scope.device.results = [];
|
205
|
-
$scope.device.params = [{ name: '', value: '', type: 'string' }];
|
206
|
-
}));
|
207
|
-
|
208
|
-
afterEach(function() {
|
209
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
210
|
-
$httpBackend.verifyNoOutstandingRequest();
|
211
|
-
});
|
212
|
-
|
213
|
-
it('DeviceCommandsCtrl command should be an empty string', function (){
|
214
|
-
$scope.command = "";
|
215
|
-
expect($scope.isDisabled()).toBe(true);
|
216
|
-
});
|
217
|
-
|
218
|
-
it('DeviceCommandsCtrl should add params if last', function (){
|
219
|
-
expect($scope.device.params.length).toBe(1)
|
220
|
-
$scope.addParam($scope.device);
|
221
|
-
expect($scope.device.params.length).toBe(2)
|
222
|
-
});
|
223
|
-
|
224
|
-
it('DeviceCommandsCtrl command should be an empty string', function (){
|
225
|
-
$scope.device.params = [
|
226
|
-
{ name: '', value: '', type: 'string' },
|
227
|
-
{ name: '', value: '', type: 'string' }
|
228
|
-
];
|
229
|
-
$scope.removeParam($scope.device);
|
230
|
-
expect($scope.device.params.length).toBe(1)
|
231
|
-
});
|
232
|
-
|
233
|
-
it('DeviceCommandsCtrl command should be an empty string', function (){
|
234
|
-
$scope.robot = {'name':"myRobot"};
|
235
|
-
$scope.device.name = "led";
|
236
|
-
$scope.command = "brightness";
|
237
|
-
$scope.device.params = [{'name': 'brightness', 'value': 255, 'type':'string'}];
|
238
|
-
var params = {'brightness': 255};
|
239
|
-
var data= {'result': "brightness is 255"};
|
240
|
-
|
241
|
-
$scope.submit();
|
242
|
-
$httpBackend.expectPOST('/api/robots/myRobot/devices/led/commands/brightness', params).respond(data);
|
243
|
-
$httpBackend.flush();
|
244
|
-
expect($scope.device.results[0]).toEqual({'result': "brightness is 255"})
|
245
|
-
});
|
246
|
-
|
247
|
-
});
|
248
|
-
|