@angular-wave/angular.ts 0.0.1 → 0.0.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/Makefile +1 -1
- package/dist/angular-ts.cjs.js +506 -1696
- package/dist/angular-ts.esm.js +506 -1696
- package/dist/angular-ts.umd.js +506 -1696
- package/package.json +1 -1
- package/public/README.md +1 -0
- package/src/animations/{animateCss.js → animate-css.js} +0 -1
- package/src/animations/animation.js +428 -431
- package/src/animations/module.js +9 -9
- package/src/core/cache.js +2 -0
- package/src/core/compile.js +6 -1102
- package/src/core/compile.md +1192 -0
- package/src/core/location.js +1 -1
- package/src/core/utils.js +1 -1
- package/src/directive/a.js +1 -1
- package/src/directive/attrs.js +1 -1
- package/src/directive/csp.md +89 -0
- package/src/directive/input.js +3 -3
- package/src/directive/{ngModel.js → model.js} +1 -1
- package/src/directive/select.js +5 -5
- package/src/jqLite.js +1 -22
- package/src/public.js +24 -24
- package/src/services/log.js +66 -116
- package/src/services/log.md +39 -0
- package/test/jqlite.spec.js +5 -35
- package/test/messages/messages.spec.js +1 -1
- package/test/ng/compile.spec.js +17 -16
- package/test/ng/directive/model-options.spec.js +1 -1
- package/test/ng/directive/model.spec.js +1 -1
- package/test/ng/directive/options.spec.js +61 -61
- package/test/ng/directive/select.spec.js +22 -22
- package/test/ng/http-backend.spec.js +1 -1
- package/test/ng/on.spec.js +1 -1
- package/test/ng/prop.spec.js +54 -62
- package/test/ng/sanitize-uri.spec.js +1 -1
- package/test/ng/scope.spec.js +1 -1
- package/test/original-test.html +1 -1
- package/types/jqlite.d.ts +1 -32
- package/dist/build/angular-mocks.js +0 -3757
- package/dist/build/angular-parse-ext.js +0 -1275
- package/dist/build/angular-resource.js +0 -911
- package/dist/build/angular-touch.js +0 -368
- package/src/core/attributes.js +0 -199
- package/src/directive/ngCsp.js +0 -82
- /package/{dist/build → legacy}/angular-animate.js +0 -0
- /package/{dist/build → legacy}/angular-aria.js +0 -0
- /package/{dist/build → legacy}/angular-message-format.js +0 -0
- /package/{dist/build → legacy}/angular-messages.js +0 -0
- /package/{dist/build → legacy}/angular-route.js +0 -0
- /package/{dist/build → legacy}/angular-sanitize.js +0 -0
- /package/{dist/build → legacy}/angular.js +0 -0
- /package/src/animations/{animateCache.js → animate-cache.js} +0 -0
- /package/src/animations/{animateChildrenDirective.js → animate-children-directive.js} +0 -0
- /package/src/animations/{animateCssDriver.js → animate-css-driver.js} +0 -0
- /package/src/animations/{animateJsDriver.js → animate-js-driver.js} +0 -0
- /package/src/animations/{animateJs.js → animate-js.js} +0 -0
- /package/src/animations/{animateQueue.js → animate-queue.js} +0 -0
- /package/src/animations/{ngAnimateSwap.js → animate-swap.js} +0 -0
- /package/src/animations/{rafScheduler.js → raf-scheduler.js} +0 -0
- /package/src/core/{animateCss.js → animate-css.js} +0 -0
- /package/src/core/{animateRunner.js → animate-runner.js} +0 -0
- /package/src/core/{exceptionHandler.js → exception-handler.js} +0 -0
- /package/src/core/{intervalFactory.js → interval-factory.js} +0 -0
- /package/src/core/{rootScope.js → root-scope.js} +0 -0
- /package/src/core/{sanitizeUri.js → sanitize-uri.js} +0 -0
- /package/src/core/{taskTrackerFactory.js → task-tracker-factory.js} +0 -0
- /package/src/directive/{ngClass.js → class.js} +0 -0
- /package/src/directive/{ngController.js → controller.js} +0 -0
- /package/src/directive/{ngIf.js → if.js} +0 -0
- /package/src/directive/{ngInclude.js → include.js} +0 -0
- /package/src/directive/{ngModelOptions.js → model-options.js} +0 -0
- /package/src/directive/{ngOptions.js → options.js} +0 -0
- /package/src/directive/{ngRef.js → ref.js} +0 -0
- /package/src/directive/{ngRepeat.js → repeat.js} +0 -0
- /package/src/directive/{ngShowHide.js → show-hide.js} +0 -0
- /package/src/directive/{ngSwitch.js → switch.js} +0 -0
- /package/src/directive/{ngTransclude.js → transclude.js} +0 -0
- /package/src/{routeToRegExp.js → route-to-reg-exp.js} +0 -0
- /package/src/services/{anchorScroll.js → anchor-scroll.js} +0 -0
- /package/src/services/{cacheFactory.js → cache-factory.js} +0 -0
- /package/src/services/{cookieReader.js → cookie-reader.js} +0 -0
- /package/src/services/{httpBackend.js → http-backend.js} +0 -0
- /package/src/services/{templateRequest.js → template-request.js} +0 -0
- /package/test/ng/{anomate.spec.js → animate.spec.js} +0 -0
package/test/jqlite.spec.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createInjector } from "../src/injector";
|
|
|
4
4
|
import { publishExternalAPI } from "../src/public";
|
|
5
5
|
import { equals, forEach } from "../src/core/utils";
|
|
6
6
|
import { browserTrigger } from "./test-utils";
|
|
7
|
+
import { CACHE, EXPANDO } from "../src/core/cache";
|
|
7
8
|
|
|
8
9
|
describe("jqLite", () => {
|
|
9
10
|
let scope;
|
|
@@ -572,13 +573,13 @@ describe("jqLite", () => {
|
|
|
572
573
|
const node = document.createElement("div");
|
|
573
574
|
document.body.appendChild(node);
|
|
574
575
|
|
|
575
|
-
expect(
|
|
576
|
+
expect(CACHE.has(node[EXPANDO])).toBe(false);
|
|
576
577
|
expect(jqLite.data(node, "foo")).toBeUndefined();
|
|
577
|
-
expect(
|
|
578
|
+
expect(CACHE.has(node[EXPANDO])).toBe(false);
|
|
578
579
|
|
|
579
580
|
jqLite.data(node, "foo", "bar");
|
|
580
581
|
|
|
581
|
-
expect(
|
|
582
|
+
expect(CACHE.has(node[EXPANDO])).toBe(true);
|
|
582
583
|
expect(jqLite.data(node, "foo")).toBe("bar");
|
|
583
584
|
expect(jqLite(node).data("foo")).toBe("bar");
|
|
584
585
|
|
|
@@ -593,7 +594,7 @@ describe("jqLite", () => {
|
|
|
593
594
|
expect(jqLite.data(node, "bar")).toBeUndefined();
|
|
594
595
|
|
|
595
596
|
jqLite(node).remove();
|
|
596
|
-
expect(
|
|
597
|
+
expect(CACHE.has(node[EXPANDO])).toBe(false);
|
|
597
598
|
});
|
|
598
599
|
|
|
599
600
|
it("should emit $destroy event if element removed via remove()", function () {
|
|
@@ -919,37 +920,6 @@ describe("jqLite", () => {
|
|
|
919
920
|
});
|
|
920
921
|
});
|
|
921
922
|
|
|
922
|
-
describe("prop", () => {
|
|
923
|
-
it("should read element property", () => {
|
|
924
|
-
const elm = jqLite('<div class="foo">a</div>');
|
|
925
|
-
expect(elm.prop("className")).toBe("foo");
|
|
926
|
-
});
|
|
927
|
-
|
|
928
|
-
it("should set element property to a value", () => {
|
|
929
|
-
const elm = jqLite('<div class="foo">a</div>');
|
|
930
|
-
elm.prop("className", "bar");
|
|
931
|
-
expect(elm[0].className).toBe("bar");
|
|
932
|
-
expect(elm.prop("className")).toBe("bar");
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
it("should set boolean element property", () => {
|
|
936
|
-
const elm = jqLite('<input type="checkbox">');
|
|
937
|
-
expect(elm.prop("checked")).toBe(false);
|
|
938
|
-
|
|
939
|
-
elm.prop("checked", true);
|
|
940
|
-
expect(elm.prop("checked")).toBe(true);
|
|
941
|
-
|
|
942
|
-
elm.prop("checked", "");
|
|
943
|
-
expect(elm.prop("checked")).toBe(false);
|
|
944
|
-
|
|
945
|
-
elm.prop("checked", "lala");
|
|
946
|
-
expect(elm.prop("checked")).toBe(true);
|
|
947
|
-
|
|
948
|
-
elm.prop("checked", null);
|
|
949
|
-
expect(elm.prop("checked")).toBe(false);
|
|
950
|
-
});
|
|
951
|
-
});
|
|
952
|
-
|
|
953
923
|
describe("text", () => {
|
|
954
924
|
it('should return `""` on empty', () => {
|
|
955
925
|
expect(jqLite().length).toEqual(0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInjector } from "../../src/injector";
|
|
2
|
-
import { countWatchers } from "../../src/core/
|
|
2
|
+
import { countWatchers } from "../../src/core/root-scope";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { isString } from "../../src/core/utils";
|
|
5
5
|
import { jqLite } from "../../src/jqLite";
|
package/test/ng/compile.spec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { publishExternalAPI } from "../../src/public";
|
|
2
2
|
import { createInjector } from "../../src/injector";
|
|
3
|
-
import { dealoc,
|
|
3
|
+
import { dealoc, JQLite } from "../../src/jqLite";
|
|
4
4
|
import {
|
|
5
5
|
forEach,
|
|
6
6
|
isFunction,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
extend,
|
|
11
11
|
isArray,
|
|
12
12
|
} from "../../src/core/utils";
|
|
13
|
-
import { countChildScopes, countWatchers } from "../../src/core/
|
|
13
|
+
import { countChildScopes, countWatchers } from "../../src/core/root-scope";
|
|
14
|
+
import { CACHE, EXPANDO } from "../../src/core/cache";
|
|
14
15
|
|
|
15
16
|
function isUnknownElement(el) {
|
|
16
17
|
return !!el.toString().match(/Unknown/);
|
|
@@ -930,7 +931,7 @@ describe("$compile", () => {
|
|
|
930
931
|
"<input my-directive>",
|
|
931
932
|
function (element, attrs) {
|
|
932
933
|
attrs.$set("disabled", true);
|
|
933
|
-
expect(element
|
|
934
|
+
expect(element[0]["disabled"]).toBe(true);
|
|
934
935
|
},
|
|
935
936
|
);
|
|
936
937
|
});
|
|
@@ -941,7 +942,7 @@ describe("$compile", () => {
|
|
|
941
942
|
"<input my-directive>",
|
|
942
943
|
function (element, attrs) {
|
|
943
944
|
attrs.$set("disabled", true, false);
|
|
944
|
-
expect(element
|
|
945
|
+
expect(element[0]["disabled"]).toBe(true);
|
|
945
946
|
},
|
|
946
947
|
);
|
|
947
948
|
});
|
|
@@ -16421,7 +16422,7 @@ describe("$compile", () => {
|
|
|
16421
16422
|
'<svg><a xlink:href="" ng-href="{{ testUrl }}"></a></svg>',
|
|
16422
16423
|
)($rootScope);
|
|
16423
16424
|
$rootScope.$apply();
|
|
16424
|
-
expect(element.find("a").
|
|
16425
|
+
expect(element.find("a")[0].href.baseVal).toBe(
|
|
16425
16426
|
"https://clean.example.org",
|
|
16426
16427
|
);
|
|
16427
16428
|
expect($$sanitizeUri).toHaveBeenCalledWith($rootScope.testUrl, false);
|
|
@@ -17083,15 +17084,15 @@ describe("$compile", () => {
|
|
|
17083
17084
|
|
|
17084
17085
|
$rootScope.bar = "untrusted:test1";
|
|
17085
17086
|
$rootScope.$apply();
|
|
17086
|
-
expect(element.
|
|
17087
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test1");
|
|
17087
17088
|
|
|
17088
17089
|
$rootScope.bar = $sce.trustAsCss("untrusted:test2");
|
|
17089
17090
|
$rootScope.$apply();
|
|
17090
|
-
expect(element.
|
|
17091
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test2");
|
|
17091
17092
|
|
|
17092
17093
|
$rootScope.bar = $sce.trustAsMediaUrl("untrusted:test3");
|
|
17093
17094
|
$rootScope.$apply();
|
|
17094
|
-
expect(element.
|
|
17095
|
+
expect(element[0].foo).toBe("untrusted:test3");
|
|
17095
17096
|
});
|
|
17096
17097
|
|
|
17097
17098
|
it("should enforce the specified sce type for properties added for all elements (*)", () => {
|
|
@@ -17108,15 +17109,15 @@ describe("$compile", () => {
|
|
|
17108
17109
|
|
|
17109
17110
|
$rootScope.bar = "untrusted:test1";
|
|
17110
17111
|
$rootScope.$apply();
|
|
17111
|
-
expect(element.
|
|
17112
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test1");
|
|
17112
17113
|
|
|
17113
17114
|
$rootScope.bar = $sce.trustAsCss("untrusted:test2");
|
|
17114
17115
|
$rootScope.$apply();
|
|
17115
|
-
expect(element.
|
|
17116
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test2");
|
|
17116
17117
|
|
|
17117
17118
|
$rootScope.bar = $sce.trustAsMediaUrl("untrusted:test3");
|
|
17118
17119
|
$rootScope.$apply();
|
|
17119
|
-
expect(element.
|
|
17120
|
+
expect(element[0].foo).toBe("untrusted:test3");
|
|
17120
17121
|
});
|
|
17121
17122
|
|
|
17122
17123
|
it("should enforce the specific sce type when both an element specific and generic exist", () => {
|
|
@@ -17134,15 +17135,15 @@ describe("$compile", () => {
|
|
|
17134
17135
|
|
|
17135
17136
|
$rootScope.bar = "untrusted:test1";
|
|
17136
17137
|
$rootScope.$apply();
|
|
17137
|
-
expect(element.
|
|
17138
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test1");
|
|
17138
17139
|
|
|
17139
17140
|
$rootScope.bar = $sce.trustAsCss("untrusted:test2");
|
|
17140
17141
|
$rootScope.$apply();
|
|
17141
|
-
expect(element.
|
|
17142
|
+
expect(element[0].foo).toBe("unsafe:untrusted:test2");
|
|
17142
17143
|
|
|
17143
17144
|
$rootScope.bar = $sce.trustAsMediaUrl("untrusted:test3");
|
|
17144
17145
|
$rootScope.$apply();
|
|
17145
|
-
expect(element.
|
|
17146
|
+
expect(element[0].foo).toBe("untrusted:test3");
|
|
17146
17147
|
});
|
|
17147
17148
|
});
|
|
17148
17149
|
|
|
@@ -17624,10 +17625,10 @@ describe("$compile", () => {
|
|
|
17624
17625
|
linkedElements.remove();
|
|
17625
17626
|
|
|
17626
17627
|
forEach(preCompiledChildren, (element, i) => {
|
|
17627
|
-
expect(
|
|
17628
|
+
expect(CACHE.has(element[EXPANDO])).toBe(false, `template#${i}`);
|
|
17628
17629
|
});
|
|
17629
17630
|
forEach(getAll(linkedElements), (element, i) => {
|
|
17630
|
-
expect(
|
|
17631
|
+
expect(CACHE.has(element[EXPANDO])).toBe(false, `linked#${i}`);
|
|
17631
17632
|
});
|
|
17632
17633
|
}
|
|
17633
17634
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultModelOptions } from "../../../src/directive/
|
|
1
|
+
import { defaultModelOptions } from "../../../src/directive/model-options";
|
|
2
2
|
import { dealoc, jqLite } from "../../../src/jqLite";
|
|
3
3
|
import { publishExternalAPI } from "../../../src/public";
|
|
4
4
|
import { createInjector } from "../../../src/injector";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jqLite, dealoc } from "../../../src/jqLite";
|
|
2
2
|
import { publishExternalAPI } from "../../../src/public";
|
|
3
3
|
import { createInjector } from "../../../src/injector";
|
|
4
|
-
import { NgModelController } from "../../../src/directive/
|
|
4
|
+
import { NgModelController } from "../../../src/directive/model";
|
|
5
5
|
import { isDefined, valueFn, isObject } from "../../../src/core/utils";
|
|
6
6
|
import { browserTrigger } from "../../test-utils";
|
|
7
7
|
|
|
@@ -395,7 +395,7 @@ describe("ngOptions", () => {
|
|
|
395
395
|
expect(options.eq(0)[0].getAttribute("selected")).toBe("selected");
|
|
396
396
|
expect(options.eq(0).attr("selected")).toBe("selected");
|
|
397
397
|
expect(options.eq(0)[0].selected).toBe(true);
|
|
398
|
-
expect(options.eq(0).
|
|
398
|
+
expect(options.eq(0)[0].selected).toBe(true);
|
|
399
399
|
|
|
400
400
|
scope.selected = "0000FF";
|
|
401
401
|
scope.$digest();
|
|
@@ -403,7 +403,7 @@ describe("ngOptions", () => {
|
|
|
403
403
|
expect(options.eq(1)[0].getAttribute("selected")).toBe("selected");
|
|
404
404
|
expect(options.eq(1).attr("selected")).toBe("selected");
|
|
405
405
|
expect(options.eq(1)[0].selected).toBe(true);
|
|
406
|
-
expect(options.eq(1).
|
|
406
|
+
expect(options.eq(1)[0].selected).toBe(true);
|
|
407
407
|
});
|
|
408
408
|
|
|
409
409
|
it("should render zero as a valid display value", () => {
|
|
@@ -678,17 +678,17 @@ describe("ngOptions", () => {
|
|
|
678
678
|
const options = element.find("option");
|
|
679
679
|
|
|
680
680
|
expect(scope.selected).toEqual(jasmine.objectContaining({ name: "A" }));
|
|
681
|
-
expect(options.eq(0).
|
|
682
|
-
expect(options.eq(1).
|
|
681
|
+
expect(options.eq(0)[0].selected).toBe(true);
|
|
682
|
+
expect(options.eq(1)[0].selected).toBe(false);
|
|
683
683
|
|
|
684
684
|
const optionToSelect = options.eq(1);
|
|
685
685
|
|
|
686
686
|
expect(optionToSelect.text()).toBe("B");
|
|
687
687
|
|
|
688
|
-
optionToSelect.
|
|
688
|
+
optionToSelect[0].selected = true;
|
|
689
689
|
scope.$digest();
|
|
690
690
|
|
|
691
|
-
expect(optionToSelect.
|
|
691
|
+
expect(optionToSelect[0].selected).toBe(true);
|
|
692
692
|
expect(scope.selected).toBe(scope.values[0]);
|
|
693
693
|
});
|
|
694
694
|
|
|
@@ -704,9 +704,9 @@ describe("ngOptions", () => {
|
|
|
704
704
|
});
|
|
705
705
|
|
|
706
706
|
const options = element.find("option");
|
|
707
|
-
expect(options.eq(0).
|
|
708
|
-
expect(options.eq(1).
|
|
709
|
-
expect(options.eq(2).
|
|
707
|
+
expect(options.eq(0)[0].label).toEqual("A");
|
|
708
|
+
expect(options.eq(1)[0].label).toEqual("B");
|
|
709
|
+
expect(options.eq(2)[0].label).toEqual("C");
|
|
710
710
|
});
|
|
711
711
|
|
|
712
712
|
it("should update the label if only the property has changed", () => {
|
|
@@ -720,14 +720,14 @@ describe("ngOptions", () => {
|
|
|
720
720
|
});
|
|
721
721
|
|
|
722
722
|
let options = element.find("option");
|
|
723
|
-
expect(options.eq(0).
|
|
724
|
-
expect(options.eq(1).
|
|
725
|
-
expect(options.eq(2).
|
|
723
|
+
expect(options.eq(0)[0].label).toEqual("A");
|
|
724
|
+
expect(options.eq(1)[0].label).toEqual("B");
|
|
725
|
+
expect(options.eq(2)[0].label).toEqual("C");
|
|
726
726
|
|
|
727
727
|
scope.$apply('values[0].name = "X"');
|
|
728
728
|
|
|
729
729
|
options = element.find("option");
|
|
730
|
-
expect(options.eq(0).
|
|
730
|
+
expect(options.eq(0)[0].label).toEqual("X");
|
|
731
731
|
});
|
|
732
732
|
|
|
733
733
|
// bug fix #9714
|
|
@@ -741,7 +741,7 @@ describe("ngOptions", () => {
|
|
|
741
741
|
let options = element.find("option");
|
|
742
742
|
// we expect the selected option to be the "unknown" option
|
|
743
743
|
expect(options.eq(0)).toEqualUnknownOption("");
|
|
744
|
-
expect(options.eq(0).
|
|
744
|
+
expect(options.eq(0)[0].selected).toEqual(true);
|
|
745
745
|
|
|
746
746
|
// now add some real options - one of which matches the selected value
|
|
747
747
|
scope.$apply(
|
|
@@ -890,10 +890,10 @@ describe("ngOptions", () => {
|
|
|
890
890
|
const options = element.find("option");
|
|
891
891
|
|
|
892
892
|
expect(options.length).toEqual(5);
|
|
893
|
-
expect(options.eq(1).
|
|
894
|
-
expect(options.eq(2).
|
|
895
|
-
expect(options.eq(3).
|
|
896
|
-
expect(options.eq(4).
|
|
893
|
+
expect(options.eq(1)[0].disabled).toEqual(false);
|
|
894
|
+
expect(options.eq(2)[0].disabled).toEqual(true);
|
|
895
|
+
expect(options.eq(3)[0].disabled).toEqual(false);
|
|
896
|
+
expect(options.eq(4)[0].disabled).toEqual(false);
|
|
897
897
|
});
|
|
898
898
|
|
|
899
899
|
it("should select disabled options when model changes", () => {
|
|
@@ -912,7 +912,7 @@ describe("ngOptions", () => {
|
|
|
912
912
|
// Initially the model is set to an enabled option
|
|
913
913
|
scope.$apply("selected = 30");
|
|
914
914
|
let options = element.find("option");
|
|
915
|
-
expect(options.eq(3).
|
|
915
|
+
expect(options.eq(3)[0].selected).toEqual(true);
|
|
916
916
|
|
|
917
917
|
// Now set the model to a disabled option
|
|
918
918
|
scope.$apply("selected = 1");
|
|
@@ -922,10 +922,10 @@ describe("ngOptions", () => {
|
|
|
922
922
|
// https://bugs.jquery.com/ticket/13097
|
|
923
923
|
expect(element[0].value).toBe("number:1");
|
|
924
924
|
expect(options.length).toEqual(4);
|
|
925
|
-
expect(options.eq(0).
|
|
926
|
-
expect(options.eq(1).
|
|
927
|
-
expect(options.eq(2).
|
|
928
|
-
expect(options.eq(3).
|
|
925
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
926
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
927
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
928
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
929
929
|
});
|
|
930
930
|
|
|
931
931
|
it("should select options in model when they become enabled", () => {
|
|
@@ -949,10 +949,10 @@ describe("ngOptions", () => {
|
|
|
949
949
|
// https://bugs.jquery.com/ticket/13097
|
|
950
950
|
expect(element[0].value).toBe("number:1");
|
|
951
951
|
expect(options.length).toEqual(4);
|
|
952
|
-
expect(options.eq(0).
|
|
953
|
-
expect(options.eq(1).
|
|
954
|
-
expect(options.eq(2).
|
|
955
|
-
expect(options.eq(3).
|
|
952
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
953
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
954
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
955
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
956
956
|
|
|
957
957
|
// Now enable that option
|
|
958
958
|
scope.$apply(() => {
|
|
@@ -962,8 +962,8 @@ describe("ngOptions", () => {
|
|
|
962
962
|
expect(element).toEqualSelectValue(1);
|
|
963
963
|
options = element.find("option");
|
|
964
964
|
expect(options.length).toEqual(4);
|
|
965
|
-
expect(options.eq(1).
|
|
966
|
-
expect(options.eq(3).
|
|
965
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
966
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
967
967
|
});
|
|
968
968
|
});
|
|
969
969
|
|
|
@@ -984,10 +984,10 @@ describe("ngOptions", () => {
|
|
|
984
984
|
});
|
|
985
985
|
const options = element.find("option");
|
|
986
986
|
|
|
987
|
-
expect(options.eq(0).
|
|
988
|
-
expect(options.eq(1).
|
|
989
|
-
expect(options.eq(2).
|
|
990
|
-
expect(options.eq(3).
|
|
987
|
+
expect(options.eq(0)[0].disabled).toEqual(false);
|
|
988
|
+
expect(options.eq(1)[0].disabled).toEqual(true);
|
|
989
|
+
expect(options.eq(2)[0].disabled).toEqual(false);
|
|
990
|
+
expect(options.eq(3)[0].disabled).toEqual(false);
|
|
991
991
|
});
|
|
992
992
|
|
|
993
993
|
it("should select disabled options when model changes", () => {
|
|
@@ -1007,25 +1007,25 @@ describe("ngOptions", () => {
|
|
|
1007
1007
|
// Initially the model is set to an enabled option
|
|
1008
1008
|
scope.$apply("selected = [3]");
|
|
1009
1009
|
let options = element.find("option");
|
|
1010
|
-
expect(options.eq(0).
|
|
1011
|
-
expect(options.eq(1).
|
|
1012
|
-
expect(options.eq(2).
|
|
1013
|
-
expect(options.eq(3).
|
|
1010
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
1011
|
+
expect(options.eq(1)[0].selected).toEqual(false);
|
|
1012
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
1013
|
+
expect(options.eq(3)[0].selected).toEqual(true);
|
|
1014
1014
|
|
|
1015
1015
|
// Now add a disabled option
|
|
1016
1016
|
scope.$apply("selected = [1,3]");
|
|
1017
1017
|
options = element.find("option");
|
|
1018
|
-
expect(options.eq(0).
|
|
1019
|
-
expect(options.eq(1).
|
|
1020
|
-
expect(options.eq(2).
|
|
1021
|
-
expect(options.eq(3).
|
|
1018
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
1019
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
1020
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
1021
|
+
expect(options.eq(3)[0].selected).toEqual(true);
|
|
1022
1022
|
|
|
1023
1023
|
// Now only select the disabled option
|
|
1024
1024
|
scope.$apply("selected = [1]");
|
|
1025
|
-
expect(options.eq(0).
|
|
1026
|
-
expect(options.eq(1).
|
|
1027
|
-
expect(options.eq(2).
|
|
1028
|
-
expect(options.eq(3).
|
|
1025
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
1026
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
1027
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
1028
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
1029
1029
|
});
|
|
1030
1030
|
|
|
1031
1031
|
it("should select options in model when they become enabled", () => {
|
|
@@ -1046,10 +1046,10 @@ describe("ngOptions", () => {
|
|
|
1046
1046
|
scope.$apply("selected = [1]");
|
|
1047
1047
|
let options = element.find("option");
|
|
1048
1048
|
|
|
1049
|
-
expect(options.eq(0).
|
|
1050
|
-
expect(options.eq(1).
|
|
1051
|
-
expect(options.eq(2).
|
|
1052
|
-
expect(options.eq(3).
|
|
1049
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
1050
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
1051
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
1052
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
1053
1053
|
|
|
1054
1054
|
// Now enable that option
|
|
1055
1055
|
scope.$apply(() => {
|
|
@@ -1058,10 +1058,10 @@ describe("ngOptions", () => {
|
|
|
1058
1058
|
|
|
1059
1059
|
expect(element).toEqualSelectValue([1], true);
|
|
1060
1060
|
options = element.find("option");
|
|
1061
|
-
expect(options.eq(0).
|
|
1062
|
-
expect(options.eq(1).
|
|
1063
|
-
expect(options.eq(2).
|
|
1064
|
-
expect(options.eq(3).
|
|
1061
|
+
expect(options.eq(0)[0].selected).toEqual(false);
|
|
1062
|
+
expect(options.eq(1)[0].selected).toEqual(true);
|
|
1063
|
+
expect(options.eq(2)[0].selected).toEqual(false);
|
|
1064
|
+
expect(options.eq(3)[0].selected).toEqual(false);
|
|
1065
1065
|
});
|
|
1066
1066
|
});
|
|
1067
1067
|
});
|
|
@@ -1261,7 +1261,7 @@ describe("ngOptions", () => {
|
|
|
1261
1261
|
|
|
1262
1262
|
// But the label of the selected option does not change
|
|
1263
1263
|
const option = element.find("option").eq(1);
|
|
1264
|
-
expect(option.
|
|
1264
|
+
expect(option[0].selected).toEqual(true);
|
|
1265
1265
|
expect(option.text()).toEqual("twenty"); // not 'new twenty'
|
|
1266
1266
|
});
|
|
1267
1267
|
|
|
@@ -1291,7 +1291,7 @@ describe("ngOptions", () => {
|
|
|
1291
1291
|
|
|
1292
1292
|
// But the label of the selected option does not change
|
|
1293
1293
|
const option = element.find("option").eq(1);
|
|
1294
|
-
expect(option.
|
|
1294
|
+
expect(option[0].selected).toEqual(true);
|
|
1295
1295
|
expect(option.text()).toEqual("twenty"); // not 'new twenty'
|
|
1296
1296
|
},
|
|
1297
1297
|
);
|
|
@@ -2194,7 +2194,7 @@ describe("ngOptions", () => {
|
|
|
2194
2194
|
let options = element.find("option");
|
|
2195
2195
|
|
|
2196
2196
|
expect(scope.options[1].unavailable).toEqual(true);
|
|
2197
|
-
expect(options.eq(1).
|
|
2197
|
+
expect(options.eq(1)[0].disabled).toEqual(true);
|
|
2198
2198
|
|
|
2199
2199
|
scope.$apply(() => {
|
|
2200
2200
|
scope.options[1].unavailable = false;
|
|
@@ -2203,7 +2203,7 @@ describe("ngOptions", () => {
|
|
|
2203
2203
|
options = element.find("option");
|
|
2204
2204
|
|
|
2205
2205
|
expect(scope.options[1].unavailable).toEqual(false);
|
|
2206
|
-
expect(options.eq(1).
|
|
2206
|
+
expect(options.eq(1)[0].disabled).toEqual(false);
|
|
2207
2207
|
});
|
|
2208
2208
|
|
|
2209
2209
|
it("should insert the unknown option if bound to null", () => {
|
|
@@ -2341,7 +2341,7 @@ describe("ngOptions", () => {
|
|
|
2341
2341
|
|
|
2342
2342
|
expect(element.find("option").length).toEqual(2);
|
|
2343
2343
|
expect(element).toEqualSelectValue(scope.selected);
|
|
2344
|
-
expect(element.find("option").eq(0).
|
|
2344
|
+
expect(element.find("option").eq(0)[0].selected).toBeTruthy();
|
|
2345
2345
|
});
|
|
2346
2346
|
|
|
2347
2347
|
it("should remove unknown option when empty option exists and model is undefined", () => {
|
|
@@ -2858,7 +2858,7 @@ describe("ngOptions", () => {
|
|
|
2858
2858
|
const options = element.find("option");
|
|
2859
2859
|
const optionToSelect = options.eq(0);
|
|
2860
2860
|
expect(optionToSelect.text()).toBe("Choose One");
|
|
2861
|
-
expect(optionToSelect.
|
|
2861
|
+
expect(optionToSelect[0].selected).toBe(true);
|
|
2862
2862
|
expect(element[0].value).toBe("");
|
|
2863
2863
|
|
|
2864
2864
|
dealoc(element);
|
|
@@ -2878,7 +2878,7 @@ describe("ngOptions", () => {
|
|
|
2878
2878
|
const options = element.find("option");
|
|
2879
2879
|
const optionToSelect = options.eq(0);
|
|
2880
2880
|
expect(optionToSelect.text()).toBe("Choose One");
|
|
2881
|
-
expect(optionToSelect.
|
|
2881
|
+
expect(optionToSelect[0].selected).toBe(true);
|
|
2882
2882
|
expect(element[0].value).toBe("");
|
|
2883
2883
|
|
|
2884
2884
|
dealoc(element);
|
|
@@ -3355,7 +3355,7 @@ describe("ngOptions", () => {
|
|
|
3355
3355
|
|
|
3356
3356
|
expect(element.val()).toBe("");
|
|
3357
3357
|
const emptyOption = element.find("option").eq(0);
|
|
3358
|
-
expect(emptyOption.
|
|
3358
|
+
expect(emptyOption[0].selected).toBe(true);
|
|
3359
3359
|
expect(emptyOption.val()).toBe("");
|
|
3360
3360
|
});
|
|
3361
3361
|
});
|
|
@@ -511,7 +511,7 @@ describe("select", () => {
|
|
|
511
511
|
|
|
512
512
|
scope.robot = undefined;
|
|
513
513
|
scope.$digest();
|
|
514
|
-
expect(element.find("option").eq(0).
|
|
514
|
+
expect(element.find("option").eq(0)[0].selected).toBe(true);
|
|
515
515
|
expect(element.find("option").eq(0).text()).toBe("--static-select--");
|
|
516
516
|
|
|
517
517
|
scope.dynamicOptions = [
|
|
@@ -1440,7 +1440,7 @@ describe("select", () => {
|
|
|
1440
1440
|
|
|
1441
1441
|
scope.selected = "option2";
|
|
1442
1442
|
scope.$digest();
|
|
1443
|
-
expect(element.find("option").eq(1).
|
|
1443
|
+
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1444
1444
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
1445
1445
|
});
|
|
1446
1446
|
|
|
@@ -1468,7 +1468,7 @@ describe("select", () => {
|
|
|
1468
1468
|
scope.$digest();
|
|
1469
1469
|
|
|
1470
1470
|
expect(selectCtrl.removeOption).toHaveBeenCalledWith("");
|
|
1471
|
-
expect(element.find("option").eq(1).
|
|
1471
|
+
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1472
1472
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
1473
1473
|
});
|
|
1474
1474
|
|
|
@@ -1491,7 +1491,7 @@ describe("select", () => {
|
|
|
1491
1491
|
|
|
1492
1492
|
scope.selected = "Option 2";
|
|
1493
1493
|
scope.$digest();
|
|
1494
|
-
expect(element.find("option").eq(1).
|
|
1494
|
+
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1495
1495
|
expect(element.find("option").eq(1).text()).toBe("Option 2");
|
|
1496
1496
|
});
|
|
1497
1497
|
|
|
@@ -1519,7 +1519,7 @@ describe("select", () => {
|
|
|
1519
1519
|
scope.$digest();
|
|
1520
1520
|
|
|
1521
1521
|
expect(selectCtrl.removeOption).toHaveBeenCalledWith("");
|
|
1522
|
-
expect(element.find("option").eq(1).
|
|
1522
|
+
expect(element.find("option").eq(1)[0].selected).toBe(true);
|
|
1523
1523
|
expect(element.find("option").eq(1).text()).toBe("Option 2 Changed");
|
|
1524
1524
|
});
|
|
1525
1525
|
|
|
@@ -1646,9 +1646,9 @@ describe("select", () => {
|
|
|
1646
1646
|
expect(scope.selected).toBe(null);
|
|
1647
1647
|
expect(element[0].selectedIndex).toBe(0);
|
|
1648
1648
|
expect(element.find("option").length).toBe(3);
|
|
1649
|
-
expect(element.find("option").eq(0).
|
|
1649
|
+
expect(element.find("option").eq(0)[0].selected).toBe(true);
|
|
1650
1650
|
expect(element.find("option").eq(0).val()).toBe(unknownValue(prop));
|
|
1651
|
-
expect(element.find("option").eq(1).
|
|
1651
|
+
expect(element.find("option").eq(1)[0].selected).toBe(false);
|
|
1652
1652
|
expect(element.find("option").eq(1).val()).toBe(
|
|
1653
1653
|
"string:UPDATEDVALUE",
|
|
1654
1654
|
);
|
|
@@ -1769,8 +1769,8 @@ describe("select", () => {
|
|
|
1769
1769
|
scope.selected = ["string", 1];
|
|
1770
1770
|
scope.$digest();
|
|
1771
1771
|
|
|
1772
|
-
expect(element.find("option").eq(0).
|
|
1773
|
-
expect(element.find("option").eq(2).
|
|
1772
|
+
expect(element.find("option").eq(0)[0].selected).toBe(true);
|
|
1773
|
+
expect(element.find("option").eq(2)[0].selected).toBe(true);
|
|
1774
1774
|
|
|
1775
1775
|
setSelectValue(element, 1);
|
|
1776
1776
|
expect(scope.selected).toEqual([undefined]);
|
|
@@ -1781,7 +1781,7 @@ describe("select", () => {
|
|
|
1781
1781
|
|
|
1782
1782
|
forEach(element.find("option"), (option) => {
|
|
1783
1783
|
// browserTrigger can't produce click + ctrl, so set selection manually
|
|
1784
|
-
jqLite(option).
|
|
1784
|
+
jqLite(option)[0].selected = true;
|
|
1785
1785
|
});
|
|
1786
1786
|
|
|
1787
1787
|
browserTrigger(element, "change");
|
|
@@ -1982,7 +1982,7 @@ describe("select", () => {
|
|
|
1982
1982
|
// jQuery returns null for val() when the option is disabled, see
|
|
1983
1983
|
// https://bugs.jquery.com/ticket/13097
|
|
1984
1984
|
expect(element[0].value).toBe(prop === "ngValue" ? "string:B" : "B");
|
|
1985
|
-
expect(optionElements.eq(1).
|
|
1985
|
+
expect(optionElements.eq(1)[0].selected).toBe(true);
|
|
1986
1986
|
});
|
|
1987
1987
|
|
|
1988
1988
|
it("should ignore an option with $prop that becomes enabled and does not match the model", () => {
|
|
@@ -2169,8 +2169,8 @@ describe("select", () => {
|
|
|
2169
2169
|
let optionElements = element.find("option");
|
|
2170
2170
|
expect(optionElements.length).toEqual(3);
|
|
2171
2171
|
|
|
2172
|
-
optionElements.eq(0).
|
|
2173
|
-
optionElements.eq(2).
|
|
2172
|
+
optionElements.eq(0)[0].selected = true;
|
|
2173
|
+
optionElements.eq(2)[0].selected = true;
|
|
2174
2174
|
browserTrigger(element);
|
|
2175
2175
|
|
|
2176
2176
|
optionElements = element.find("option");
|
|
@@ -2233,8 +2233,8 @@ describe("select", () => {
|
|
|
2233
2233
|
let optionElements = element.find("option");
|
|
2234
2234
|
expect(optionElements.length).toEqual(3);
|
|
2235
2235
|
|
|
2236
|
-
optionElements.eq(0).
|
|
2237
|
-
optionElements.eq(2).
|
|
2236
|
+
optionElements.eq(0)[0].selected = true;
|
|
2237
|
+
optionElements.eq(2)[0].selected = true;
|
|
2238
2238
|
browserTrigger(element, "change");
|
|
2239
2239
|
|
|
2240
2240
|
optionElements = element.find("option");
|
|
@@ -2299,9 +2299,9 @@ describe("select", () => {
|
|
|
2299
2299
|
let optionElements = element.find("option");
|
|
2300
2300
|
expect(optionElements.length).toEqual(4);
|
|
2301
2301
|
|
|
2302
|
-
optionElements.eq(0).
|
|
2303
|
-
optionElements.eq(2).
|
|
2304
|
-
optionElements.eq(3).
|
|
2302
|
+
optionElements.eq(0)[0].selected = true;
|
|
2303
|
+
optionElements.eq(2)[0].selected = true;
|
|
2304
|
+
optionElements.eq(3)[0].selected = true;
|
|
2305
2305
|
browserTrigger(element, "change");
|
|
2306
2306
|
|
|
2307
2307
|
optionElements = element.find("option");
|
|
@@ -2369,9 +2369,9 @@ describe("select", () => {
|
|
|
2369
2369
|
|
|
2370
2370
|
optionElements = element.find("option");
|
|
2371
2371
|
expect(optionElements.length).toEqual(4);
|
|
2372
|
-
expect(optionElements.eq(0).
|
|
2373
|
-
expect(optionElements.eq(2).
|
|
2374
|
-
expect(optionElements.eq(3).
|
|
2372
|
+
expect(optionElements.eq(0)[0].selected).toBe(true);
|
|
2373
|
+
expect(optionElements.eq(2)[0].selected).toBe(true);
|
|
2374
|
+
expect(optionElements.eq(3)[0].selected).toBe(true);
|
|
2375
2375
|
});
|
|
2376
2376
|
|
|
2377
2377
|
it("should select a newly added option with $prop when it matches the current model", () => {
|
|
@@ -2407,7 +2407,7 @@ describe("select", () => {
|
|
|
2407
2407
|
|
|
2408
2408
|
let optionElements = element.find("option");
|
|
2409
2409
|
expect(optionElements.length).toEqual(2);
|
|
2410
|
-
expect(optionElements.eq(1).
|
|
2410
|
+
expect(optionElements.eq(1)[0].selected).toBe(true);
|
|
2411
2411
|
|
|
2412
2412
|
scope.options.push(C);
|
|
2413
2413
|
scope.$digest();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInjector } from "../../src/injector";
|
|
2
2
|
import { publishExternalAPI } from "../../src/public";
|
|
3
|
-
import { createHttpBackend } from "../../src/services/
|
|
3
|
+
import { createHttpBackend } from "../../src/services/http-backend";
|
|
4
4
|
import sinon from "sinon";
|
|
5
5
|
|
|
6
6
|
describe("$httpBackend", () => {
|