@@ -381,55 +381,6 @@ describe('ui-select tests', function() {
381
381
expect ( isDropdownOpened ( el3 ) ) . toEqual ( true ) ;
382
382
} ) ;
383
383
384
- it ( 'should allow decline tags when tagging function returns null' , function ( ) {
385
- scope . taggingFunc = function ( name ) {
386
- return null ;
387
- } ;
388
-
389
- var el = createUiSelect ( { tagging : 'taggingFunc' } ) ;
390
- clickMatch ( el ) ;
391
-
392
- $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
393
- $ ( el ) . scope ( ) . $select . activeIndex = 0 ;
394
- $ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
395
-
396
- expect ( $ ( el ) . scope ( ) . $select . selected ) . not . toBeDefined ( ) ;
397
- } ) ;
398
-
399
- it ( 'should allow tagging if the attribute says so' , function ( ) {
400
- var el = createUiSelect ( { tagging : true } ) ;
401
- clickMatch ( el ) ;
402
-
403
- $ ( el ) . scope ( ) . $select . select ( "I don't exist" ) ;
404
-
405
- expect ( $ ( el ) . scope ( ) . $select . selected ) . toEqual ( "I don't exist" ) ;
406
- } ) ;
407
-
408
- it ( 'should format new items using the tagging function when the attribute is a function' , function ( ) {
409
- scope . taggingFunc = function ( name ) {
410
- return {
411
- name : name ,
412
- email : name + '@email.com' ,
413
- group : 'Foo' ,
414
- age : 12
415
- } ;
416
- } ;
417
-
418
- var el = createUiSelect ( { tagging : 'taggingFunc' } ) ;
419
- clickMatch ( el ) ;
420
-
421
- $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
422
- $ ( el ) . scope ( ) . $select . activeIndex = 0 ;
423
- $ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
424
-
425
- expect ( $ ( el ) . scope ( ) . $select . selected ) . toEqual ( {
426
- name : 'idontexist' ,
427
-
428
- group : 'Foo' ,
429
- age : 12
430
- } ) ;
431
- } ) ;
432
-
433
384
// See when an item that evaluates to false (such as "false" or "no") is selected, the placeholder is shown https://github.com/angular-ui/ui-select/pull/32
434
385
it ( 'should not display the placeholder when item evaluates to false' , function ( ) {
435
386
scope . items = [ 'false' ] ;
@@ -1262,58 +1213,6 @@ describe('ui-select tests', function() {
1262
1213
expect ( scope . $model ) . toBe ( scope . $item ) ;
1263
1214
} ) ;
1264
1215
1265
- it ( 'should allow creating tag in single select mode with tagging enabled' , function ( ) {
1266
-
1267
- scope . taggingFunc = function ( name ) {
1268
- return name ;
1269
- } ;
1270
-
1271
- var el = compileTemplate (
1272
- '<ui-select ng-model="selection.selected" tagging="taggingFunc" tagging-label="false"> \
1273
- <ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
1274
- <ui-select-choices repeat="person in people | filter: $select.search"> \
1275
- <div ng-bind-html="person.name" | highlight: $select.search"></div> \
1276
- <div ng-bind-html="person.email | highlight: $select.search"></div> \
1277
- </ui-select-choices> \
1278
- </ui-select>'
1279
- ) ;
1280
-
1281
- clickMatch ( el ) ;
1282
-
1283
- var searchInput = el . find ( '.ui-select-search' ) ;
1284
-
1285
- setSearchText ( el , 'idontexist' ) ;
1286
-
1287
- triggerKeydown ( searchInput , Key . Enter ) ;
1288
-
1289
- expect ( $ ( el ) . scope ( ) . $select . selected ) . toEqual ( 'idontexist' ) ;
1290
- } ) ;
1291
-
1292
- it ( 'should allow creating tag on ENTER in multiple select mode with tagging enabled, no labels' , function ( ) {
1293
-
1294
- scope . taggingFunc = function ( name ) {
1295
- return name ;
1296
- } ;
1297
-
1298
- var el = compileTemplate (
1299
- '<ui-select multiple ng-model="selection.selected" tagging="taggingFunc" tagging-label="false"> \
1300
- <ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
1301
- <ui-select-choices repeat="person in people | filter: $select.search"> \
1302
- <div ng-bind-html="person.name" | highlight: $select.search"></div> \
1303
- <div ng-bind-html="person.email | highlight: $select.search"></div> \
1304
- </ui-select-choices> \
1305
- </ui-select>'
1306
- ) ;
1307
-
1308
- var searchInput = el . find ( '.ui-select-search' ) ;
1309
-
1310
- setSearchText ( el , 'idontexist' ) ;
1311
-
1312
- triggerKeydown ( searchInput , Key . Enter ) ;
1313
-
1314
- expect ( $ ( el ) . scope ( ) . $select . selected ) . toEqual ( [ 'idontexist' ] ) ;
1315
- } ) ;
1316
-
1317
1216
it ( 'should append/transclude content (with correct scope) that users add at <match> tag' , function ( ) {
1318
1217
1319
1218
var el = compileTemplate (
@@ -1357,62 +1256,6 @@ describe('ui-select tests', function() {
1357
1256
1358
1257
} ) ;
1359
1258
1360
- it ( 'should call refresh function when search text changes' , function ( ) {
1361
-
1362
- var el = compileTemplate (
1363
- '<ui-select ng-model="selection.selected"> \
1364
- <ui-select-match> \
1365
- </ui-select-match> \
1366
- <ui-select-choices repeat="person in people | filter: $select.search" \
1367
- refresh="fetchFromServer($select.search)" refresh-delay="0"> \
1368
- <div ng-bind-html="person.name | highlight: $select.search"></div> \
1369
- <div ng-if="person.name==\'Wladimir\'"> \
1370
- <span class="only-once">I should appear only once</span>\
1371
- </div> \
1372
- </ui-select-choices> \
1373
- </ui-select>'
1374
- ) ;
1375
-
1376
- scope . fetchFromServer = function ( ) { } ;
1377
-
1378
- spyOn ( scope , 'fetchFromServer' ) ;
1379
-
1380
- el . scope ( ) . $select . search = 'r' ;
1381
- scope . $digest ( ) ;
1382
- $timeout . flush ( ) ;
1383
-
1384
- expect ( scope . fetchFromServer ) . toHaveBeenCalledWith ( 'r' ) ;
1385
-
1386
- } ) ;
1387
-
1388
- it ( 'should call refresh function when search text changes' , function ( ) {
1389
-
1390
- var el = compileTemplate (
1391
- '<ui-select ng-model="selection.selected"> \
1392
- <ui-select-match> \
1393
- </ui-select-match> \
1394
- <ui-select-choices repeat="person in people | filter: $select.search" \
1395
- refresh="fetchFromServer($select.search)" refresh-delay="0"> \
1396
- <div ng-bind-html="person.name | highlight: $select.search"></div> \
1397
- <div ng-if="person.name==\'Wladimir\'"> \
1398
- <span class="only-once">I should appear only once</span>\
1399
- </div> \
1400
- </ui-select-choices> \
1401
- </ui-select>'
1402
- ) ;
1403
-
1404
- scope . fetchFromServer = function ( ) { } ;
1405
-
1406
- spyOn ( scope , 'fetchFromServer' ) ;
1407
-
1408
- el . scope ( ) . $select . search = 'r' ;
1409
- scope . $digest ( ) ;
1410
- $timeout . flush ( ) ;
1411
-
1412
- expect ( scope . fetchFromServer ) . toHaveBeenCalledWith ( 'r' ) ;
1413
-
1414
- } ) ;
1415
-
1416
1259
it ( 'should format view value correctly when using single property binding and refresh function' , function ( ) {
1417
1260
1418
1261
var el = compileTemplate (
@@ -2253,33 +2096,4 @@ describe('ui-select tests', function() {
2253
2096
expect ( el . css ( 'width' ) ) . toBe ( originalWidth ) ;
2254
2097
} ) ;
2255
2098
} ) ;
2256
-
2257
- describe ( 'with refresh on active' , function ( ) {
2258
- it ( 'should not refresh untill is activate' , function ( ) {
2259
-
2260
- var el = compileTemplate (
2261
- '<ui-select ng-model="selection.selected"> \
2262
- <ui-select-match> \
2263
- </ui-select-match> \
2264
- <ui-select-choices repeat="person in people | filter: $select.search" \
2265
- refresh="fetchFromServer($select.search)" refresh-on-active="true" refresh-delay="0"> \
2266
- <div ng-bind-html="person.name | highlight: $select.search"></div> \
2267
- <div ng-if="person.name==\'Wladimir\'"> \
2268
- <span class="only-once">I should appear only once</span>\
2269
- </div> \
2270
- </ui-select-choices> \
2271
- </ui-select>'
2272
- ) ;
2273
-
2274
- scope . fetchFromServer = function ( ) { } ;
2275
- spyOn ( scope , 'fetchFromServer' ) ;
2276
- $timeout . flush ( ) ;
2277
- expect ( scope . fetchFromServer . calls . any ( ) ) . toEqual ( false ) ;
2278
-
2279
- el . scope ( ) . $select . activate ( ) ;
2280
- $timeout . flush ( ) ;
2281
- expect ( scope . fetchFromServer . calls . any ( ) ) . toEqual ( true ) ;
2282
- } ) ;
2283
-
2284
- } ) ;
2285
2099
} ) ;
0 commit comments