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
data/partials/robot.html
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
<div class="robot-detail">
|
2
|
-
|
3
|
-
<!-- begin robot section -->
|
4
|
-
<div class="row">
|
5
|
-
<div class="robot" ng-class="{'with-commands': (robot.commands.length > 0)}">
|
6
|
-
<div class="robot-details">
|
7
|
-
<span class="btn btn-robot btn-big">robot</span>
|
8
|
-
<span class="name">{{robot.name}}</span>
|
9
|
-
|
10
|
-
<div class="details">
|
11
|
-
<span class="bullet-connections"><strong>Connections</strong> {{robot.connections.length}}</span>
|
12
|
-
<span class="bullet-devices"><strong>Devices</strong> {{robot.devices.length}}</span>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<div class="commands" ng-if="(robot.commands.length > 0)" ng-controller="RobotCommandsCtrl">
|
17
|
-
<h2>Commands</h2>
|
18
|
-
<div class="input">
|
19
|
-
<select ng-model="command" ng-options="cmd for cmd in robot.commands">
|
20
|
-
</select>
|
21
|
-
|
22
|
-
<div class="params">
|
23
|
-
<div class="param" ng-repeat="param in robot.params">
|
24
|
-
<input placeholder='name' type="text" ng-model="param.name" ng-focus="addParam($last)">
|
25
|
-
<input placeholder='value' type="text" ng-model="param.value" ng-focus="addParam($last)">
|
26
|
-
<select ng-options="type for type in types" ng-model="param.type"></select>
|
27
|
-
<span class="close" ng-click="removeParam($index)">✖</span>
|
28
|
-
</div>
|
29
|
-
</div>
|
30
|
-
|
31
|
-
<button class="btn btn-run" ng-click="submit()" ng-disabled="isDisabled()">run</button>
|
32
|
-
</div>
|
33
|
-
|
34
|
-
<div class="results">
|
35
|
-
<table>
|
36
|
-
<thead>
|
37
|
-
<th>Results</th>
|
38
|
-
</thead>
|
39
|
-
|
40
|
-
<tbody>
|
41
|
-
<tr class="result" ng-repeat="entry in robot.results">
|
42
|
-
<td>{{entry.result}}</td>
|
43
|
-
</tr>
|
44
|
-
</tbody>
|
45
|
-
</table>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
</div>
|
49
|
-
</div>
|
50
|
-
<!-- end robot section -->
|
51
|
-
|
52
|
-
<!-- begin widgets -->
|
53
|
-
<div class="row">
|
54
|
-
<div class="widgets" ng-controller="WidgetsCtrl">
|
55
|
-
<div class="new-widget-instance" ng-show="newWidget">
|
56
|
-
<div class="panel">
|
57
|
-
<div class="panel-header">
|
58
|
-
<span class="close" ng-click="newWidget = null"> ✖ </span>
|
59
|
-
<h2>New Widget Instance</h2>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div class="panel-body">
|
63
|
-
<div class="type">
|
64
|
-
<h3>Widget Type:</h3>
|
65
|
-
<select ng-model="newWidget.base" ng-options="w.name for w in widgets.list"></select>
|
66
|
-
</div>
|
67
|
-
|
68
|
-
<div class="attrs" ng-if="newWidget.base.attrs.length">
|
69
|
-
<h3>Params:</h3>
|
70
|
-
|
71
|
-
<div class="attr-element" ng-repeat="attr in newWidget.base.attrs">
|
72
|
-
<label>{{attr}}</label>
|
73
|
-
<input type="text" ng-model="newWidget.attrs[attr]">
|
74
|
-
</div>
|
75
|
-
</div>
|
76
|
-
</div>
|
77
|
-
|
78
|
-
<div class="panel-footer">
|
79
|
-
<button class="btn btn-device" ng-click="newActiveWidget(newWidget)">Create</button>
|
80
|
-
<button class="btn btn-run" ng-click="newWidget = null">Close</button>
|
81
|
-
</div>
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div class="active-widgets">
|
86
|
-
<div class="add-widget">
|
87
|
-
<button class="btn btn-robot btn-big" ng-click="newWidget = { base: '', attrs: {} }"> + </button>
|
88
|
-
</div>
|
89
|
-
|
90
|
-
<widget ng-repeat="widget in activeWidgets" data-name="{{widget.name}}" data-attrs="{{widget.attrs}}">
|
91
|
-
<span class="close" ng-click="removeWidget($index)"> ✖ </span>
|
92
|
-
</widget>
|
93
|
-
</div>
|
94
|
-
</div>
|
95
|
-
</div>
|
96
|
-
<!-- end widgets -->
|
97
|
-
|
98
|
-
<div ng-show="device" ng-include="'/partials/device.html'"></div>
|
99
|
-
|
100
|
-
<!-- begin connections -->
|
101
|
-
<section class="row">
|
102
|
-
<div class="connections">
|
103
|
-
<div class="robot-devices">
|
104
|
-
<div class="device" ng-class="{selected: selected(device)}" ng-repeat="device in robot.devices">
|
105
|
-
<button ng-click="select(device)" class="btn btn-device">device</button>
|
106
|
-
<span class="name">{{device.name}}</span>
|
107
|
-
|
108
|
-
<div class="details">
|
109
|
-
<span>{{device.connection}}</span>
|
110
|
-
</div>
|
111
|
-
</div>
|
112
|
-
</div>
|
113
|
-
|
114
|
-
<div class="robot-connections">
|
115
|
-
<div class="connection" ng-repeat="connection in robot.connections">
|
116
|
-
<span class="btn btn-connect">connection</span>
|
117
|
-
<span class="name">{{connection.name}}</span>
|
118
|
-
|
119
|
-
<div class="details">
|
120
|
-
<span ng-if="connection.port">{{connection.port}}</span>
|
121
|
-
</div>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
</section>
|
126
|
-
<!-- end connections -->
|
127
|
-
</div>
|
data/partials/themes.html
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="themes">
|
3
|
-
<div class="sidebar">
|
4
|
-
<h2>Themes</h2>
|
5
|
-
|
6
|
-
<div class="new-theme">
|
7
|
-
<input type="text" ng-model="name" placeholder="new theme name">
|
8
|
-
<button ng-click="add(name)" class="btn btn-device">Add</button>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="list">
|
12
|
-
<div class="theme"
|
13
|
-
ng-repeat="theme in themes.list | filter:{custom: true}"
|
14
|
-
ng-click="edit(theme)"
|
15
|
-
ng-class="{selected: (editing === theme)}">
|
16
|
-
{{theme.name}}
|
17
|
-
<span class="close" ng-if="theme.custom" ng-click="remove(theme.name)">✖</span>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<div class="editor">
|
24
|
-
<h2>Editor</h2>
|
25
|
-
|
26
|
-
<textarea ng-disabled="!editing" ng-model="editing.css" ng-blur="themes.save()" placeholder="write your css here">
|
27
|
-
</textarea>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<div class="footer">
|
31
|
-
<button class="btn btn-save" ng-click="themes.save()">save</button>
|
32
|
-
<button class="btn btn-reset" ng-click="themes.reset()">reset</button>
|
33
|
-
|
34
|
-
<div class="selector">
|
35
|
-
<span>use theme: </span>
|
36
|
-
<select ng-model="themes.active"
|
37
|
-
ng-options="theme.name for theme in themes.list">
|
38
|
-
</select>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
</div>
|
data/partials/widget_editor.html
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="widgets">
|
3
|
-
<div class="sidebar">
|
4
|
-
<h2>Widgets</h2>
|
5
|
-
|
6
|
-
<div class="new-widget">
|
7
|
-
<input type="text" ng-model="name" placeholder="new widget name">
|
8
|
-
<button ng-click="add(name)" class="btn btn-device">add</button>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="list">
|
12
|
-
<div class="widget"
|
13
|
-
ng-repeat="widget in widgets.list"
|
14
|
-
ng-click="edit(widget)"
|
15
|
-
ng-class="{selected: (editing === widget)}">
|
16
|
-
{{widget.name}}
|
17
|
-
<span class="close" ng-if="widget.custom" ng-click="widgets.remove(widget.name)">✖</span>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
|
23
|
-
<div class="editor">
|
24
|
-
<div class="attrs">
|
25
|
-
<label>
|
26
|
-
<strong>Attrs:</strong>
|
27
|
-
<small>Attributes to be defined when instantiating the widget. They will be available in the script as <code>attrs</code>.</small>
|
28
|
-
</label>
|
29
|
-
|
30
|
-
<div class="attrs-list">
|
31
|
-
<span ng-repeat="attr in editing.attrs" ng-click="removeAttr($index)">
|
32
|
-
{{ attr }}
|
33
|
-
{{ $last ? '' : ', ' }}
|
34
|
-
</span>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
<div class="new-attr">
|
38
|
-
<input type="text" ng-disabled="!editing" ng-model="newAttr">
|
39
|
-
<button ng-disabled="!editing" ng-click="addAttr()" class="btn btn-device">Add Attribute</button>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div class="field">
|
44
|
-
<label>
|
45
|
-
<strong>Template:</strong>
|
46
|
-
<small>The code you put here will be used as a template for an Angular directive.</small>
|
47
|
-
</label>
|
48
|
-
|
49
|
-
<textarea id="template" ng-disabled="!editing" ng-model="editing.template" ng-blur="widgets.save()" placeholder="write your template here">
|
50
|
-
</textarea>
|
51
|
-
</div>
|
52
|
-
|
53
|
-
<div class="field">
|
54
|
-
<label>
|
55
|
-
<strong>Script:</strong>
|
56
|
-
<small>The code you put here will be used as a <code>link</code> function for an Angular directive.</small>
|
57
|
-
</label>
|
58
|
-
<textarea ng-disabled="!editing" ng-model="editing.script" ng-blur="widgets.save()" placeholder="write your javascript here">
|
59
|
-
</textarea>
|
60
|
-
</div>
|
61
|
-
</div>
|
62
|
-
|
63
|
-
<div class="footer">
|
64
|
-
<button class="btn btn-save" ng-click="widgets.save()">save</button>
|
65
|
-
<button class="btn btn-reset" ng-click="widgets.reset()">reset</button>
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
</div>
|
@@ -1,129 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller DeviceCommandsCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $timeout, testController;
|
7
|
-
|
8
|
-
beforeEach(inject(function($injector) {
|
9
|
-
$timeout = $injector.get('$timeout');
|
10
|
-
$httpBackend = $injector.get('$httpBackend');
|
11
|
-
$rootScope = $injector.get('$rootScope');
|
12
|
-
$scope = $rootScope.$new();
|
13
|
-
|
14
|
-
var $controller = $injector.get('$controller');
|
15
|
-
|
16
|
-
testController = function() {
|
17
|
-
return $controller('DeviceCommandsCtrl', {
|
18
|
-
'$scope': $scope
|
19
|
-
});
|
20
|
-
};
|
21
|
-
var controller = testController();
|
22
|
-
|
23
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
24
|
-
|
25
|
-
var data = loadJSONFixtures('myDevice.json')['myDevice.json'];
|
26
|
-
|
27
|
-
$scope.device = data[0];
|
28
|
-
$scope.device.results = [];
|
29
|
-
$scope.device.params = [{ name: '', value: '', type: 'string' }];
|
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.device.params.length).toBe(1)
|
64
|
-
$scope.addParam($scope.device);
|
65
|
-
expect($scope.device.params.length).toBe(2)
|
66
|
-
});
|
67
|
-
|
68
|
-
it('should not add params if not last', function (){
|
69
|
-
expect($scope.device.params.length).toBe(1)
|
70
|
-
$scope.addParam();
|
71
|
-
expect($scope.device.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.device.params = [
|
78
|
-
{ name: '', value: '', type: 'string' },
|
79
|
-
{ name: '', value: '', type: 'string' }
|
80
|
-
];
|
81
|
-
|
82
|
-
expect($scope.device.params.length).toBe(2)
|
83
|
-
$scope.removeParam($scope.device);
|
84
|
-
expect($scope.device.params.length).toBe(1)
|
85
|
-
});
|
86
|
-
|
87
|
-
it('should not remove param if there just one', function (){
|
88
|
-
$scope.device.params = [
|
89
|
-
{ name: '', value: '', type: 'string' }
|
90
|
-
];
|
91
|
-
|
92
|
-
expect($scope.device.params.length).toBe(1)
|
93
|
-
$scope.removeParam($scope.device);
|
94
|
-
expect($scope.device.params.length).toBe(1)
|
95
|
-
});
|
96
|
-
|
97
|
-
it('should remove the correct param passed to the function', function (){
|
98
|
-
$scope.device.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.device.params[0]).toEqual(param_to_remove)
|
107
|
-
$scope.removeParam(param_to_remove);
|
108
|
-
expect($scope.device.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.device.name = "led";
|
116
|
-
$scope.command = "brightness";
|
117
|
-
$scope.device.params = [{'name': 'brightness', 'value': 255, 'type':'string'}];
|
118
|
-
var params = {'brightness': 255};
|
119
|
-
var data= {'result': "brightness is 255"};
|
120
|
-
|
121
|
-
$scope.submit();
|
122
|
-
$httpBackend.expectPOST('/api/robots/myRobot/devices/led/commands/brightness', params).respond(data);
|
123
|
-
$httpBackend.flush();
|
124
|
-
expect($scope.device.results[0]).toEqual({'result': "brightness is 255"})
|
125
|
-
});
|
126
|
-
});
|
127
|
-
|
128
|
-
});
|
129
|
-
});
|
@@ -1,82 +0,0 @@
|
|
1
|
-
describe("Testing Controllers", function() {
|
2
|
-
describe('Controller DeviceEventsCtrl:', function() {
|
3
|
-
|
4
|
-
beforeEach(module('robeaux'));
|
5
|
-
|
6
|
-
var $scope, $rootScope, $httpBackend, $timeout, testController;
|
7
|
-
|
8
|
-
beforeEach(inject(function($injector) {
|
9
|
-
$timeout = $injector.get('$timeout');
|
10
|
-
$httpBackend = $injector.get('$httpBackend');
|
11
|
-
$rootScope = $injector.get('$rootScope');
|
12
|
-
$scope = $rootScope.$new();
|
13
|
-
|
14
|
-
var $controller = $injector.get('$controller');
|
15
|
-
|
16
|
-
testController = function() {
|
17
|
-
return $controller('DeviceEventsCtrl', {
|
18
|
-
'$scope': $scope
|
19
|
-
});
|
20
|
-
};
|
21
|
-
var controller = testController();
|
22
|
-
|
23
|
-
jasmine.getJSONFixtures().fixturesPath='base/test/support';
|
24
|
-
|
25
|
-
var data = loadJSONFixtures('myDevice.json')['myDevice.json'];
|
26
|
-
|
27
|
-
$scope.robot = {'name':"myRobot"};
|
28
|
-
$scope.eventName = "";
|
29
|
-
$scope.device = data[0];
|
30
|
-
$scope.device.events = null;
|
31
|
-
$scope.device.listeners = null;
|
32
|
-
}));
|
33
|
-
|
34
|
-
afterEach(function() {
|
35
|
-
$httpBackend.verifyNoOutstandingExpectation();
|
36
|
-
$httpBackend.verifyNoOutstandingRequest();
|
37
|
-
});
|
38
|
-
|
39
|
-
describe('listen:', function() {
|
40
|
-
it('should add a listener for an event and clear eventName', function (){
|
41
|
-
expect($scope.device.listeners).toBe(null);
|
42
|
-
$scope.eventName = "listen_event";
|
43
|
-
$scope.listen();
|
44
|
-
expect($scope.device.listeners['listen_event']).not.toBe(null);
|
45
|
-
expect($scope.eventName).toBe("");
|
46
|
-
});
|
47
|
-
|
48
|
-
it('should listen to multiple events', function (){
|
49
|
-
expect($scope.device.listeners).toBe(null);
|
50
|
-
|
51
|
-
$scope.eventName = "first_event";
|
52
|
-
$scope.listen();
|
53
|
-
$scope.eventName = "second_event";
|
54
|
-
$scope.listen();
|
55
|
-
$scope.eventName = "third_event";
|
56
|
-
$scope.listen();
|
57
|
-
|
58
|
-
expect($scope.device.listeners['first_event']).not.toBe(null);
|
59
|
-
expect($scope.device.listeners['second_event']).not.toBe(null);
|
60
|
-
expect($scope.device.listeners['third_event']).not.toBe(null);
|
61
|
-
});
|
62
|
-
});
|
63
|
-
|
64
|
-
describe('remove:', function() {
|
65
|
-
it('should remove listener', function (){
|
66
|
-
expect($scope.device.listeners).toBe(null);
|
67
|
-
|
68
|
-
$scope.eventName = "listen_event";
|
69
|
-
$scope.listen();
|
70
|
-
expect($scope.device.listeners['listen_event']).not.toBe(null);
|
71
|
-
|
72
|
-
$scope.remove("listen_event")
|
73
|
-
|
74
|
-
expect($scope.device.listeners['listen_event']).toBe(undefined);
|
75
|
-
|
76
|
-
});
|
77
|
-
});
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
});
|
82
|
-
});
|