This repository has been archived by the owner on May 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PaperUI: rework bindings list view & binding detail view (#3782)
* PaperUI: rework bindings list view & binding detail view Also: refactor list views Also-by: Chris Jackson <chris@cd-jackson.com> Signed-off-by: Henning Treu <henning.treu@telekom.de>
- Loading branch information
1 parent
bad2941
commit 5c4a676
Showing
22 changed files
with
537 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
extensions/ui/org.eclipse.smarthome.ui.paper/tests/configuration.binding.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
describe('module PaperUI.controllers.configuration.bindings', function() { | ||
beforeEach(function() { | ||
module('PaperUI'); | ||
}); | ||
describe('tests for BindingController', function() { | ||
var bindingController, scope, mdDialog; | ||
beforeEach(inject(function($injector, $rootScope, $controller, $mdDialog) { | ||
scope = $rootScope.$new(); | ||
mdDialog = $mdDialog | ||
$controller('BodyController', { | ||
'$scope' : scope | ||
}); | ||
bindingController = $controller('BindingController', { | ||
'$scope' : scope | ||
}); | ||
})); | ||
it('should require BindingController', function() { | ||
expect(bindingController).toBeDefined(); | ||
}); | ||
}); | ||
|
||
describe('tests for ConfigureBindingDialogController', function() { | ||
var configureBindingDialogController, scope, bindingService; | ||
var restConfig; | ||
beforeEach(inject(function($injector, $rootScope, $controller) { | ||
scope = $rootScope.$new(); | ||
var bindingRepository = $injector.get('bindingRepository'); | ||
restConfig = $injector.get('restConfig'); | ||
$rootScope.data.bindings = [ { | ||
id : 'B' | ||
} ]; | ||
configureBindingDialogController = $controller('ConfigureBindingDialogController', { | ||
'$scope' : scope, | ||
'binding' : { | ||
'id' : 'B', | ||
'configDescriptionURI' : 'CDURI' | ||
}, | ||
'bindingRepository' : bindingRepository | ||
}); | ||
$httpBackend = $injector.get('$httpBackend'); | ||
$httpBackend.when('GET', restConfig.restPath + "/config-descriptions/CDURI").respond({ | ||
parameters : [ { | ||
type : 'input', | ||
name : 'PNAME' | ||
} ] | ||
}); | ||
$httpBackend.when('GET', restConfig.restPath + "/bindings/B/config").respond({ | ||
PNAME : '1' | ||
}); | ||
$httpBackend.flush(); | ||
bindingService = $injector.get('bindingService'); | ||
})); | ||
it('should require ConfigureBindingDialogController', function() { | ||
expect(configureBindingDialogController).toBeDefined(); | ||
}); | ||
it('should get binding parameters', function() { | ||
expect(scope.parameters.length).toEqual(1); | ||
}); | ||
it('should get binding configuration', function() { | ||
expect(scope.configuration.PNAME).toEqual(1); | ||
}); | ||
it('should add binding parameter', function() { | ||
scope.configArray = []; | ||
scope.addParameter(); | ||
expect(scope.configArray.length).toEqual(1); | ||
}); | ||
it('should save binding configuration', function() { | ||
spyOn(bindingService, 'updateConfig'); | ||
scope.save(); | ||
expect(bindingService.updateConfig).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.