Commit 7c52b7c7 authored by julien-reboul's avatar julien-reboul

[BS-14741] translate pbSelect values

parent d3791f54
......@@ -14,7 +14,7 @@
class="form-control"
name="{{ctrl.name}}"
ng-model="properties.value"
ng-options="ctrl.getValue(option) as ctrl.getLabel(option) for option in properties.availableValues"
ng-options="ctrl.getValue(option) as (ctrl.getLabel(option) | uiTranslate) for option in properties.availableValues"
ng-required="properties.required"
ng-disabled="properties.disabled">
<option style="display:none" value="">
......
describe('pbSelect', function () {
var $compile, scope, $rootScope, $timeout;
var $compile, scope, $rootScope, $timeout, gettextCatalog;
var collection = [{name: 'foo', value: 'baz'}, {name: 'bar', value: 'qux'}];
beforeEach(module('bonitasoft.ui.widgets'));
beforeEach(module('bonitasoft.ui.services'));
beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_) {
beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_, _gettextCatalog_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
scope = _$rootScope_.$new();
$timeout = _$timeout_;
gettextCatalog = _gettextCatalog_;
gettextCatalog.setStrings('fr-FR', {
'red': 'rouge',
'green': 'vert'
});
gettextCatalog.setCurrentLanguage('fr-FR');
scope.properties = {
isBound: function() {
return false;
......@@ -107,7 +113,7 @@ describe('pbSelect', function () {
});
it('should generates option form a list', function () {
scope.properties.availableValues = ['jeanne', 'jean', 'marcel'];
scope.properties.availableValues = ['jeanne', 'jean', 'marcel', 'red', 'green'];
var element = $compile('<pb-select></pb-select>')(scope);
scope.$apply();
......@@ -118,7 +124,9 @@ describe('pbSelect', function () {
expect(labels).toEqual([
'jeanne',
'jean',
'marcel'
'marcel',
'rouge',
'vert'
]);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment