Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 5cee432

Browse files
update tests
1 parent 347c76c commit 5cee432

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

test/select.spec.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ describe('ui-select tests', function() {
260260
scope.$digest();
261261
}
262262

263+
it('should initialize selected choices with an array if choices source is undefined', function(){
264+
var el = createUiSelect(),
265+
ctrl = el.scope().$select;
266+
267+
ctrl.setItemsFn(); // setPlainItems
268+
expect(ctrl.items).toEqual([]);
269+
});
263270

264271
// Tests
265272
//uisRepeatParser
@@ -1864,6 +1871,14 @@ describe('ui-select tests', function() {
18641871
);
18651872
}
18661873

1874+
it('should initialize selected choices with an empty array when choices source is undefined', function(){
1875+
var el = createUiSelectMultiple({groupBy: "'age'"}),
1876+
ctrl = el.scope().$select;
1877+
1878+
ctrl.setItemsFn(); // updateGroups
1879+
expect(ctrl.items).toEqual([]);
1880+
});
1881+
18671882
it('should render initial state', function() {
18681883
var el = createUiSelectMultiple();
18691884
expect(el).toHaveClass('ui-select-multiple');
@@ -3231,12 +3246,12 @@ describe('ui-select tests', function() {
32313246
expect(el.scope().$select.spinnerClass).toBe('randomclass');
32323247
});
32333248
});
3234-
3249+
32353250
describe('With refresh on active', function(){
32363251
it('should refresh when is activated', function(){
32373252
scope.fetchFromServer = function(){};
32383253
var el = createUiSelect({refresh:"fetchFromServer($select.search)",refreshDelay:0});
3239-
spyOn(scope, 'fetchFromServer');
3254+
spyOn(scope, 'fetchFromServer');
32403255
expect(el.scope().$select.open).toEqual(false);
32413256
el.scope().$select.activate();
32423257
$timeout.flush();
@@ -3248,7 +3263,7 @@ describe('ui-select tests', function() {
32483263
it('should refresh when open is set to true', function(){
32493264
scope.fetchFromServer = function(){};
32503265
var el = createUiSelect({refresh:"fetchFromServer($select.search)",refreshDelay:0});
3251-
spyOn(scope, 'fetchFromServer');
3266+
spyOn(scope, 'fetchFromServer');
32523267
expect(el.scope().$select.open).toEqual(false);
32533268
openDropdown(el);
32543269
$timeout.flush();

0 commit comments

Comments
 (0)