@angular-wave/angular.ts 0.0.39 → 0.0.40
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 +2 -0
- package/README.md +1 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -1
- package/package.json +1 -1
- package/rollup.config.js +10 -5
- package/src/angular.spec.js +25 -26
- package/src/animations/animate-css-driver.js +3 -3
- package/src/animations/animate-queue.js +7 -7
- package/src/animations/animation.js +2 -2
- package/src/animations/shared.js +6 -6
- package/src/binding.spec.js +7 -7
- package/src/core/animate/animate.js +5 -5
- package/src/core/animate/animate.spec.js +31 -31
- package/src/core/cache/cache-factory.html +18 -0
- package/src/core/cache/{cache-factor.test.js → cache-factory.test.js} +1 -1
- package/src/core/compile/compile.js +31 -25
- package/src/core/compile/compile.md +2 -2
- package/src/core/cookie-reader.spec.js +2 -2
- package/src/core/core.html +22 -0
- package/src/core/core.test.js +12 -0
- package/src/core/document.spec.js +4 -4
- package/src/core/exception-handler.js +30 -23
- package/src/core/interpolate/interpolate.js +7 -0
- package/src/core/{cache/cache-factor.html → location/location.html} +1 -1
- package/src/core/location/location.js +2 -2
- package/src/core/location/location.spec.js +17 -17
- package/src/core/location/location.test.js +12 -0
- package/src/core/on.spec.js +3 -3
- package/src/core/parser/parse.html +18 -0
- package/src/core/parser/parse.spec.js +1 -1
- package/src/core/parser/parse.test.js +12 -0
- package/src/core/prop.spec.js +3 -4
- package/src/core/pubsub/pubsub.html +18 -0
- package/src/core/pubsub/pubsub.spec.js +1 -1
- package/src/core/pubsub/pubsub.test.js +12 -0
- package/src/core/q/q.html +18 -0
- package/src/core/q/q.js +33 -0
- package/src/core/q/q.test.js +0 -0
- package/src/core/root-element.spec.js +4 -4
- package/src/core/sanitize/sanitize-uri.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.test.js +12 -0
- package/src/core/sanitize/sanitize.html +21 -0
- package/src/core/sce/sce.html +18 -0
- package/src/core/sce/sce.spec.js +2 -1
- package/src/core/sce/sce.test.js +12 -0
- package/src/core/scope/scope.html +18 -0
- package/src/core/scope/scope.js +1 -1
- package/src/core/scope/scope.spec.js +1 -1
- package/src/core/scope/scope.test.js +12 -0
- package/src/core/task-tracker-factory.js +9 -11
- package/src/core/timeout/timeout.html +18 -0
- package/src/core/timeout/timeout.js +9 -0
- package/src/core/timeout/timeout.spec.js +2 -2
- package/src/core/timeout/timout.test.js +12 -0
- package/src/core/url-utils/url-utils.html +18 -0
- package/src/core/url-utils/url-utils.spec.js +4 -2
- package/src/core/url-utils/url-utils.test.js +12 -0
- package/src/directive/attrs/attrs.spec.js +1 -2
- package/src/directive/attrs/boolean.spec.js +1 -2
- package/src/directive/attrs/element-style.spec.js +6 -7
- package/src/directive/attrs/src.spec.js +1 -2
- package/src/directive/bind/bind.spec.js +1 -2
- package/src/directive/class/class.spec.js +15 -16
- package/src/directive/cloak/cloak.spec.js +3 -4
- package/src/directive/controller/controller.spec.js +4 -5
- package/src/directive/events/click.spec.js +1 -2
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +7 -0
- package/src/directive/form/form.spec.js +17 -17
- package/src/directive/if/if.spec.js +2 -2
- package/src/directive/include/include.js +2 -2
- package/src/directive/include/include.spec.js +32 -32
- package/src/directive/init/init.spec.js +2 -3
- package/src/directive/input/input.spec.js +3 -3
- package/src/directive/list/list.spec.js +1 -2
- package/src/directive/model/model.js +13 -0
- package/src/directive/model/model.spec.js +4 -5
- package/src/directive/model-options/model-options.spec.js +3 -3
- package/src/directive/non-bindable/non-bindable.spec.js +1 -2
- package/src/directive/options/options.js +5 -5
- package/src/directive/options/options.spec.js +13 -13
- package/src/directive/ref/href.spec.js +1 -2
- package/src/directive/repeat/repeat.spec.js +12 -12
- package/src/directive/script/script.spec.js +2 -3
- package/src/directive/select/select.js +6 -6
- package/src/directive/select/select.spec.js +5 -5
- package/src/directive/show-hide/show-hide.spec.js +12 -13
- package/src/directive/style/style.spec.js +3 -4
- package/src/directive/switch/switch.spec.js +2 -3
- package/src/directive/validators/validators.spec.js +1 -1
- package/src/exts/aria/aria.spec.js +1 -2
- package/src/exts/messages/messages.spec.js +5 -5
- package/src/filters/filter.spec.js +5 -5
- package/src/filters/filters.html +21 -0
- package/src/filters/filters.spec.js +3 -3
- package/src/filters/filters.test.js +12 -0
- package/src/filters/limit-to.md +1 -1
- package/src/filters/limit-to.spec.js +4 -4
- package/src/filters/order-by.spec.js +2 -2
- package/src/index.js +186 -31
- package/src/loader.js +49 -11
- package/src/public.js +2 -3
- package/src/router/directives/state-directives.spec.js +90 -90
- package/src/router/directives/view-directive.js +2 -2
- package/src/router/directives/view-directive.spec.js +9 -9
- package/src/router/state/state.spec.js +2 -4
- package/src/router/template-factory.spec.js +2 -2
- package/src/router/transition/hook-registry.js +2 -2
- package/src/router/view/view.spec.js +1 -1
- package/src/services/browser.js +56 -39
- package/src/services/document.js +16 -13
- package/src/services/log.js +39 -43
- package/src/services/template-request.js +9 -0
- package/src/shared/common.js +0 -3
- package/src/shared/jqlite/jqlite.js +83 -89
- package/src/shared/jqlite/jqlite.spec.js +218 -222
- package/src/shared/strings.js +2 -2
- package/src/shared/test-utils.js +2 -2
- package/src/shared/utils.js +8 -11
- package/types/animations/shared.d.ts +1 -1
- package/types/core/exception-handler.d.ts +9 -42
- package/types/core/interpolate/interpolate.d.ts +1 -1
- package/types/core/q/q.d.ts +35 -1
- package/types/core/task-tracker-factory.d.ts +18 -11
- package/types/core/timeout/timeout.d.ts +10 -1
- package/types/directive/model/model.d.ts +28 -4
- package/types/index.d.ts +664 -79
- package/types/services/browser.d.ts +50 -20
- package/types/services/document.d.ts +13 -9
- package/types/services/log.d.ts +37 -34
- package/types/services/template-request.d.ts +1 -1
- package/types/shared/common.d.ts +0 -1
- package/types/shared/jqlite/jqlite.d.ts +6 -7
- package/types/shared/utils.d.ts +22 -22
- package/types-back/index.d.ts +1 -75
- /package/src/core/cache/{cache-factor.spec.js → cache-factory.spec.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JQLite } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
3
|
import { publishExternalAPI } from "../../public";
|
|
4
4
|
import { browserTrigger, wait } from "../../shared/test-utils";
|
|
@@ -64,7 +64,7 @@ describe("ngStateRef", () => {
|
|
|
64
64
|
describe("links with promises", () => {
|
|
65
65
|
it("should update the href when promises on parameters change before scope is applied", async () => {
|
|
66
66
|
const defer = $q.defer();
|
|
67
|
-
el =
|
|
67
|
+
el = JQLite(
|
|
68
68
|
'<a ng-sref="contacts.item.detail({ id: contact.id })">Details</a>',
|
|
69
69
|
);
|
|
70
70
|
defer.promise.then((val) => {
|
|
@@ -80,10 +80,10 @@ describe("ngStateRef", () => {
|
|
|
80
80
|
|
|
81
81
|
function buildDOM() {
|
|
82
82
|
window.location.hash = "#";
|
|
83
|
-
el =
|
|
83
|
+
el = JQLite(
|
|
84
84
|
'<a ng-sref="contacts.item.detail({ id: contact.id })">Details</a>',
|
|
85
85
|
);
|
|
86
|
-
el2 =
|
|
86
|
+
el2 = JQLite('<a ng-sref="top">Top</a>');
|
|
87
87
|
scope = $rootScope;
|
|
88
88
|
scope.contact = { id: 5 };
|
|
89
89
|
scope.$apply();
|
|
@@ -110,7 +110,7 @@ describe("ngStateRef", () => {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
it("should allow multi-line attribute values", async () => {
|
|
113
|
-
el =
|
|
113
|
+
el = JQLite(
|
|
114
114
|
'<a ng-sref="contacts.item.detail({\n\tid: $index\n})">Details</a>',
|
|
115
115
|
);
|
|
116
116
|
$rootScope.$index = 3;
|
|
@@ -129,7 +129,7 @@ describe("ngStateRef", () => {
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
it("should not transition states when ctrl-clicked", async () => {
|
|
132
|
-
|
|
132
|
+
JQLite(el)[0].dispatchEvent(
|
|
133
133
|
new MouseEvent("click", {
|
|
134
134
|
ctrlKey: true,
|
|
135
135
|
bubbles: true,
|
|
@@ -143,13 +143,13 @@ describe("ngStateRef", () => {
|
|
|
143
143
|
|
|
144
144
|
// TODO investigate further why this fails
|
|
145
145
|
xit("should not transition states when meta-clicked", async () => {
|
|
146
|
-
|
|
146
|
+
JQLite(el)[0].dispatchEvent(new MouseEvent("click", { metaKey: true }));
|
|
147
147
|
expect($state.current.name).toEqual("");
|
|
148
148
|
expect($stateParams.id).toBeUndefined();
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
it("should not transition states when shift-clicked", async () => {
|
|
152
|
-
|
|
152
|
+
JQLite(el)[0].dispatchEvent(new MouseEvent("click", { shiftKey: true }));
|
|
153
153
|
expect($state.current.name).toEqual("top");
|
|
154
154
|
expect($stateParams.id).toBeUndefined();
|
|
155
155
|
});
|
|
@@ -158,7 +158,7 @@ describe("ngStateRef", () => {
|
|
|
158
158
|
xit("should not transition states when alt-clicked", async () => {
|
|
159
159
|
expect($state.current.name).toEqual("");
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
JQLite(el)[0].dispatchEvent(new MouseEvent("click", { altKey: true }));
|
|
162
162
|
expect($state.current.name).toEqual("top");
|
|
163
163
|
expect($stateParams.id).toBeUndefined();
|
|
164
164
|
});
|
|
@@ -166,7 +166,7 @@ describe("ngStateRef", () => {
|
|
|
166
166
|
it("should not transition states when alt-clicked", async () => {
|
|
167
167
|
expect($state.current.name).toEqual("top");
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
JQLite(el)[0].dispatchEvent(new MouseEvent("click", { button: 1 }));
|
|
170
170
|
expect($state.current.name).toEqual("top");
|
|
171
171
|
expect($stateParams.id).toBeUndefined();
|
|
172
172
|
});
|
|
@@ -195,7 +195,7 @@ describe("ngStateRef", () => {
|
|
|
195
195
|
$rootScope.$index = "def";
|
|
196
196
|
$rootScope.$digest();
|
|
197
197
|
|
|
198
|
-
el =
|
|
198
|
+
el = JQLite('<a ng-sref="{id: $index}">Details</a>');
|
|
199
199
|
$compile(el)($rootScope);
|
|
200
200
|
$rootScope.$digest();
|
|
201
201
|
|
|
@@ -227,7 +227,7 @@ describe("ngStateRef", () => {
|
|
|
227
227
|
$state.go("contacts.item.detail", { id: "123" });
|
|
228
228
|
$rootScope.$digest();
|
|
229
229
|
|
|
230
|
-
el =
|
|
230
|
+
el = JQLite('<a ng-sref="{\n\tid: $index\n}">Details</a>');
|
|
231
231
|
$rootScope.$index = 3;
|
|
232
232
|
$rootScope.$apply();
|
|
233
233
|
|
|
@@ -237,20 +237,20 @@ describe("ngStateRef", () => {
|
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
it("should take an object as a parameter and update properly on digest churns", async () => {
|
|
240
|
-
el =
|
|
240
|
+
el = JQLite(
|
|
241
241
|
'<div><a ng-sref="contacts.item.detail(urlParams)">Contacts</a></div>',
|
|
242
242
|
);
|
|
243
243
|
template = $compile(el)($rootScope);
|
|
244
244
|
|
|
245
245
|
$rootScope.urlParams = { id: 1 };
|
|
246
246
|
$rootScope.$digest();
|
|
247
|
-
expect(
|
|
247
|
+
expect(JQLite(template[0].querySelector("a")).attr("href")).toBe(
|
|
248
248
|
"#/contacts/1",
|
|
249
249
|
);
|
|
250
250
|
|
|
251
251
|
$rootScope.urlParams.id = 2;
|
|
252
252
|
$rootScope.$digest();
|
|
253
|
-
expect(
|
|
253
|
+
expect(JQLite(template[0].querySelector("a")).attr("href")).toBe(
|
|
254
254
|
"#/contacts/2",
|
|
255
255
|
);
|
|
256
256
|
});
|
|
@@ -293,7 +293,7 @@ describe("ngStateRef", () => {
|
|
|
293
293
|
let template;
|
|
294
294
|
|
|
295
295
|
beforeEach(() => {
|
|
296
|
-
el =
|
|
296
|
+
el = JQLite(
|
|
297
297
|
'<a ng-sref-active="active" ng-sref-active-eq="activeeq" ng-state="state" ng-state-params="params">state</a>',
|
|
298
298
|
);
|
|
299
299
|
scope = $rootScope;
|
|
@@ -303,20 +303,20 @@ describe("ngStateRef", () => {
|
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
it("sets the correct initial href", () => {
|
|
306
|
-
expect(
|
|
306
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
307
307
|
});
|
|
308
308
|
|
|
309
309
|
it("updates to the new href", () => {
|
|
310
|
-
expect(
|
|
310
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
311
311
|
|
|
312
312
|
scope.state = "contacts.item";
|
|
313
313
|
scope.params = { id: 5 };
|
|
314
314
|
scope.$digest();
|
|
315
|
-
expect(
|
|
315
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/5");
|
|
316
316
|
|
|
317
317
|
scope.params.id = 25;
|
|
318
318
|
scope.$digest();
|
|
319
|
-
expect(
|
|
319
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/25");
|
|
320
320
|
});
|
|
321
321
|
|
|
322
322
|
it("updates a linked ng-sref-active", async () => {
|
|
@@ -355,11 +355,11 @@ describe("ngStateRef", () => {
|
|
|
355
355
|
});
|
|
356
356
|
|
|
357
357
|
it("updates to a new href when it points to a new state", () => {
|
|
358
|
-
expect(
|
|
358
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
359
359
|
scope.state = "other";
|
|
360
360
|
scope.params = { id: "123" };
|
|
361
361
|
scope.$digest();
|
|
362
|
-
expect(
|
|
362
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/other/123");
|
|
363
363
|
});
|
|
364
364
|
|
|
365
365
|
it("should allow passing params to current state using empty ng-state", async () => {
|
|
@@ -367,7 +367,7 @@ describe("ngStateRef", () => {
|
|
|
367
367
|
$rootScope.$index = "def";
|
|
368
368
|
$rootScope.$digest();
|
|
369
369
|
|
|
370
|
-
el =
|
|
370
|
+
el = JQLite('<a ng-state="" ng-state-params="{id: $index}">Details</a>');
|
|
371
371
|
$compile(el)($rootScope);
|
|
372
372
|
|
|
373
373
|
expect($state.current.name).toBe("other");
|
|
@@ -397,32 +397,32 @@ describe("ngStateRef", () => {
|
|
|
397
397
|
});
|
|
398
398
|
|
|
399
399
|
it("retains the old href if the new points to a non-state", () => {
|
|
400
|
-
expect(
|
|
400
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
401
401
|
scope.state = "nostate";
|
|
402
402
|
scope.$digest();
|
|
403
|
-
expect(
|
|
403
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts");
|
|
404
404
|
});
|
|
405
405
|
|
|
406
406
|
it("accepts param overrides", () => {
|
|
407
407
|
scope.state = "contacts.item";
|
|
408
408
|
scope.params = { id: 10 };
|
|
409
409
|
scope.$digest();
|
|
410
|
-
expect(
|
|
410
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
411
411
|
});
|
|
412
412
|
|
|
413
413
|
it("accepts param overrides", () => {
|
|
414
414
|
scope.state = "contacts.item";
|
|
415
415
|
scope.params = { id: 10 };
|
|
416
416
|
scope.$digest();
|
|
417
|
-
expect(
|
|
417
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
418
418
|
|
|
419
419
|
scope.params.id = 22;
|
|
420
420
|
scope.$digest();
|
|
421
|
-
expect(
|
|
421
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/22");
|
|
422
422
|
});
|
|
423
423
|
|
|
424
424
|
it("watches attributes", () => {
|
|
425
|
-
el =
|
|
425
|
+
el = JQLite(
|
|
426
426
|
'<a ng-state="{{exprvar}}" ng-state-params="params">state</a>',
|
|
427
427
|
);
|
|
428
428
|
template = $compile(el)(scope);
|
|
@@ -432,33 +432,33 @@ describe("ngStateRef", () => {
|
|
|
432
432
|
scope.state2 = "other";
|
|
433
433
|
scope.params = { id: 10 };
|
|
434
434
|
scope.$digest();
|
|
435
|
-
expect(
|
|
435
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
436
436
|
|
|
437
437
|
scope.exprvar = "state2";
|
|
438
438
|
scope.$digest();
|
|
439
|
-
expect(
|
|
439
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/other/10");
|
|
440
440
|
});
|
|
441
441
|
|
|
442
442
|
it("allows one-time-binding on ng1.3+", () => {
|
|
443
|
-
el =
|
|
443
|
+
el = JQLite('<a ng-state="::state" ng-state-params="::params">state</a>');
|
|
444
444
|
|
|
445
445
|
scope.state = "contacts.item";
|
|
446
446
|
scope.params = { id: 10 };
|
|
447
447
|
template = $compile(el)(scope);
|
|
448
448
|
scope.$digest();
|
|
449
|
-
expect(
|
|
449
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
450
450
|
|
|
451
451
|
scope.state = "other";
|
|
452
452
|
scope.params = { id: 22 };
|
|
453
453
|
|
|
454
454
|
scope.$digest();
|
|
455
|
-
expect(
|
|
455
|
+
expect(JQLite(template[0]).attr("href")).toBe("#/contacts/10");
|
|
456
456
|
});
|
|
457
457
|
|
|
458
458
|
it("accepts option overrides", async () => {
|
|
459
459
|
let transitionOptions;
|
|
460
460
|
|
|
461
|
-
el =
|
|
461
|
+
el = JQLite('<a ng-state="state" ng-state-opts="opts">state</a>');
|
|
462
462
|
scope.state = "contacts";
|
|
463
463
|
scope.opts = { reload: true };
|
|
464
464
|
template = $compile(el)(scope);
|
|
@@ -480,7 +480,7 @@ describe("ngStateRef", () => {
|
|
|
480
480
|
it("should bind click event by default", async () => {
|
|
481
481
|
expect($state.current.name).toBe("top");
|
|
482
482
|
|
|
483
|
-
el =
|
|
483
|
+
el = JQLite('<a ng-state="state"></a>');
|
|
484
484
|
|
|
485
485
|
scope.state = "contacts";
|
|
486
486
|
$compile(el)(scope);
|
|
@@ -493,7 +493,7 @@ describe("ngStateRef", () => {
|
|
|
493
493
|
it("should bind single HTML events", async () => {
|
|
494
494
|
expect($state.current.name).toEqual("top");
|
|
495
495
|
|
|
496
|
-
el =
|
|
496
|
+
el = JQLite(
|
|
497
497
|
'<input type="text" ng-state="state" ng-state-opts="{ events: [\'change\'] }">',
|
|
498
498
|
);
|
|
499
499
|
|
|
@@ -510,7 +510,7 @@ describe("ngStateRef", () => {
|
|
|
510
510
|
it("should bind multiple HTML events", async () => {
|
|
511
511
|
expect($state.current.name).toEqual("top");
|
|
512
512
|
|
|
513
|
-
el =
|
|
513
|
+
el = JQLite(
|
|
514
514
|
'<input type="text" ng-state="state" ng-state-opts="{ events: [\'change\', \'blur\'] }">',
|
|
515
515
|
);
|
|
516
516
|
|
|
@@ -536,7 +536,7 @@ describe("ngStateRef", () => {
|
|
|
536
536
|
it("should bind multiple Mouse events", async () => {
|
|
537
537
|
expect($state.current.name).toEqual("top");
|
|
538
538
|
|
|
539
|
-
el =
|
|
539
|
+
el = JQLite(
|
|
540
540
|
"<a ng-state=\"state\" ng-state-opts=\"{ events: ['mouseover', 'mousedown'] }\">",
|
|
541
541
|
);
|
|
542
542
|
|
|
@@ -564,7 +564,7 @@ describe("ngStateRef", () => {
|
|
|
564
564
|
let el, scope;
|
|
565
565
|
|
|
566
566
|
beforeEach(() => {
|
|
567
|
-
el =
|
|
567
|
+
el = JQLite(
|
|
568
568
|
'<form ng-sref="contacts.item.detail({ id: contact.id })"></form>',
|
|
569
569
|
);
|
|
570
570
|
scope = $rootScope;
|
|
@@ -583,12 +583,12 @@ describe("ngStateRef", () => {
|
|
|
583
583
|
describe("relative transitions", () => {
|
|
584
584
|
beforeEach(() => {
|
|
585
585
|
$state.transitionTo("contacts.item", { id: 5 });
|
|
586
|
-
el =
|
|
586
|
+
el = JQLite('<a ng-sref=".detail">Details</a>');
|
|
587
587
|
scope = $rootScope;
|
|
588
588
|
scope.$apply();
|
|
589
589
|
|
|
590
590
|
$compile(el)(scope);
|
|
591
|
-
template = $compile(
|
|
591
|
+
template = $compile(JQLite("<div><ng-view></ng-view><div>"))(scope);
|
|
592
592
|
scope.$digest();
|
|
593
593
|
});
|
|
594
594
|
|
|
@@ -603,21 +603,21 @@ describe("ngStateRef", () => {
|
|
|
603
603
|
xit("should resolve states from parent ngView", async () => {
|
|
604
604
|
$state.transitionTo("contacts");
|
|
605
605
|
await wait(500);
|
|
606
|
-
const parentToChild =
|
|
606
|
+
const parentToChild = JQLite(template[0].querySelector("a.item"));
|
|
607
607
|
browserTrigger(parentToChild, "click");
|
|
608
608
|
await wait(100);
|
|
609
609
|
|
|
610
610
|
expect($state.$current.name).toBe("contacts.item");
|
|
611
611
|
|
|
612
|
-
const childToGrandchild =
|
|
612
|
+
const childToGrandchild = JQLite(
|
|
613
613
|
template[0].querySelector("a.item-detail"),
|
|
614
614
|
);
|
|
615
|
-
const childToParent =
|
|
615
|
+
const childToParent = JQLite(template[0].querySelector("a.item-parent"));
|
|
616
616
|
|
|
617
617
|
browserTrigger(childToGrandchild, "click");
|
|
618
618
|
await wait(100);
|
|
619
619
|
|
|
620
|
-
const grandchildToParent =
|
|
620
|
+
const grandchildToParent = JQLite(
|
|
621
621
|
template[0].querySelector("a.item-parent2"),
|
|
622
622
|
);
|
|
623
623
|
expect($state.$current.name).toBe("contacts.item.detail");
|
|
@@ -637,7 +637,7 @@ describe("ngStateRef", () => {
|
|
|
637
637
|
describe("option event", () => {
|
|
638
638
|
beforeEach(() => (window.location.hash = ""));
|
|
639
639
|
it("should bind click event by default", async () => {
|
|
640
|
-
el =
|
|
640
|
+
el = JQLite('<a ng-sref="contacts"></a>');
|
|
641
641
|
$compile(el)($rootScope);
|
|
642
642
|
|
|
643
643
|
expect($state.current.name).toEqual("top");
|
|
@@ -649,7 +649,7 @@ describe("ngStateRef", () => {
|
|
|
649
649
|
});
|
|
650
650
|
|
|
651
651
|
it("should bind single HTML events", async () => {
|
|
652
|
-
el =
|
|
652
|
+
el = JQLite(
|
|
653
653
|
'<input type="text" ng-sref="contacts" ng-sref-opts="{ events: [\'change\'] }">',
|
|
654
654
|
);
|
|
655
655
|
$compile(el)($rootScope);
|
|
@@ -662,7 +662,7 @@ describe("ngStateRef", () => {
|
|
|
662
662
|
});
|
|
663
663
|
|
|
664
664
|
it("should bind multiple HTML events", async () => {
|
|
665
|
-
el =
|
|
665
|
+
el = JQLite(
|
|
666
666
|
'<input type="text" ng-sref="contacts" ng-sref-opts="{ events: [\'change\', \'blur\'] }">',
|
|
667
667
|
);
|
|
668
668
|
$compile(el)($rootScope);
|
|
@@ -684,7 +684,7 @@ describe("ngStateRef", () => {
|
|
|
684
684
|
});
|
|
685
685
|
|
|
686
686
|
it("should bind multiple Mouse events", async () => {
|
|
687
|
-
el =
|
|
687
|
+
el = JQLite(
|
|
688
688
|
"<a ng-sref=\"contacts\" ng-sref-opts=\"{ events: ['mouseover', 'mousedown'] }\">",
|
|
689
689
|
);
|
|
690
690
|
$compile(el)($rootScope);
|
|
@@ -770,102 +770,102 @@ describe("ngSrefActive", () => {
|
|
|
770
770
|
});
|
|
771
771
|
|
|
772
772
|
it("should update class for sibling ngSref", async () => {
|
|
773
|
-
el =
|
|
773
|
+
el = JQLite(
|
|
774
774
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active">Contacts</a><a ng-sref="contacts.item({ id: 2 })" ng-sref-active="active">Contacts</a></div>',
|
|
775
775
|
);
|
|
776
776
|
template = $compile(el)($rootScope);
|
|
777
777
|
$rootScope.$digest();
|
|
778
778
|
|
|
779
|
-
expect(
|
|
779
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
780
780
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
781
781
|
await wait(100);
|
|
782
|
-
expect(
|
|
782
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
783
783
|
|
|
784
784
|
$state.transitionTo("contacts.item", { id: 2 });
|
|
785
785
|
await wait(100);
|
|
786
|
-
expect(
|
|
786
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
787
787
|
});
|
|
788
788
|
|
|
789
789
|
it("should match state's parameters", async () => {
|
|
790
|
-
el =
|
|
790
|
+
el = JQLite(
|
|
791
791
|
'<div><a ng-sref="contacts.item.detail({ foo: \'bar\' })" ng-sref-active="active">Contacts</a></div>',
|
|
792
792
|
);
|
|
793
793
|
template = $compile(el)($rootScope);
|
|
794
794
|
$rootScope.$digest();
|
|
795
795
|
|
|
796
|
-
expect(
|
|
796
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
797
797
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
798
798
|
await wait(100);
|
|
799
|
-
expect(
|
|
799
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
800
800
|
|
|
801
801
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "baz" });
|
|
802
802
|
await wait(100);
|
|
803
|
-
expect(
|
|
803
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
804
804
|
});
|
|
805
805
|
|
|
806
806
|
// Test for #2696
|
|
807
807
|
it("should compare using typed parameters", async () => {
|
|
808
|
-
el =
|
|
808
|
+
el = JQLite(
|
|
809
809
|
'<div><a ng-sref="arrayparam({ foo: [1,2,3] })" ng-sref-active="active">foo 123</a></div>',
|
|
810
810
|
);
|
|
811
811
|
template = $compile(el)($rootScope);
|
|
812
812
|
$rootScope.$digest();
|
|
813
813
|
|
|
814
|
-
expect(
|
|
814
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
815
815
|
|
|
816
816
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
817
817
|
await wait(100);
|
|
818
|
-
expect(
|
|
818
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
819
819
|
|
|
820
820
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3], bar: "asdf" });
|
|
821
821
|
await wait(100);
|
|
822
|
-
expect(
|
|
822
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
823
823
|
|
|
824
824
|
$state.transitionTo("arrayparam", { foo: [1, 2] });
|
|
825
825
|
await wait(100);
|
|
826
|
-
expect(
|
|
826
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
827
827
|
});
|
|
828
828
|
|
|
829
829
|
// Test for #3154
|
|
830
830
|
it("should compare ng-sref-active-eq using typed parameters", async () => {
|
|
831
|
-
el =
|
|
831
|
+
el = JQLite(
|
|
832
832
|
'<div><a ng-sref="arrayparam({ foo: [1,2,3] })" ng-sref-active-eq="active">foo 123</a></div>',
|
|
833
833
|
);
|
|
834
834
|
template = $compile(el)($rootScope);
|
|
835
835
|
$rootScope.$digest();
|
|
836
836
|
|
|
837
|
-
expect(
|
|
837
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
838
838
|
|
|
839
839
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3] });
|
|
840
840
|
await wait(100);
|
|
841
|
-
expect(
|
|
841
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
842
842
|
|
|
843
843
|
$state.transitionTo("arrayparam", { foo: [1, 2, 3], bar: "asdf" });
|
|
844
844
|
await wait(100);
|
|
845
|
-
expect(
|
|
845
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
846
846
|
|
|
847
847
|
$state.transitionTo("arrayparam", { foo: [1, 2] });
|
|
848
848
|
await wait(100);
|
|
849
|
-
expect(
|
|
849
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
850
850
|
});
|
|
851
851
|
|
|
852
852
|
it("should update in response to ng-sref param expression changes", async () => {
|
|
853
|
-
el =
|
|
853
|
+
el = JQLite(
|
|
854
854
|
'<div><a ng-sref="contacts.item.detail({ foo: fooId })" ng-sref-active="active">Contacts</a></div>',
|
|
855
855
|
);
|
|
856
856
|
template = $compile(el)($rootScope);
|
|
857
857
|
$rootScope.fooId = "bar";
|
|
858
858
|
$rootScope.$digest();
|
|
859
859
|
|
|
860
|
-
expect(
|
|
860
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
861
861
|
$state.transitionTo("contacts.item.detail", { id: 5, foo: "bar" });
|
|
862
862
|
await wait(100);
|
|
863
|
-
expect(
|
|
863
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
864
864
|
|
|
865
865
|
$rootScope.fooId = "baz";
|
|
866
866
|
$rootScope.$digest();
|
|
867
867
|
await wait(100);
|
|
868
|
-
expect(
|
|
868
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
869
869
|
});
|
|
870
870
|
|
|
871
871
|
it("should match on child states", async () => {
|
|
@@ -873,7 +873,7 @@ describe("ngSrefActive", () => {
|
|
|
873
873
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active">Contacts</a></div>',
|
|
874
874
|
)($rootScope);
|
|
875
875
|
$rootScope.$digest();
|
|
876
|
-
const a =
|
|
876
|
+
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
877
877
|
|
|
878
878
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
879
879
|
await wait(100);
|
|
@@ -891,7 +891,7 @@ describe("ngSrefActive", () => {
|
|
|
891
891
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active-eq="active">Contacts</a></div>',
|
|
892
892
|
)($rootScope);
|
|
893
893
|
$rootScope.$digest();
|
|
894
|
-
const a =
|
|
894
|
+
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
895
895
|
|
|
896
896
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
897
897
|
await wait(100);
|
|
@@ -907,7 +907,7 @@ describe("ngSrefActive", () => {
|
|
|
907
907
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active" ng-sref-active-eq="active-eq">Contacts</a></div>',
|
|
908
908
|
)($rootScope);
|
|
909
909
|
$rootScope.$digest();
|
|
910
|
-
const a =
|
|
910
|
+
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
911
911
|
|
|
912
912
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
913
913
|
await wait(100);
|
|
@@ -921,45 +921,45 @@ describe("ngSrefActive", () => {
|
|
|
921
921
|
});
|
|
922
922
|
|
|
923
923
|
it("should resolve relative state refs", async () => {
|
|
924
|
-
el =
|
|
924
|
+
el = JQLite("<section><div ng-view></div></section>");
|
|
925
925
|
template = $compile(el)($rootScope);
|
|
926
926
|
$rootScope.$digest();
|
|
927
927
|
|
|
928
928
|
$state.transitionTo("contacts");
|
|
929
929
|
await wait(100);
|
|
930
930
|
expect(
|
|
931
|
-
|
|
931
|
+
JQLite(template[0].querySelector("a")).attr("class"),
|
|
932
932
|
).toBeUndefined();
|
|
933
933
|
|
|
934
934
|
$state.transitionTo("contacts.item", { id: 6 });
|
|
935
935
|
await wait(100);
|
|
936
|
-
expect(
|
|
936
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
937
937
|
|
|
938
938
|
$state.transitionTo("contacts.item", { id: 5 });
|
|
939
939
|
await wait(100);
|
|
940
|
-
expect(
|
|
940
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("");
|
|
941
941
|
});
|
|
942
942
|
|
|
943
943
|
it("should match on any child state refs", async () => {
|
|
944
|
-
el =
|
|
944
|
+
el = JQLite(
|
|
945
945
|
'<div ng-sref-active="active"><a ng-sref="contacts.item({ id: 1 })">Contacts</a><a ng-sref="contacts.item({ id: 2 })">Contacts</a></div>',
|
|
946
946
|
);
|
|
947
947
|
template = $compile(el)($rootScope);
|
|
948
948
|
$rootScope.$digest();
|
|
949
949
|
|
|
950
|
-
expect(
|
|
950
|
+
expect(JQLite(template[0]).attr("class")).toBeUndefined();
|
|
951
951
|
|
|
952
952
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
953
953
|
await wait(100);
|
|
954
|
-
expect(
|
|
954
|
+
expect(JQLite(template[0]).attr("class")).toBe("active");
|
|
955
955
|
|
|
956
956
|
$state.transitionTo("contacts.item", { id: 2 });
|
|
957
957
|
await wait(100);
|
|
958
|
-
expect(
|
|
958
|
+
expect(JQLite(template[0]).attr("class")).toBe("active");
|
|
959
959
|
});
|
|
960
960
|
|
|
961
961
|
it("should match fuzzy on lazy loaded states", async () => {
|
|
962
|
-
el =
|
|
962
|
+
el = JQLite(
|
|
963
963
|
'<div><a ng-sref="contacts.lazy" ng-sref-active="active">Lazy Contact</a></div>',
|
|
964
964
|
);
|
|
965
965
|
template = $compile(el)($rootScope);
|
|
@@ -974,15 +974,15 @@ describe("ngSrefActive", () => {
|
|
|
974
974
|
|
|
975
975
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
976
976
|
await wait(100);
|
|
977
|
-
expect(
|
|
977
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
978
978
|
|
|
979
979
|
$state.transitionTo("contacts.lazy");
|
|
980
980
|
await wait(100);
|
|
981
|
-
expect(
|
|
981
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
982
982
|
});
|
|
983
983
|
|
|
984
984
|
it("should match exactly on lazy loaded states", async () => {
|
|
985
|
-
el =
|
|
985
|
+
el = JQLite(
|
|
986
986
|
'<div><a ng-sref="contacts.lazy" ng-sref-active-eq="active">Lazy Contact</a></div>',
|
|
987
987
|
);
|
|
988
988
|
template = $compile(el)($rootScope);
|
|
@@ -997,11 +997,11 @@ describe("ngSrefActive", () => {
|
|
|
997
997
|
|
|
998
998
|
$state.transitionTo("contacts.item", { id: 1 });
|
|
999
999
|
await wait(100);
|
|
1000
|
-
expect(
|
|
1000
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBeFalsy();
|
|
1001
1001
|
|
|
1002
1002
|
$state.transitionTo("contacts.lazy");
|
|
1003
1003
|
await wait(100);
|
|
1004
|
-
expect(
|
|
1004
|
+
expect(JQLite(template[0].querySelector("a")).attr("class")).toBe("active");
|
|
1005
1005
|
});
|
|
1006
1006
|
|
|
1007
1007
|
it("should allow multiple classes to be supplied", async () => {
|
|
@@ -1009,7 +1009,7 @@ describe("ngSrefActive", () => {
|
|
|
1009
1009
|
'<div><a ng-sref="contacts.item({ id: 1 })" ng-sref-active="active also-active">Contacts</a></div>',
|
|
1010
1010
|
)($rootScope);
|
|
1011
1011
|
$rootScope.$digest();
|
|
1012
|
-
const a =
|
|
1012
|
+
const a = JQLite(template[0].getElementsByTagName("a")[0]);
|
|
1013
1013
|
|
|
1014
1014
|
$state.transitionTo("contacts.item.edit", { id: 1 });
|
|
1015
1015
|
await wait(100);
|
|
@@ -5,7 +5,7 @@ import { parse } from "../../shared/hof";
|
|
|
5
5
|
import { ResolveContext } from "../resolve/resolve-context";
|
|
6
6
|
import { trace } from "../common/trace";
|
|
7
7
|
import { Ng1ViewConfig } from "../state/views";
|
|
8
|
-
import {
|
|
8
|
+
import { JQLite } from "../../shared/jqlite/jqlite";
|
|
9
9
|
import { getLocals } from "../state/state-registry";
|
|
10
10
|
/**
|
|
11
11
|
* `ui-view`: A viewport directive which is filled in by a view from the active state.
|
|
@@ -376,7 +376,7 @@ export function $ViewDirectiveFill(
|
|
|
376
376
|
.filter((el) => el && el.tagName && tagRegexp.exec(el.tagName));
|
|
377
377
|
return (
|
|
378
378
|
directiveEl &&
|
|
379
|
-
|
|
379
|
+
JQLite(directiveEl).data(`$${cfg.component}Controller`)
|
|
380
380
|
);
|
|
381
381
|
};
|
|
382
382
|
const deregisterWatch = scope.$watch(
|