@angular-wave/angular.ts 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular-ts.umd.js +10 -0
- package/index.html +74 -3
- package/package.json +1 -1
- package/src/angular.spec.js +0 -5
- package/src/animations/animate-css.js +5 -13
- package/src/animations/animate-queue.js +22 -21
- package/src/animations/animate-runner.js +4 -8
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +0 -21
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/compile.js +26 -27
- package/src/core/compile/compile.spec.js +17 -266
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/controller/controller.js +2 -0
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +0 -2
- package/src/core/di/internal-injector.js +2 -1
- package/src/core/interpolate/interpolate.js +16 -3
- package/src/core/interpolate/interpolate.spec.js +70 -16
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/location/location.js +0 -2
- package/src/core/location/location.spec.js +27 -27
- package/src/core/{scope/scope.html → model/model.html} +1 -1
- package/src/core/model/model.js +944 -0
- package/src/core/model/model.spec.js +3012 -0
- package/src/core/on.spec.js +0 -7
- package/src/core/parse/interpreter.js +10 -7
- package/src/core/parse/parse.js +26 -5
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +61 -30
- package/src/core/scope/scope.spec.js +25 -1960
- package/src/directive/aria/aria.js +3 -6
- package/src/directive/aria/aria.spec.js +0 -87
- package/src/directive/attrs/attrs.spec.js +0 -5
- package/src/directive/attrs/boolean.spec.js +0 -15
- package/src/directive/attrs/element-style.spec.js +0 -8
- package/src/directive/attrs/src.spec.js +0 -7
- package/src/directive/bind/bind.spec.js +0 -33
- package/src/directive/bind/bing-html.spec.js +0 -3
- package/src/{core/q/q.html → directive/channel/channel.html} +1 -1
- package/src/directive/channel/channel.js +29 -0
- package/src/directive/channel/channel.spec.js +52 -0
- package/src/directive/{list/list.test.js → channel/channel.test.js} +2 -4
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +9 -75
- package/src/directive/controller/controller.spec.js +0 -13
- package/src/directive/events/click.spec.js +0 -3
- package/src/directive/events/event.spec.js +0 -6
- package/src/directive/form/form.js +2 -3
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +0 -4
- package/src/directive/include/include.spec.js +8 -59
- package/src/directive/init/init.js +6 -2
- package/src/directive/init/init.spec.js +0 -2
- package/src/directive/input/input.spec.js +0 -136
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +18 -25
- package/src/directive/model/model.spec.js +2 -49
- package/src/directive/model-options/model-options.spec.js +0 -6
- package/src/directive/non-bindable/non-bindable.spec.js +0 -1
- package/src/directive/observe/observe.js +0 -1
- package/src/directive/observe/observe.spec.js +0 -1
- package/src/directive/options/options.spec.js +0 -34
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.spec.js +8 -135
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +0 -96
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +8 -19
- package/src/directive/style/style.spec.js +0 -7
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +0 -1
- package/src/loader.js +0 -1
- package/src/public.js +75 -80
- package/src/router/common/coreservices.js +0 -2
- package/src/router/directives/state-directives.js +6 -14
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +4 -13
- package/src/router/directives/view-directive.spec.js +25 -71
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +3 -5
- package/src/router/resolve/resolvable.js +3 -6
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +2 -5
- package/src/router/state/views.js +7 -10
- package/src/router/template-factory.js +3 -6
- package/src/router/template-factory.spec.js +0 -4
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +6 -9
- package/src/services/http/http.spec.js +30 -31
- package/src/services/http/template-request.spec.js +0 -10
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +1 -2
- package/src/shared/jqlite/jqlite.js +0 -3
- package/types/core/cache/cache.d.ts +1 -1
- package/types/core/model/model.d.ts +204 -0
- package/types/core/parse/parse.d.ts +26 -0
- package/types/core/scope/scope.d.ts +22 -21
- package/types/directive/channel/channel.d.ts +11 -0
- package/src/core/interval/interval-factory.js +0 -50
- package/src/core/interval/interval.html +0 -18
- package/src/core/interval/interval.js +0 -77
- package/src/core/interval/interval.md +0 -123
- package/src/core/interval/interval.spec.js +0 -280
- package/src/core/q/q.js +0 -472
- package/src/core/q/q.md +0 -211
- package/src/core/q/q.spec.js +0 -2748
- package/src/core/q/q.test.js +0 -12
- package/src/core/scope/scope.test.js +0 -12
- package/src/core/timeout/timeout.html +0 -18
- package/src/core/timeout/timeout.js +0 -109
- package/src/core/timeout/timeout.spec.js +0 -354
- package/src/core/timeout/timout.test.js +0 -12
- package/src/directive/list/list.html +0 -18
- package/src/directive/list/list.js +0 -46
- package/src/directive/list/list.md +0 -22
- package/src/directive/list/list.spec.js +0 -172
- package/types/directive/list/list.d.ts +0 -4
|
@@ -43,8 +43,6 @@ describe("scriptDirective", () => {
|
|
|
43
43
|
'<script type="text/javascript">some {{binding}}</script>' +
|
|
44
44
|
'<script type="text/ng-template" id="/some">other {{binding}}</script>';
|
|
45
45
|
$compile(doc)($rootScope);
|
|
46
|
-
$rootScope.$digest();
|
|
47
|
-
|
|
48
46
|
const scripts = doc.find("script");
|
|
49
47
|
expect(scripts.eq(0)[0].text).toBe("some {{binding}}");
|
|
50
48
|
expect(scripts.eq(1)[0].text).toBe("other {{binding}}");
|
|
@@ -226,7 +226,7 @@ function SelectController($element, $scope) {
|
|
|
226
226
|
function scheduleRender() {
|
|
227
227
|
if (renderScheduled) return;
|
|
228
228
|
renderScheduled = true;
|
|
229
|
-
$scope
|
|
229
|
+
$scope.$postUpdate(() => {
|
|
230
230
|
renderScheduled = false;
|
|
231
231
|
self.ngModelCtrl.$render();
|
|
232
232
|
});
|
|
@@ -238,7 +238,7 @@ function SelectController($element, $scope) {
|
|
|
238
238
|
|
|
239
239
|
updateScheduled = true;
|
|
240
240
|
|
|
241
|
-
$scope
|
|
241
|
+
$scope.$postUpdate(() => {
|
|
242
242
|
if ($scope.$$destroyed) return;
|
|
243
243
|
|
|
244
244
|
updateScheduled = false;
|
|
@@ -349,7 +349,7 @@ function SelectController($element, $scope) {
|
|
|
349
349
|
currentValue === removeValue
|
|
350
350
|
) {
|
|
351
351
|
// When multiple (selected) options are destroyed at the same time, we don't want
|
|
352
|
-
// to run a model update for each of them. Instead, run a single update in the
|
|
352
|
+
// to run a model update for each of them. Instead, run a single update in the $postUpdate
|
|
353
353
|
scheduleViewValueUpdate(true);
|
|
354
354
|
}
|
|
355
355
|
});
|
|
@@ -19,7 +19,6 @@ describe("select", () => {
|
|
|
19
19
|
element = formElement.find("select");
|
|
20
20
|
$compile(formElement)(scope);
|
|
21
21
|
ngModelCtrl = element.controller("ngModel");
|
|
22
|
-
scope.$digest();
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
function setSelectValue(selectElement, optionIndex) {
|
|
@@ -350,7 +349,6 @@ describe("select", () => {
|
|
|
350
349
|
expect(scope.form.nameA.$name).toBe("nameA");
|
|
351
350
|
const oldModel = scope.form.nameA;
|
|
352
351
|
scope.nameID = "B";
|
|
353
|
-
scope.$digest();
|
|
354
352
|
expect(scope.form.nameA).toBeUndefined();
|
|
355
353
|
expect(scope.form.nameB).toBe(oldModel);
|
|
356
354
|
expect(scope.form.nameB.$name).toBe("nameB");
|
|
@@ -398,7 +396,6 @@ describe("select", () => {
|
|
|
398
396
|
$compile(select)(scope);
|
|
399
397
|
expect(selectCtrl.writeValue).not.toHaveBeenCalled();
|
|
400
398
|
|
|
401
|
-
scope.$digest();
|
|
402
399
|
expect(selectCtrl.writeValue).toHaveBeenCalled();
|
|
403
400
|
dealoc(select);
|
|
404
401
|
});
|
|
@@ -412,16 +409,12 @@ describe("select", () => {
|
|
|
412
409
|
"</select>",
|
|
413
410
|
);
|
|
414
411
|
|
|
415
|
-
scope.$digest();
|
|
416
|
-
|
|
417
412
|
let options = element.find("option");
|
|
418
413
|
expect(options[0].selected).toBeTrue();
|
|
419
414
|
expect(options[1].selected).toBeFalse();
|
|
420
415
|
expect(options[2].selected).toBeFalse();
|
|
421
416
|
|
|
422
417
|
scope.selected = "a";
|
|
423
|
-
scope.$digest();
|
|
424
|
-
|
|
425
418
|
options = element.find("option");
|
|
426
419
|
expect(options.length).toBe(3);
|
|
427
420
|
expect(options[0].selected).toBeFalse();
|
|
@@ -429,8 +422,6 @@ describe("select", () => {
|
|
|
429
422
|
expect(options[2].selected).toBeFalse();
|
|
430
423
|
|
|
431
424
|
scope.selected = "b";
|
|
432
|
-
scope.$digest();
|
|
433
|
-
|
|
434
425
|
options = element.find("option");
|
|
435
426
|
expect(options[0].selected).toBeFalse();
|
|
436
427
|
expect(options[1].selected).toBeFalse();
|
|
@@ -438,15 +429,12 @@ describe("select", () => {
|
|
|
438
429
|
|
|
439
430
|
// This will select the empty option
|
|
440
431
|
scope.selected = null;
|
|
441
|
-
scope.$digest();
|
|
442
|
-
|
|
443
432
|
expect(options[0].selected).toBeTrue();
|
|
444
433
|
expect(options[1].selected).toBeFalse();
|
|
445
434
|
expect(options[2].selected).toBeFalse();
|
|
446
435
|
|
|
447
436
|
// This will add and select the unknown option
|
|
448
437
|
scope.selected = "unmatched value";
|
|
449
|
-
scope.$digest();
|
|
450
438
|
options = element.find("option");
|
|
451
439
|
|
|
452
440
|
expect(options[0].selected).toBeTrue();
|
|
@@ -456,7 +444,6 @@ describe("select", () => {
|
|
|
456
444
|
|
|
457
445
|
// Back to matched value
|
|
458
446
|
scope.selected = "b";
|
|
459
|
-
scope.$digest();
|
|
460
447
|
options = element.find("option");
|
|
461
448
|
|
|
462
449
|
expect(options[0].selected).toBeFalse();
|
|
@@ -481,20 +468,15 @@ describe("select", () => {
|
|
|
481
468
|
{ val: "x", display: "robot x" },
|
|
482
469
|
{ val: "y", display: "robot y" },
|
|
483
470
|
];
|
|
484
|
-
scope.$digest();
|
|
485
|
-
|
|
486
471
|
expect(element[0].value).toBe("");
|
|
487
472
|
|
|
488
473
|
scope.robot = "x";
|
|
489
|
-
scope.$digest();
|
|
490
474
|
expect(element[0].value).toBe("x");
|
|
491
475
|
scope.dynamicOptions.shift();
|
|
492
476
|
|
|
493
|
-
scope.$digest();
|
|
494
477
|
expect(element[0].value).toBe("x");
|
|
495
478
|
|
|
496
479
|
scope.robot = undefined;
|
|
497
|
-
scope.$digest();
|
|
498
480
|
expect(element[0].value).toBe(unknownValue(undefined));
|
|
499
481
|
});
|
|
500
482
|
|
|
@@ -509,11 +491,9 @@ describe("select", () => {
|
|
|
509
491
|
'<option ng-repeat="opt in dynamicOptions" value="{{opt.val}}">{{opt.display}}</option>' +
|
|
510
492
|
"</select>",
|
|
511
493
|
);
|
|
512
|
-
scope.$digest();
|
|
513
494
|
expect(element[0].value).toBe(unknownValue("x"));
|
|
514
495
|
|
|
515
496
|
scope.robot = undefined;
|
|
516
|
-
scope.$digest();
|
|
517
497
|
expect(element.find("option").eq(0)[0].selected).toBe(true);
|
|
518
498
|
expect(element.find("option").eq(0).text()).toBe("--static-select--");
|
|
519
499
|
|
|
@@ -522,11 +502,9 @@ describe("select", () => {
|
|
|
522
502
|
{ val: "x", display: "robot x" },
|
|
523
503
|
{ val: "y", display: "robot y" },
|
|
524
504
|
];
|
|
525
|
-
scope.$digest();
|
|
526
505
|
expect(element[0].value).toBe("");
|
|
527
506
|
|
|
528
507
|
scope.dynamicOptions = [];
|
|
529
|
-
scope.$digest();
|
|
530
508
|
expect(element[0].value).toBe("");
|
|
531
509
|
});
|
|
532
510
|
|
|
@@ -583,8 +561,6 @@ describe("select", () => {
|
|
|
583
561
|
expect(element[0].value).toBe(unknownValue("other"));
|
|
584
562
|
|
|
585
563
|
scope.robot = undefined;
|
|
586
|
-
scope.$digest();
|
|
587
|
-
|
|
588
564
|
expect(element[0].value).toBe("");
|
|
589
565
|
});
|
|
590
566
|
|
|
@@ -671,8 +647,6 @@ describe("select", () => {
|
|
|
671
647
|
"</select>",
|
|
672
648
|
);
|
|
673
649
|
|
|
674
|
-
scope.$digest();
|
|
675
|
-
|
|
676
650
|
let options = element.find("option");
|
|
677
651
|
expect(options.length).toBe(3);
|
|
678
652
|
expect(options[0].selected).toBeTrue();
|
|
@@ -680,8 +654,6 @@ describe("select", () => {
|
|
|
680
654
|
expect(options[2].selected).toBeFalse();
|
|
681
655
|
|
|
682
656
|
scope.selected = "a";
|
|
683
|
-
scope.$digest();
|
|
684
|
-
|
|
685
657
|
options = element.find("option");
|
|
686
658
|
expect(options.length).toBe(3);
|
|
687
659
|
expect(options[0].selected).toBeFalse();
|
|
@@ -689,8 +661,6 @@ describe("select", () => {
|
|
|
689
661
|
expect(options[2].selected).toBeFalse();
|
|
690
662
|
|
|
691
663
|
scope.selected = "no match";
|
|
692
|
-
scope.$digest();
|
|
693
|
-
|
|
694
664
|
options = element.find("option");
|
|
695
665
|
expect(options[0].selected).toBeTrue();
|
|
696
666
|
expect(options[1].selected).toBeFalse();
|
|
@@ -930,7 +900,6 @@ describe("select", () => {
|
|
|
930
900
|
];
|
|
931
901
|
scope.empty = true;
|
|
932
902
|
|
|
933
|
-
scope.$digest();
|
|
934
903
|
expect(element[0].value).toBe("");
|
|
935
904
|
expect(selectCtrl.$hasEmptyOption()).toBe(true);
|
|
936
905
|
expect(selectCtrl.$isEmptyOptionSelected()).toBe(true);
|
|
@@ -1435,14 +1404,12 @@ describe("select", () => {
|
|
|
1435
1404
|
"</select>",
|
|
1436
1405
|
);
|
|
1437
1406
|
|
|
1438
|
-
scope.$digest();
|
|
1439
1407
|
expect(scope.selected).toBeUndefined();
|
|
1440
1408
|
|
|
1441
1409
|
setSelectValue(element, 0);
|
|
1442
1410
|
expect(scope.selected).toBe("option1");
|
|
1443
1411
|
|
|
1444
1412
|
scope.selected = "option2";
|
|
1445
|
-
scope.$digest();
|
|
1446
1413
|
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1447
1414
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
1448
1415
|
});
|
|
@@ -1461,15 +1428,12 @@ describe("select", () => {
|
|
|
1461
1428
|
const selectCtrl = element.controller("select");
|
|
1462
1429
|
spyOn(selectCtrl, "removeOption").and.callThrough();
|
|
1463
1430
|
|
|
1464
|
-
scope.$digest();
|
|
1465
1431
|
expect(scope.selected).toBeUndefined();
|
|
1466
1432
|
expect(selectCtrl.removeOption).not.toHaveBeenCalled();
|
|
1467
1433
|
|
|
1468
1434
|
// Change value of option2
|
|
1469
1435
|
scope.option2 = "option2Changed";
|
|
1470
1436
|
scope.selected = "option2Changed";
|
|
1471
|
-
scope.$digest();
|
|
1472
|
-
|
|
1473
1437
|
expect(selectCtrl.removeOption).toHaveBeenCalledWith("");
|
|
1474
1438
|
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1475
1439
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
@@ -1486,14 +1450,12 @@ describe("select", () => {
|
|
|
1486
1450
|
"</select>",
|
|
1487
1451
|
);
|
|
1488
1452
|
|
|
1489
|
-
scope.$digest();
|
|
1490
1453
|
expect(scope.selected).toBeUndefined();
|
|
1491
1454
|
|
|
1492
1455
|
setSelectValue(element, 0);
|
|
1493
1456
|
expect(scope.selected).toBe("Option 1");
|
|
1494
1457
|
|
|
1495
1458
|
scope.selected = "Option 2";
|
|
1496
|
-
scope.$digest();
|
|
1497
1459
|
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1498
1460
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
1499
1461
|
});
|
|
@@ -1512,15 +1474,12 @@ describe("select", () => {
|
|
|
1512
1474
|
const selectCtrl = element.controller("select");
|
|
1513
1475
|
spyOn(selectCtrl, "removeOption").and.callThrough();
|
|
1514
1476
|
|
|
1515
|
-
scope.$digest();
|
|
1516
1477
|
expect(scope.selected).toBeUndefined();
|
|
1517
1478
|
expect(selectCtrl.removeOption).not.toHaveBeenCalled();
|
|
1518
1479
|
|
|
1519
1480
|
// Change value of option2
|
|
1520
1481
|
scope.option2 = "Option 2 Changed";
|
|
1521
1482
|
scope.selected = "Option 2 Changed";
|
|
1522
|
-
scope.$digest();
|
|
1523
|
-
|
|
1524
1483
|
expect(selectCtrl.removeOption).toHaveBeenCalledWith("");
|
|
1525
1484
|
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1526
1485
|
expect(element.find("option").eq(1).text()).toBe("Option 2 Changed");
|
|
@@ -1535,7 +1494,6 @@ describe("select", () => {
|
|
|
1535
1494
|
)($rootScope);
|
|
1536
1495
|
|
|
1537
1496
|
$rootScope.foo = "success";
|
|
1538
|
-
$rootScope.$digest();
|
|
1539
1497
|
expect(element.find("span").text()).toBe("success");
|
|
1540
1498
|
dealoc(element);
|
|
1541
1499
|
});
|
|
@@ -1574,18 +1532,13 @@ describe("select", () => {
|
|
|
1574
1532
|
"</select>",
|
|
1575
1533
|
);
|
|
1576
1534
|
|
|
1577
|
-
scope.$digest();
|
|
1578
1535
|
expect(element.find("option").eq(0).val()).toBe("? string:NOMATCH ?");
|
|
1579
1536
|
|
|
1580
1537
|
scope.selected = prop;
|
|
1581
|
-
scope.$digest();
|
|
1582
|
-
|
|
1583
1538
|
expect(element.find("option").eq(0).val()).toBe(hashKey(prop));
|
|
1584
1539
|
|
|
1585
1540
|
// Reset
|
|
1586
1541
|
scope.selected = false;
|
|
1587
|
-
scope.$digest();
|
|
1588
|
-
|
|
1589
1542
|
expect(element.find("option").eq(0).val()).toBe("? boolean:false ?");
|
|
1590
1543
|
|
|
1591
1544
|
setSelectValue(element, 0);
|
|
@@ -1622,19 +1575,14 @@ describe("select", () => {
|
|
|
1622
1575
|
const selectController = element.controller("select");
|
|
1623
1576
|
spyOn(selectController, "removeOption").and.callThrough();
|
|
1624
1577
|
|
|
1625
|
-
scope.$digest();
|
|
1626
1578
|
expect(selectController.removeOption).not.toHaveBeenCalled();
|
|
1627
1579
|
expect(element.find("option").eq(0).val()).toBe("? string:NOMATCH ?");
|
|
1628
1580
|
|
|
1629
1581
|
scope.selected = prop;
|
|
1630
|
-
scope.$digest();
|
|
1631
|
-
|
|
1632
1582
|
expect(element.find("option").eq(0).val()).toBe(hashKey(prop));
|
|
1633
1583
|
expect(element[0].selectedIndex).toBe(0);
|
|
1634
1584
|
|
|
1635
1585
|
scope.option = "UPDATEDVALUE";
|
|
1636
|
-
scope.$digest();
|
|
1637
|
-
|
|
1638
1586
|
expect(selectController.removeOption.calls.count()).toBe(1);
|
|
1639
1587
|
|
|
1640
1588
|
// Updating the option value currently does not update the select model
|
|
@@ -1657,8 +1605,6 @@ describe("select", () => {
|
|
|
1657
1605
|
);
|
|
1658
1606
|
|
|
1659
1607
|
scope.selected = "UPDATEDVALUE";
|
|
1660
|
-
scope.$digest();
|
|
1661
|
-
|
|
1662
1608
|
expect(element[0].selectedIndex).toBe(0);
|
|
1663
1609
|
expect(element.find("option").eq(0).val()).toBe(
|
|
1664
1610
|
"string:UPDATEDVALUE",
|
|
@@ -1681,8 +1627,6 @@ describe("select", () => {
|
|
|
1681
1627
|
});
|
|
1682
1628
|
|
|
1683
1629
|
scope.option = "init";
|
|
1684
|
-
scope.$digest();
|
|
1685
|
-
|
|
1686
1630
|
expect(log[0]).toBe("init");
|
|
1687
1631
|
expect(element.find("option").eq(1).val()).toBe("string:init");
|
|
1688
1632
|
|
|
@@ -1752,8 +1696,6 @@ describe("select", () => {
|
|
|
1752
1696
|
"</select>",
|
|
1753
1697
|
);
|
|
1754
1698
|
|
|
1755
|
-
scope.$digest();
|
|
1756
|
-
|
|
1757
1699
|
expect(
|
|
1758
1700
|
Object.values(element[0].childNodes)
|
|
1759
1701
|
.map((x) => x.value)
|
|
@@ -1770,8 +1712,6 @@ describe("select", () => {
|
|
|
1770
1712
|
);
|
|
1771
1713
|
|
|
1772
1714
|
scope.selected = ["string", 1];
|
|
1773
|
-
scope.$digest();
|
|
1774
|
-
|
|
1775
1715
|
expect(element.find("option").eq(0)[0].selected).toBe(true);
|
|
1776
1716
|
expect(element.find("option").eq(2)[0].selected).toBe(true);
|
|
1777
1717
|
|
|
@@ -1841,8 +1781,6 @@ describe("select", () => {
|
|
|
1841
1781
|
expect(scope.obj.value).toBe(prop === "ngValue" ? A : "A");
|
|
1842
1782
|
|
|
1843
1783
|
scope.options.shift();
|
|
1844
|
-
scope.$digest();
|
|
1845
|
-
|
|
1846
1784
|
optionElements = element.find("option");
|
|
1847
1785
|
expect(optionElements.length).toEqual(3);
|
|
1848
1786
|
expect(scope.obj.value).toBe(null);
|
|
@@ -1885,8 +1823,6 @@ describe("select", () => {
|
|
|
1885
1823
|
expect(scope.obj.value).toBe("A");
|
|
1886
1824
|
|
|
1887
1825
|
A.name = "X";
|
|
1888
|
-
scope.$digest();
|
|
1889
|
-
|
|
1890
1826
|
optionElements = element.find("option");
|
|
1891
1827
|
expect(optionElements.length).toEqual(4);
|
|
1892
1828
|
expect(scope.obj.value).toBe(null);
|
|
@@ -1929,8 +1865,6 @@ describe("select", () => {
|
|
|
1929
1865
|
expect(scope.obj.value).toBe("A");
|
|
1930
1866
|
|
|
1931
1867
|
A.disabled = true;
|
|
1932
|
-
scope.$digest();
|
|
1933
|
-
|
|
1934
1868
|
optionElements = element.find("option");
|
|
1935
1869
|
expect(optionElements.length).toEqual(4);
|
|
1936
1870
|
expect(scope.obj.value).toBe(null);
|
|
@@ -1969,15 +1903,11 @@ describe("select", () => {
|
|
|
1969
1903
|
expect(optionElements[0].value).toEqual(unknownValue(undefined));
|
|
1970
1904
|
|
|
1971
1905
|
B.disabled = true;
|
|
1972
|
-
scope.$digest();
|
|
1973
|
-
|
|
1974
1906
|
optionElements = element.find("option");
|
|
1975
1907
|
expect(optionElements.length).toEqual(4);
|
|
1976
1908
|
expect(optionElements[0].value).toEqual(unknownValue(undefined));
|
|
1977
1909
|
|
|
1978
1910
|
scope.obj.value = "B";
|
|
1979
|
-
scope.$digest();
|
|
1980
|
-
|
|
1981
1911
|
optionElements = element.find("option");
|
|
1982
1912
|
expect(optionElements.length).toEqual(3);
|
|
1983
1913
|
expect(scope.obj.value).toBe("B");
|
|
@@ -2023,16 +1953,12 @@ describe("select", () => {
|
|
|
2023
1953
|
expect(scope.obj.value).toBe("A");
|
|
2024
1954
|
|
|
2025
1955
|
A.disabled = true;
|
|
2026
|
-
scope.$digest();
|
|
2027
|
-
|
|
2028
1956
|
optionElements = element.find("option");
|
|
2029
1957
|
expect(optionElements.length).toEqual(4);
|
|
2030
1958
|
expect(scope.obj.value).toBe(null);
|
|
2031
1959
|
expect(element.val()).toBe("? object:null ?");
|
|
2032
1960
|
|
|
2033
1961
|
A.disabled = false;
|
|
2034
|
-
scope.$digest();
|
|
2035
|
-
|
|
2036
1962
|
optionElements = element.find("option");
|
|
2037
1963
|
expect(optionElements.length).toEqual(4);
|
|
2038
1964
|
expect(scope.obj.value).toBe(null);
|
|
@@ -2072,8 +1998,6 @@ describe("select", () => {
|
|
|
2072
1998
|
expect(optionElements.length).toEqual(3);
|
|
2073
1999
|
|
|
2074
2000
|
scope.options.push(C);
|
|
2075
|
-
scope.$digest();
|
|
2076
|
-
|
|
2077
2001
|
optionElements = element.find("option");
|
|
2078
2002
|
expect(optionElements.length).toEqual(3);
|
|
2079
2003
|
expect(optionElements[2].selected).toBe(true);
|
|
@@ -2112,8 +2036,6 @@ describe("select", () => {
|
|
|
2112
2036
|
expect(optionElements.length).toEqual(3);
|
|
2113
2037
|
|
|
2114
2038
|
scope.obj.value = "C";
|
|
2115
|
-
scope.$digest();
|
|
2116
|
-
|
|
2117
2039
|
optionElements = element.find("option");
|
|
2118
2040
|
expect(element.val()).toBe(prop === "ngValue" ? "string:C" : "C");
|
|
2119
2041
|
expect(optionElements.length).toEqual(3);
|
|
@@ -2121,8 +2043,6 @@ describe("select", () => {
|
|
|
2121
2043
|
expect(scope.obj.value).toBe("C");
|
|
2122
2044
|
|
|
2123
2045
|
scope.options = [{ name: "A" }, { name: "B" }, { name: "C" }];
|
|
2124
|
-
scope.$digest();
|
|
2125
|
-
|
|
2126
2046
|
optionElements = element.find("option");
|
|
2127
2047
|
expect(element.val()).toBe(prop === "ngValue" ? "string:C" : "C");
|
|
2128
2048
|
expect(optionElements.length).toEqual(3);
|
|
@@ -2181,8 +2101,6 @@ describe("select", () => {
|
|
|
2181
2101
|
ngModelCtrlSpy.calls.reset();
|
|
2182
2102
|
scope.options.shift();
|
|
2183
2103
|
scope.options.pop();
|
|
2184
|
-
scope.$digest();
|
|
2185
|
-
|
|
2186
2104
|
optionElements = element.find("option");
|
|
2187
2105
|
expect(optionElements.length).toEqual(1);
|
|
2188
2106
|
expect(scope.obj.value).toEqual([]);
|
|
@@ -2246,8 +2164,6 @@ describe("select", () => {
|
|
|
2246
2164
|
ngModelCtrlSpy.calls.reset();
|
|
2247
2165
|
A.name = "X";
|
|
2248
2166
|
C.name = "Z";
|
|
2249
|
-
scope.$digest();
|
|
2250
|
-
|
|
2251
2167
|
optionElements = element.find("option");
|
|
2252
2168
|
expect(optionElements.length).toEqual(3);
|
|
2253
2169
|
expect(scope.obj.value).toEqual([]);
|
|
@@ -2313,8 +2229,6 @@ describe("select", () => {
|
|
|
2313
2229
|
ngModelCtrlSpy.calls.reset();
|
|
2314
2230
|
A.disabled = true;
|
|
2315
2231
|
C.disabled = true;
|
|
2316
|
-
scope.$digest();
|
|
2317
|
-
|
|
2318
2232
|
optionElements = element.find("option");
|
|
2319
2233
|
expect(optionElements.length).toEqual(4);
|
|
2320
2234
|
expect(scope.obj.value).toEqual(["D"]);
|
|
@@ -2360,15 +2274,11 @@ describe("select", () => {
|
|
|
2360
2274
|
|
|
2361
2275
|
A.disabled = true;
|
|
2362
2276
|
D.disabled = true;
|
|
2363
|
-
scope.$digest();
|
|
2364
|
-
|
|
2365
2277
|
optionElements = element.find("option");
|
|
2366
2278
|
expect(optionElements.length).toEqual(4);
|
|
2367
2279
|
expect(element[0].value).toBe("");
|
|
2368
2280
|
|
|
2369
2281
|
scope.obj.value = prop === "ngValue" ? [A, C, D] : ["A", "C", "D"];
|
|
2370
|
-
scope.$digest();
|
|
2371
|
-
|
|
2372
2282
|
optionElements = element.find("option");
|
|
2373
2283
|
expect(optionElements.length).toEqual(4);
|
|
2374
2284
|
expect(optionElements.eq(0)[0].selected).toBe(true);
|
|
@@ -2412,8 +2322,6 @@ describe("select", () => {
|
|
|
2412
2322
|
expect(optionElements.eq(1)[0].selected).toBe(true);
|
|
2413
2323
|
|
|
2414
2324
|
scope.options.push(C);
|
|
2415
|
-
scope.$digest();
|
|
2416
|
-
|
|
2417
2325
|
optionElements = element.find("option");
|
|
2418
2326
|
|
|
2419
2327
|
expect(optionElements.length).toEqual(3);
|
|
@@ -2456,8 +2364,6 @@ describe("select", () => {
|
|
|
2456
2364
|
expect(optionElements.length).toEqual(3);
|
|
2457
2365
|
|
|
2458
2366
|
scope.obj.value = ["B", "C"];
|
|
2459
|
-
scope.$digest();
|
|
2460
|
-
|
|
2461
2367
|
optionElements = element.find("option");
|
|
2462
2368
|
|
|
2463
2369
|
expect(optionElements.length).toEqual(3);
|
|
@@ -2466,8 +2372,6 @@ describe("select", () => {
|
|
|
2466
2372
|
expect(scope.obj.value).toEqual(["B", "C"]);
|
|
2467
2373
|
|
|
2468
2374
|
scope.options = [{ name: "A" }, { name: "B" }, { name: "C" }];
|
|
2469
|
-
scope.$digest();
|
|
2470
|
-
|
|
2471
2375
|
optionElements = element.find("option");
|
|
2472
2376
|
|
|
2473
2377
|
expect(optionElements.length).toEqual(3);
|
|
@@ -22,7 +22,7 @@ export function ngShowDirective($animate) {
|
|
|
22
22
|
tempClasses: NG_HIDE_IN_PROGRESS_CLASS,
|
|
23
23
|
});
|
|
24
24
|
} else {
|
|
25
|
-
scope
|
|
25
|
+
scope.$postUpdate(() => {
|
|
26
26
|
if (value) {
|
|
27
27
|
element
|
|
28
28
|
.elements()
|
|
@@ -56,7 +56,7 @@ export function ngHideDirective($animate) {
|
|
|
56
56
|
tempClasses: NG_HIDE_IN_PROGRESS_CLASS,
|
|
57
57
|
});
|
|
58
58
|
} else {
|
|
59
|
-
scope
|
|
59
|
+
scope.$postUpdate(() => {
|
|
60
60
|
if (value) {
|
|
61
61
|
element
|
|
62
62
|
.elements()
|
|
@@ -24,10 +24,8 @@ describe("ngShow / ngHide", () => {
|
|
|
24
24
|
it("should show and hide an element", () => {
|
|
25
25
|
element = JQLite('<div ng-show="exp"></div>');
|
|
26
26
|
element = $compile(element)($scope);
|
|
27
|
-
$scope.$digest();
|
|
28
27
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
29
28
|
$scope.exp = true;
|
|
30
|
-
$scope.$digest();
|
|
31
29
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
32
30
|
});
|
|
33
31
|
|
|
@@ -36,7 +34,6 @@ describe("ngShow / ngHide", () => {
|
|
|
36
34
|
element = JQLite('<div ng-show="exp"></div>');
|
|
37
35
|
element = $compile(element)($scope);
|
|
38
36
|
$scope.exp = function () {};
|
|
39
|
-
$scope.$digest();
|
|
40
37
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
41
38
|
});
|
|
42
39
|
|
|
@@ -45,7 +42,6 @@ describe("ngShow / ngHide", () => {
|
|
|
45
42
|
element = $compile(element)($scope);
|
|
46
43
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
47
44
|
$scope.exp = true;
|
|
48
|
-
$scope.$digest();
|
|
49
45
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
50
46
|
});
|
|
51
47
|
|
|
@@ -53,7 +49,6 @@ describe("ngShow / ngHide", () => {
|
|
|
53
49
|
["false", "undefined", "null", "NaN", "''", "0"].forEach((x) => {
|
|
54
50
|
element = JQLite(`<div ng-show="${x}"></div>`);
|
|
55
51
|
element = $compile(element)($scope);
|
|
56
|
-
$scope.$digest();
|
|
57
52
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
58
53
|
});
|
|
59
54
|
});
|
|
@@ -62,7 +57,6 @@ describe("ngShow / ngHide", () => {
|
|
|
62
57
|
["'f'", "'0'", "'false'", "'no'", "'n'", "'[]'"].forEach((x) => {
|
|
63
58
|
element = JQLite(`<div ng-show="${x}"></div>`);
|
|
64
59
|
element = $compile(element)($scope);
|
|
65
|
-
$scope.$digest();
|
|
66
60
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
67
61
|
});
|
|
68
62
|
});
|
|
@@ -71,7 +65,6 @@ describe("ngShow / ngHide", () => {
|
|
|
71
65
|
["[]", "{}"].forEach((x) => {
|
|
72
66
|
element = JQLite(`<div ng-show="${x}"></div>`);
|
|
73
67
|
element = $compile(element)($scope);
|
|
74
|
-
$scope.$digest();
|
|
75
68
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
76
69
|
});
|
|
77
70
|
});
|
|
@@ -83,7 +76,6 @@ describe("ngShow / ngHide", () => {
|
|
|
83
76
|
element = $compile(element)($scope);
|
|
84
77
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
85
78
|
$scope.exp = true;
|
|
86
|
-
$scope.$digest();
|
|
87
79
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
88
80
|
});
|
|
89
81
|
|
|
@@ -91,7 +83,6 @@ describe("ngShow / ngHide", () => {
|
|
|
91
83
|
["false", "undefined", "null", "NaN", "''", "0"].forEach((x) => {
|
|
92
84
|
element = JQLite(`<div ng-hide="${x}"></div>`);
|
|
93
85
|
element = $compile(element)($scope);
|
|
94
|
-
$scope.$digest();
|
|
95
86
|
expect(element[0].classList.contains("ng-hide")).toBeFalse();
|
|
96
87
|
});
|
|
97
88
|
});
|
|
@@ -100,7 +91,6 @@ describe("ngShow / ngHide", () => {
|
|
|
100
91
|
["'f'", "'0'", "'false'", "'no'", "'n'", "'[]'"].forEach((x) => {
|
|
101
92
|
element = JQLite(`<div ng-hide="${x}"></div>`);
|
|
102
93
|
element = $compile(element)($scope);
|
|
103
|
-
$scope.$digest();
|
|
104
94
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
105
95
|
});
|
|
106
96
|
});
|
|
@@ -109,7 +99,6 @@ describe("ngShow / ngHide", () => {
|
|
|
109
99
|
["[]", "{}"].forEach((x) => {
|
|
110
100
|
element = JQLite(`<div ng-hide="${x}"></div>`);
|
|
111
101
|
element = $compile(element)($scope);
|
|
112
|
-
$scope.$digest();
|
|
113
102
|
expect(element[0].classList.contains("ng-hide")).toBeTrue();
|
|
114
103
|
});
|
|
115
104
|
});
|
|
@@ -160,7 +149,7 @@ describe("ngShow / ngHide", () => {
|
|
|
160
149
|
// const $scope = $rootScope.$new();
|
|
161
150
|
// $scope.on = true;
|
|
162
151
|
// element = $compile(html('<div ng-show="on">data</div>'))($scope);
|
|
163
|
-
//
|
|
152
|
+
// ;
|
|
164
153
|
|
|
165
154
|
// item = $animate.queue.shift();
|
|
166
155
|
// expect(item.event).toBe("removeClass");
|
|
@@ -168,7 +157,7 @@ describe("ngShow / ngHide", () => {
|
|
|
168
157
|
// expect(item.element).toBeShown();
|
|
169
158
|
|
|
170
159
|
// $scope.on = false;
|
|
171
|
-
//
|
|
160
|
+
// ;
|
|
172
161
|
|
|
173
162
|
// item = $animate.queue.shift();
|
|
174
163
|
// expect(item.event).toBe("addClass");
|
|
@@ -187,14 +176,14 @@ describe("ngShow / ngHide", () => {
|
|
|
187
176
|
// element = $compile(
|
|
188
177
|
// html('<div class="show-hide" ng-show="on">data</div>'),
|
|
189
178
|
// )($scope);
|
|
190
|
-
//
|
|
179
|
+
// ;
|
|
191
180
|
|
|
192
181
|
// item = $animate.queue.shift();
|
|
193
182
|
// expect(item.event).toEqual("addClass");
|
|
194
183
|
// expect(item.options.tempClasses).toEqual("ng-hide-animate");
|
|
195
184
|
|
|
196
185
|
// $scope.on = true;
|
|
197
|
-
//
|
|
186
|
+
// ;
|
|
198
187
|
// item = $animate.queue.shift();
|
|
199
188
|
// expect(item.event).toEqual("removeClass");
|
|
200
189
|
// expect(item.options.tempClasses).toEqual("ng-hide-animate");
|
|
@@ -211,7 +200,7 @@ describe("ngShow / ngHide", () => {
|
|
|
211
200
|
// const $scope = $rootScope.$new();
|
|
212
201
|
// $scope.off = true;
|
|
213
202
|
// element = $compile(html('<div ng-hide="off">datum</div>'))($scope);
|
|
214
|
-
//
|
|
203
|
+
// ;
|
|
215
204
|
|
|
216
205
|
// item = $animate.queue.shift();
|
|
217
206
|
// expect(item.event).toBe("addClass");
|
|
@@ -219,7 +208,7 @@ describe("ngShow / ngHide", () => {
|
|
|
219
208
|
// expect(item.element).toBeHidden();
|
|
220
209
|
|
|
221
210
|
// $scope.off = false;
|
|
222
|
-
//
|
|
211
|
+
// ;
|
|
223
212
|
|
|
224
213
|
// item = $animate.queue.shift();
|
|
225
214
|
// expect(item.event).toBe("removeClass");
|
|
@@ -238,14 +227,14 @@ describe("ngShow / ngHide", () => {
|
|
|
238
227
|
// element = $compile(
|
|
239
228
|
// html('<div class="show-hide" ng-hide="on">data</div>'),
|
|
240
229
|
// )($scope);
|
|
241
|
-
//
|
|
230
|
+
// ;
|
|
242
231
|
|
|
243
232
|
// item = $animate.queue.shift();
|
|
244
233
|
// expect(item.event).toEqual("removeClass");
|
|
245
234
|
// expect(item.options.tempClasses).toEqual("ng-hide-animate");
|
|
246
235
|
|
|
247
236
|
// $scope.on = true;
|
|
248
|
-
//
|
|
237
|
+
// ;
|
|
249
238
|
// item = $animate.queue.shift();
|
|
250
239
|
// expect(item.event).toEqual("addClass");
|
|
251
240
|
// expect(item.options.tempClasses).toEqual("ng-hide-animate");
|