client unit tests for autocomplete field()
This commit is contained in:
parent
f647e9e2d1
commit
0a17a59f2d
|
@ -57,4 +57,24 @@ describe('Component vnAutocomplete', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('field() setter', () => {
|
||||
describe('when value is an object with valueField property', () => {
|
||||
it(`should set _field and _multifield values and remove it from _multifield if called again`, () => {
|
||||
let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout});
|
||||
controller.valueField = 'name';
|
||||
controller.field = {name: 'Bruce Wayne'};
|
||||
|
||||
expect(controller._field).toEqual('Bruce Wayne');
|
||||
expect(controller._multiField[0]).toEqual('Bruce Wayne');
|
||||
|
||||
controller.field = {name: 'Bruce Wayne'};
|
||||
|
||||
expect(controller._multiField).toEqual([]);
|
||||
|
||||
// value is still stored in _field after second call... is this correct? or should be deleted as per _multifield? ask Dani!
|
||||
expect(controller._field).toEqual('Bruce Wayne');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue