@angular-wave/angular.ts 0.0.30 → 0.0.33

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.
Files changed (55) hide show
  1. package/dist/angular-ts.esm.js +1 -1
  2. package/dist/angular-ts.umd.js +1 -1
  3. package/index.html +5 -14
  4. package/package.json +1 -1
  5. package/src/core/compile.js +5 -4
  6. package/src/core/location.js +1 -1
  7. package/src/core/parser/parse.js +1 -2
  8. package/src/core/root-scope.js +49 -99
  9. package/src/directive/events.js +2 -1
  10. package/src/directive/model.js +4 -2
  11. package/src/router/directives/state-directives.js +33 -18
  12. package/src/router/directives/view-directive.js +1 -2
  13. package/src/router/globals.js +2 -0
  14. package/src/router/hooks/url.js +4 -4
  15. package/src/router/index.js +23 -27
  16. package/src/router/injectables.js +1 -52
  17. package/src/router/services.js +6 -84
  18. package/src/router/state/state-builder.js +7 -6
  19. package/src/router/state/state-queue-manager.js +2 -1
  20. package/src/router/state/state-registry.js +39 -21
  21. package/src/router/state/state-service.js +173 -6
  22. package/src/router/state/views.js +46 -2
  23. package/src/router/transition/reject-factory.js +0 -8
  24. package/src/router/transition/transition-service.js +43 -1
  25. package/src/router/url/url-config.js +32 -1
  26. package/src/router/url/url-rule.js +4 -4
  27. package/src/router/url/url-service.js +161 -14
  28. package/src/router/view/view.js +7 -51
  29. package/src/services/http.js +1 -1
  30. package/src/shared/common.js +1 -1
  31. package/src/shared/strings.js +7 -2
  32. package/test/core/compile.spec.js +2 -2
  33. package/test/core/scope.spec.js +2 -37
  34. package/test/router/services.spec.js +14 -31
  35. package/test/router/state-directives.spec.js +2 -2
  36. package/test/router/state-filter.spec.js +0 -2
  37. package/test/router/state.spec.js +4 -4
  38. package/test/router/template-factory.spec.js +19 -10
  39. package/test/router/{url-matcher-factory.spec.js → url-service.spec.js} +126 -132
  40. package/test/router/view-directive.spec.js +9 -9
  41. package/test/router/view-hook.spec.js +10 -10
  42. package/test/router/view.spec.js +4 -11
  43. package/types/router/core/params/interface.d.ts +2 -2
  44. package/types/router/core/url/urlMatcherFactory.d.ts +1 -1
  45. package/legacy/angular-animate.js +0 -4272
  46. package/legacy/angular-aria.js +0 -426
  47. package/legacy/angular-message-format.js +0 -1072
  48. package/legacy/angular-messages.js +0 -829
  49. package/legacy/angular-route.js +0 -1266
  50. package/legacy/angular-sanitize.js +0 -891
  51. package/legacy/angular.js +0 -36600
  52. package/src/router/router.js +0 -125
  53. package/src/router/url/url-matcher-factory.js +0 -76
  54. package/src/router/url/url-router.js +0 -101
  55. package/test/original-test.html +0 -33
@@ -1,11 +1,9 @@
1
- import { dealoc, jqLite } from "../../src/jqLite";
1
+ import { dealoc } from "../../src/jqLite";
2
2
  import { Angular } from "../../src/loader";
3
3
  import { publishExternalAPI } from "../../src/public";
4
4
  import { map, find } from "../../src/shared/common";
5
5
 
6
6
  describe("UrlMatcher", () => {
7
- let router;
8
- let $umf;
9
7
  let $url;
10
8
  let $injector;
11
9
  let $location;
@@ -19,57 +17,53 @@ describe("UrlMatcher", () => {
19
17
  "defaultModule",
20
18
  ]);
21
19
 
22
- $injector.invoke(
23
- ($router, $urlMatcherFactory, $urlService, _$location_) => {
24
- router = $router;
25
- $umf = $urlMatcherFactory;
26
- $url = $urlService;
27
- $location = _$location_;
28
- },
29
- );
20
+ $injector.invoke(($urlService, _$location_) => {
21
+ $url = $urlService;
22
+ $location = _$location_;
23
+ });
30
24
  });
31
25
 
32
26
  describe("provider", () => {
33
27
  it("should factory matchers with correct configuration", () => {
34
- $umf.caseInsensitive(false);
35
- expect($umf.compile("/hello").exec("/HELLO")).toBeNull();
28
+ $url.config.caseInsensitive(false);
29
+ expect($url.compile("/hello").exec("/HELLO")).toBeNull();
36
30
 
37
- $umf.caseInsensitive(true);
38
- expect($umf.compile("/hello").exec("/HELLO")).toEqual({});
31
+ $url.config.caseInsensitive(true);
32
+ expect($url.compile("/hello").exec("/HELLO")).toEqual({});
39
33
 
40
- $umf.strictMode(true);
41
- expect($umf.compile("/hello").exec("/hello/")).toBeNull();
34
+ $url.config.strictMode(true);
35
+ expect($url.compile("/hello").exec("/hello/")).toBeNull();
42
36
 
43
- $umf.strictMode(false);
44
- expect($umf.compile("/hello").exec("/hello/")).toEqual({});
37
+ $url.config.strictMode(false);
38
+ expect($url.compile("/hello").exec("/hello/")).toEqual({});
45
39
  });
46
40
 
47
41
  it("should correctly validate UrlMatcher interface", () => {
48
- let m = $umf.compile("/");
49
- expect($umf.isMatcher(m)).toBe(true);
42
+ let m = $url.compile("/");
43
+ expect($url.isMatcher(m)).toBe(true);
50
44
  });
51
45
  });
52
46
 
53
47
  it("should match static URLs", () => {
54
- expect($umf.compile("/hello/world").exec("/hello/world")).toEqual({});
48
+ expect($url.compile("/hello/world").exec("/hello/world")).toEqual({});
55
49
  });
56
50
 
57
51
  it("should match static case insensitive URLs", () => {
58
52
  expect(
59
- $umf
53
+ $url
60
54
  .compile("/hello/world", { caseInsensitive: true })
61
55
  .exec("/heLLo/World"),
62
56
  ).toEqual({});
63
57
  });
64
58
 
65
59
  it("should match against the entire path", () => {
66
- const matcher = $umf.compile("/hello/world", { strict: true });
60
+ const matcher = $url.compile("/hello/world", { strict: true });
67
61
  expect(matcher.exec("/hello/world/")).toBeNull();
68
62
  expect(matcher.exec("/hello/world/suffix")).toBeNull();
69
63
  });
70
64
 
71
65
  it("should parse parameter placeholders", () => {
72
- const matcher = $umf.compile(
66
+ const matcher = $url.compile(
73
67
  "/users/:id/details/{type}/{repeat:[0-9]+}?from&to",
74
68
  );
75
69
  expect(matcher.parameters().map((x) => x.id)).toEqual([
@@ -82,14 +76,14 @@ describe("UrlMatcher", () => {
82
76
  });
83
77
 
84
78
  it("should encode and decode duplicate query string values as array", () => {
85
- const matcher = $umf.compile("/?foo"),
79
+ const matcher = $url.compile("/?foo"),
86
80
  array = { foo: ["bar", "baz"] };
87
81
  expect(matcher.exec("/", array)).toEqual(array);
88
82
  expect(matcher.format(array)).toBe("/?foo=bar&foo=baz");
89
83
  });
90
84
 
91
85
  it("should encode and decode slashes in parameter values as ~2F", () => {
92
- const matcher1 = $umf.compile("/:foo");
86
+ const matcher1 = $url.compile("/:foo");
93
87
 
94
88
  expect(matcher1.format({ foo: "/" })).toBe("/~2F");
95
89
  expect(matcher1.format({ foo: "//" })).toBe("/~2F~2F");
@@ -103,7 +97,7 @@ describe("UrlMatcher", () => {
103
97
  expect(matcher1.exec("/123~2F").foo).toBe("123/");
104
98
 
105
99
  // param :foo should match between two slashes
106
- const matcher2 = $umf.compile("/:foo/");
100
+ const matcher2 = $url.compile("/:foo/");
107
101
 
108
102
  expect(matcher2.exec("/")).not.toBeTruthy();
109
103
  expect(matcher2.exec("//")).toBeTruthy();
@@ -115,7 +109,7 @@ describe("UrlMatcher", () => {
115
109
  });
116
110
 
117
111
  it("should encode and decode tildes in parameter values as ~~", () => {
118
- const matcher1 = $umf.compile("/:foo");
112
+ const matcher1 = $url.compile("/:foo");
119
113
 
120
114
  expect(matcher1.format({ foo: "abc" })).toBe("/abc");
121
115
  expect(matcher1.format({ foo: "~abc" })).toBe("/~~abc");
@@ -128,7 +122,7 @@ describe("UrlMatcher", () => {
128
122
 
129
123
  describe("snake-case parameters", () => {
130
124
  it("should match if properly formatted", () => {
131
- const matcher = $umf.compile(
125
+ const matcher = $url.compile(
132
126
  "/users/?from&to&snake-case&snake-case-triple",
133
127
  );
134
128
  expect(matcher.parameters().map((x) => x.id)).toEqual([
@@ -143,20 +137,20 @@ describe("UrlMatcher", () => {
143
137
  let err =
144
138
  "Invalid parameter name '-snake' in pattern '/users/?from&to&-snake'";
145
139
  expect(() => {
146
- $umf.compile("/users/?from&to&-snake");
140
+ $url.compile("/users/?from&to&-snake");
147
141
  }).toThrowError(err);
148
142
 
149
143
  err =
150
144
  "Invalid parameter name 'snake-' in pattern '/users/?from&to&snake-'";
151
145
  expect(() => {
152
- $umf.compile("/users/?from&to&snake-");
146
+ $url.compile("/users/?from&to&snake-");
153
147
  }).toThrowError(err);
154
148
  });
155
149
  });
156
150
 
157
151
  describe("parameters containing periods", () => {
158
152
  it("should match if properly formatted", () => {
159
- const matcher = $umf.compile(
153
+ const matcher = $url.compile(
160
154
  "/users/?from&to&with.periods&with.periods.also",
161
155
  );
162
156
  const params = matcher.parameters().map(function (p) {
@@ -176,21 +170,21 @@ describe("UrlMatcher", () => {
176
170
  "Invalid parameter name '.periods' in pattern '/users/?from&to&.periods'",
177
171
  );
178
172
  expect(() => {
179
- $umf.compile("/users/?from&to&.periods");
173
+ $url.compile("/users/?from&to&.periods");
180
174
  }).toThrow(err);
181
175
 
182
176
  err = new Error(
183
177
  "Invalid parameter name 'periods.' in pattern '/users/?from&to&periods.'",
184
178
  );
185
179
  expect(() => {
186
- $umf.compile("/users/?from&to&periods.");
180
+ $url.compile("/users/?from&to&periods.");
187
181
  }).toThrow(err);
188
182
  });
189
183
  });
190
184
 
191
185
  describe(".exec()", () => {
192
186
  it("should capture parameter values", () => {
193
- const m = $umf.compile(
187
+ const m = $url.compile(
194
188
  "/users/:id/details/{type}/{repeat:[0-9]+}?from&to",
195
189
  { strict: false },
196
190
  );
@@ -204,13 +198,13 @@ describe("UrlMatcher", () => {
204
198
  });
205
199
 
206
200
  it("should capture catch-all parameters", () => {
207
- const m = $umf.compile("/document/*path");
201
+ const m = $url.compile("/document/*path");
208
202
  expect(m.exec("/document/a/b/c", {})).toEqual({ path: "a/b/c" });
209
203
  expect(m.exec("/document/", {})).toEqual({ path: "" });
210
204
  });
211
205
 
212
206
  it("should use the optional regexp with curly brace placeholders", () => {
213
- const m = $umf.compile(
207
+ const m = $url.compile(
214
208
  "/users/:id/details/{type}/{repeat:[0-9]+}?from&to",
215
209
  );
216
210
  expect(
@@ -219,26 +213,26 @@ describe("UrlMatcher", () => {
219
213
  });
220
214
 
221
215
  it("should not use optional regexp for '/'", () => {
222
- const m = $umf.compile("/{language:(?:fr|en|de)}");
216
+ const m = $url.compile("/{language:(?:fr|en|de)}");
223
217
  expect(m.exec("/", {})).toBeNull();
224
218
  });
225
219
 
226
220
  it("should work with empty default value", () => {
227
- const m = $umf.compile("/foo/:str", {
221
+ const m = $url.compile("/foo/:str", {
228
222
  state: { params: { str: { value: "" } } },
229
223
  });
230
224
  expect(m.exec("/foo/", {})).toEqual({ str: "" });
231
225
  });
232
226
 
233
227
  it("should work with empty default value for regex", () => {
234
- const m = $umf.compile("/foo/{param:(?:foo|bar|)}", {
228
+ const m = $url.compile("/foo/{param:(?:foo|bar|)}", {
235
229
  state: { params: { param: { value: "" } } },
236
230
  });
237
231
  expect(m.exec("/foo/", {})).toEqual({ param: "" });
238
232
  });
239
233
 
240
234
  it("should treat the URL as already decoded and does not decode it further", () => {
241
- expect($umf.compile("/users/:id").exec("/users/100%25", {})).toEqual({
235
+ expect($url.compile("/users/:id").exec("/users/100%25", {})).toEqual({
242
236
  id: "100%25",
243
237
  });
244
238
  });
@@ -252,7 +246,7 @@ describe("UrlMatcher", () => {
252
246
  };
253
247
 
254
248
  angular.forEach(shouldPass, function (url, route) {
255
- expect($umf.compile(route).exec(url, {})).toEqual({
249
+ expect($url.compile(route).exec(url, {})).toEqual({
256
250
  childParam: "childParam",
257
251
  matchedParam: "someword",
258
252
  });
@@ -269,7 +263,7 @@ describe("UrlMatcher", () => {
269
263
 
270
264
  angular.forEach(shouldThrow, function (url, route) {
271
265
  expect(() => {
272
- $umf.compile(route).exec(url, {});
266
+ $url.compile(route).exec(url, {});
273
267
  }).toThrowError("Unbalanced capture group in route '" + route + "'");
274
268
  });
275
269
 
@@ -282,7 +276,7 @@ describe("UrlMatcher", () => {
282
276
 
283
277
  angular.forEach(shouldPass, function (url, route) {
284
278
  expect(() => {
285
- $umf.compile(route).exec(url, {});
279
+ $url.compile(route).exec(url, {});
286
280
  }).not.toThrow();
287
281
  });
288
282
  });
@@ -290,7 +284,7 @@ describe("UrlMatcher", () => {
290
284
 
291
285
  describe(".format()", () => {
292
286
  it("should reconstitute the URL", () => {
293
- const m = $umf.compile("/users/:id/details/{type}/{repeat:[0-9]+}?from"),
287
+ const m = $url.compile("/users/:id/details/{type}/{repeat:[0-9]+}?from"),
294
288
  params = {
295
289
  id: "123",
296
290
  type: "default",
@@ -305,13 +299,13 @@ describe("UrlMatcher", () => {
305
299
  });
306
300
 
307
301
  it("should encode URL parameters", () => {
308
- expect($umf.compile("/users/:id").format({ id: "100%" })).toEqual(
302
+ expect($url.compile("/users/:id").format({ id: "100%" })).toEqual(
309
303
  "/users/100%25",
310
304
  );
311
305
  });
312
306
 
313
307
  it("encodes URL parameters with hashes", () => {
314
- const m = $umf.compile("/users/:id#:section");
308
+ const m = $url.compile("/users/:id#:section");
315
309
  expect(m.format({ id: "bob", section: "contact-details" })).toEqual(
316
310
  "/users/bob#contact-details",
317
311
  );
@@ -321,16 +315,16 @@ describe("UrlMatcher", () => {
321
315
  const config = {
322
316
  state: { params: { id: { squash: true, value: "123" } } },
323
317
  },
324
- m = $umf.compile("/users/:id", config),
318
+ m = $url.compile("/users/:id", config),
325
319
  params = { id: "123" };
326
320
 
327
321
  expect(m.format(params)).toEqual("/users");
328
322
  });
329
323
 
330
324
  it("should format query parameters from parent, child, grandchild matchers", () => {
331
- const m = $umf.compile("/parent?qParent");
332
- const m2 = m.append($umf.compile("/child?qChild"));
333
- const m3 = m2.append($umf.compile("/grandchild?qGrandchild"));
325
+ const m = $url.compile("/parent?qParent");
326
+ const m2 = m.append($url.compile("/child?qChild"));
327
+ const m3 = m2.append($url.compile("/grandchild?qGrandchild"));
334
328
 
335
329
  const params = {
336
330
  qParent: "parent",
@@ -348,9 +342,9 @@ describe("UrlMatcher", () => {
348
342
 
349
343
  describe(".append()", () => {
350
344
  it("should append matchers", () => {
351
- const matcher = $umf
345
+ const matcher = $url
352
346
  .compile("/users/:id/details/{type}?from")
353
- .append($umf.compile("/{repeat:[0-9]+}?to"));
347
+ .append($url.compile("/{repeat:[0-9]+}?to"));
354
348
  const params = matcher.parameters();
355
349
  expect(params.map((x) => x.id)).toEqual([
356
350
  "id",
@@ -362,37 +356,37 @@ describe("UrlMatcher", () => {
362
356
  });
363
357
 
364
358
  it("should return a new matcher", () => {
365
- const base = $umf.compile("/users/:id/details/{type}?from");
366
- const matcher = base.append($umf.compile("/{repeat:[0-9]+}?to"));
359
+ const base = $url.compile("/users/:id/details/{type}?from");
360
+ const matcher = base.append($url.compile("/{repeat:[0-9]+}?to"));
367
361
  expect(matcher).not.toBe(base);
368
362
  });
369
363
 
370
- it("should respect $urlMatcherFactoryProvider.strictMode", () => {
371
- let m = $umf.compile("/");
372
- $umf.strictMode(false);
373
- m = m.append($umf.compile("foo"));
364
+ it("should respect $urlServiceProvider.strictMode", () => {
365
+ let m = $url.compile("/");
366
+ $url.config.strictMode(false);
367
+ m = m.append($url.compile("foo"));
374
368
  expect(m.exec("/foo")).toEqual({});
375
369
  expect(m.exec("/foo/")).toEqual({});
376
370
  });
377
371
 
378
- it("should respect $urlMatcherFactoryProvider.caseInsensitive", () => {
379
- let m = $umf.compile("/");
380
- $umf.caseInsensitive(true);
381
- m = m.append($umf.compile("foo"));
372
+ it("should respect $urlServiceProvider.caseInsensitive", () => {
373
+ let m = $url.compile("/");
374
+ $url.config.caseInsensitive(true);
375
+ m = m.append($url.compile("foo"));
382
376
  expect(m.exec("/foo")).toEqual({});
383
377
  expect(m.exec("/FOO")).toEqual({});
384
378
  });
385
379
 
386
- it("should respect $urlMatcherFactoryProvider.caseInsensitive when validating regex params", () => {
387
- let m = $umf.compile("/");
388
- $umf.caseInsensitive(true);
389
- m = m.append($umf.compile("foo/{param:bar}"));
380
+ it("should respect $urlServiceProvider.caseInsensitive when validating regex params", () => {
381
+ let m = $url.compile("/");
382
+ $url.config.caseInsensitive(true);
383
+ m = m.append($url.compile("foo/{param:bar}"));
390
384
  expect(m.validates({ param: "BAR" })).toEqual(true);
391
385
  });
392
386
 
393
387
  it("should generate/match params in the proper order", () => {
394
- let m = $umf.compile("/foo?queryparam");
395
- m = m.append($umf.compile("/bar/:pathparam"));
388
+ let m = $url.compile("/foo?queryparam");
389
+ m = m.append($url.compile("/bar/:pathparam"));
396
390
  expect(m.exec("/foo/bar/pathval", { queryparam: "queryval" })).toEqual({
397
391
  pathparam: "pathval",
398
392
  queryparam: "queryval",
@@ -402,14 +396,14 @@ describe("UrlMatcher", () => {
402
396
 
403
397
  describe("multivalue-query-parameters", () => {
404
398
  it("should handle .is() for an array of values", () => {
405
- const m = $umf.compile("/foo?{param1:int}"),
399
+ const m = $url.compile("/foo?{param1:int}"),
406
400
  param = m.parameter("param1");
407
401
  expect(param.type.is([1, 2, 3])).toBe(true);
408
402
  expect(param.type.is([1, "2", 3])).toBe(false);
409
403
  });
410
404
 
411
405
  it("should handle .equals() for two arrays of values", () => {
412
- const m = $umf.compile("/foo?{param1:int}&{param2:date}"),
406
+ const m = $url.compile("/foo?{param1:int}&{param2:date}"),
413
407
  param1 = m.parameter("param1"),
414
408
  param2 = m.parameter("param2");
415
409
 
@@ -430,7 +424,7 @@ describe("UrlMatcher", () => {
430
424
  });
431
425
 
432
426
  it("should conditionally be wrapped in an array by default", () => {
433
- const m = $umf.compile("/foo?param1");
427
+ const m = $url.compile("/foo?param1");
434
428
 
435
429
  // empty array [] is treated like "undefined"
436
430
  expect(m.format({ param1: undefined })).toBe("/foo");
@@ -472,7 +466,7 @@ describe("UrlMatcher", () => {
472
466
  });
473
467
 
474
468
  it("should be wrapped in an array if array: true", () => {
475
- const m = $umf.compile("/foo?param1", {
469
+ const m = $url.compile("/foo?param1", {
476
470
  state: { params: { param1: { array: true } } },
477
471
  });
478
472
 
@@ -516,7 +510,7 @@ describe("UrlMatcher", () => {
516
510
  });
517
511
 
518
512
  it("should be wrapped in an array if paramname looks like param[]", () => {
519
- const m = $umf.compile("/foo?param1[]");
513
+ const m = $url.compile("/foo?param1[]");
520
514
  expect(m.exec("/foo")).toEqual({ "param1[]": undefined });
521
515
 
522
516
  $url.url("/foo?param1[]=bar");
@@ -539,7 +533,7 @@ describe("UrlMatcher", () => {
539
533
 
540
534
  // Test for issue #2222
541
535
  it("should return default value, if query param is missing.", () => {
542
- const m = $umf.compile("/state?param1&param2&param3&param5", {
536
+ const m = $url.compile("/state?param1&param2&param3&param5", {
543
537
  state: {
544
538
  params: {
545
539
  param1: "value1",
@@ -577,7 +571,7 @@ describe("UrlMatcher", () => {
577
571
  });
578
572
 
579
573
  it("should not be wrapped by ui-router into an array if array: false", () => {
580
- const m = $umf.compile("/foo?param1", {
574
+ const m = $url.compile("/foo?param1", {
581
575
  state: { params: { param1: { array: false } } },
582
576
  });
583
577
  expect(m.exec("/foo")).toEqual({ param1: undefined });
@@ -601,7 +595,7 @@ describe("UrlMatcher", () => {
601
595
 
602
596
  describe("multivalue-path-parameters", () => {
603
597
  it("should behave as a single-value by default", () => {
604
- const m = $umf.compile("/foo/:param1");
598
+ const m = $url.compile("/foo/:param1");
605
599
 
606
600
  expect(m.exec("/foo/")).toEqual({ param1: "" });
607
601
 
@@ -611,7 +605,7 @@ describe("UrlMatcher", () => {
611
605
  });
612
606
 
613
607
  it("should be split on - in url and wrapped in an array if array: true", () => {
614
- const m = $umf.compile("/foo/:param1", {
608
+ const m = $url.compile("/foo/:param1", {
615
609
  state: { params: { param1: { array: true } } },
616
610
  });
617
611
 
@@ -626,7 +620,7 @@ describe("UrlMatcher", () => {
626
620
  });
627
621
 
628
622
  it("should behave similar to multi-value query params", () => {
629
- const m = $umf.compile("/foo/:param1[]");
623
+ const m = $url.compile("/foo/:param1[]");
630
624
 
631
625
  // empty array [] is treated like "undefined"
632
626
  expect(m.format({ "param1[]": undefined })).toBe("/foo/");
@@ -662,7 +656,7 @@ describe("UrlMatcher", () => {
662
656
  });
663
657
 
664
658
  it("should be split on - in url and wrapped in an array if paramname looks like param[]", () => {
665
- const m = $umf.compile("/foo/:param1[]");
659
+ const m = $url.compile("/foo/:param1[]");
666
660
 
667
661
  expect(m.exec("/foo/")).toEqual({ "param1[]": undefined });
668
662
  expect(m.exec("/foo/bar")).toEqual({ "param1[]": ["bar"] });
@@ -674,7 +668,7 @@ describe("UrlMatcher", () => {
674
668
  });
675
669
 
676
670
  it("should allow path param arrays with '-' in the values", () => {
677
- const m = $umf.compile("/foo/:param1[]");
671
+ const m = $url.compile("/foo/:param1[]");
678
672
 
679
673
  expect(m.exec("/foo/")).toEqual({ "param1[]": undefined });
680
674
  expect(m.exec("/foo/bar\\-")).toEqual({ "param1[]": ["bar-"] });
@@ -714,11 +708,11 @@ describe("UrlMatcher", () => {
714
708
 
715
709
  // describe("urlMatcherFactoryProvider", ( ) => {
716
710
  // describe(".type()", ( ) => {
717
- // let $umf;
711
+ // let $url;
718
712
  // beforeEach(
719
- // module("ng.router.util", function ($urlMatcherFactoryProvider) {
720
- // $umf = $urlMatcherFactoryProvider;
721
- // $urlMatcherFactoryProvider.type("myType", {}, ( ) => {
713
+ // module("ng.router.util", function ($urlServiceProvider) {
714
+ // $url = $urlServiceProvider;
715
+ // $urlServiceProvider.type("myType", {}, ( ) => {
722
716
  // return {
723
717
  // decode: ( ) => {
724
718
  // return { status: "decoded" };
@@ -732,7 +726,7 @@ describe("UrlMatcher", () => {
732
726
  // it("should handle arrays properly with config-time custom type definitions", function (
733
727
  // $stateParams,
734
728
  // ) {
735
- // const m = $umf.compile("/test?{foo:myType}");
729
+ // const m = $url.compile("/test?{foo:myType}");
736
730
  // expect(m.exec("/test", { foo: "1" })).toEqual({
737
731
  // foo: { status: "decoded" },
738
732
  // });
@@ -749,21 +743,21 @@ describe("UrlMatcher", () => {
749
743
  // });
750
744
 
751
745
  // describe("urlMatcherFactory", ( ) => {
752
- // let $umf;
746
+ // let $url;
753
747
  // let $url;
754
748
 
755
749
  // beforeEach(function ($urlMatcherFactory, $urlService) {
756
- // $umf = $urlMatcherFactory;
750
+ // $url = $urlMatcherFactory;
757
751
  // $url = $urlService;
758
752
  // });
759
753
 
760
754
  // it("compiles patterns", ( ) => {
761
- // const matcher = $umf.compile("/hello/world");
755
+ // const matcher = $url.compile("/hello/world");
762
756
  // expect(matcher instanceof UrlMatcher).toBe(true);
763
757
  // });
764
758
 
765
759
  // it("recognizes matchers", ( ) => {
766
- // expect($umf.isMatcher($umf.compile("/"))).toBe(true);
760
+ // expect($url.isMatcher($url.compile("/"))).toBe(true);
767
761
 
768
762
  // const custom = {
769
763
  // format: angular.noop,
@@ -775,49 +769,49 @@ describe("UrlMatcher", () => {
775
769
  // parameter: angular.noop,
776
770
  // _getDecodedParamValue: angular.noop,
777
771
  // };
778
- // expect($umf.isMatcher(custom)).toBe(true);
772
+ // expect($url.isMatcher(custom)).toBe(true);
779
773
  // });
780
774
 
781
775
  // it("should handle case sensitive URL by default", ( ) => {
782
- // expect($umf.compile("/hello/world").exec("/heLLo/WORLD")).toBeNull();
776
+ // expect($url.compile("/hello/world").exec("/heLLo/WORLD")).toBeNull();
783
777
  // });
784
778
 
785
779
  // it("should handle case insensitive URL", ( ) => {
786
- // $umf.caseInsensitive(true);
787
- // expect($umf.compile("/hello/world").exec("/heLLo/WORLD")).toEqual({});
780
+ // $url.config.caseInsensitive(true);
781
+ // expect($url.compile("/hello/world").exec("/heLLo/WORLD")).toEqual({});
788
782
  // });
789
783
 
790
784
  // describe("typed parameters", ( ) => {
791
785
  // it("should accept object definitions", ( ) => {
792
786
  // const type = { encode: ( ) => {}, decode: ( ) => {} };
793
- // $umf.type("myType1", type);
794
- // expect($umf.type("myType1").encode).toBe(type.encode);
787
+ // $url.type("myType1", type);
788
+ // expect($url.type("myType1").encode).toBe(type.encode);
795
789
  // });
796
790
 
797
791
  // it("should reject duplicate definitions", ( ) => {
798
- // $umf.type("myType2", { encode: ( ) => {}, decode: ( ) => {} });
792
+ // $url.type("myType2", { encode: ( ) => {}, decode: ( ) => {} });
799
793
  // expect(( ) => {
800
- // $umf.type("myType2", {});
794
+ // $url.type("myType2", {});
801
795
  // }).toThrowError("A type named 'myType2' has already been defined.");
802
796
  // });
803
797
 
804
798
  // it("should accept injected function definitions", function (
805
799
  // $stateParams,
806
800
  // ) {
807
- // $umf.type("myType3", {}, function ($stateParams) {
801
+ // $url.type("myType3", {}, function ($stateParams) {
808
802
  // return {
809
803
  // decode: ( ) => {
810
804
  // return $stateParams;
811
805
  // },
812
806
  // };
813
807
  // });
814
- // expect($umf.type("myType3").decode()).toBe($stateParams);
808
+ // expect($url.type("myType3").decode()).toBe($stateParams);
815
809
  // });
816
810
 
817
811
  // it("should accept annotated function definitions", function (
818
812
  // $stateParams,
819
813
  // ) {
820
- // $umf.type("myAnnotatedType", {}, [
814
+ // $url.type("myAnnotatedType", {}, [
821
815
  // "$stateParams",
822
816
  // function (s) {
823
817
  // return {
@@ -827,11 +821,11 @@ describe("UrlMatcher", () => {
827
821
  // };
828
822
  // },
829
823
  // ]);
830
- // expect($umf.type("myAnnotatedType").decode()).toBe($stateParams);
824
+ // expect($url.type("myAnnotatedType").decode()).toBe($stateParams);
831
825
  // });
832
826
 
833
827
  // it("should match built-in types", ( ) => {
834
- // const m = $umf.compile("/{foo:int}/{flag:bool}");
828
+ // const m = $url.compile("/{foo:int}/{flag:bool}");
835
829
  // expect(m.exec("/1138/1")).toEqual({ foo: 1138, flag: true });
836
830
  // expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
837
831
 
@@ -840,13 +834,13 @@ describe("UrlMatcher", () => {
840
834
  // });
841
835
 
842
836
  // it("should match built-in types with spaces", ( ) => {
843
- // const m = $umf.compile("/{foo: int}/{flag: bool}");
837
+ // const m = $url.compile("/{foo: int}/{flag: bool}");
844
838
  // expect(m.exec("/1138/1")).toEqual({ foo: 1138, flag: true });
845
839
  // expect(m.format({ foo: 5, flag: true })).toBe("/5/1");
846
840
  // });
847
841
 
848
842
  // it("should match types named only in params", ( ) => {
849
- // const m = $umf.compile("/{foo}/{flag}", {
843
+ // const m = $url.compile("/{foo}/{flag}", {
850
844
  // state: {
851
845
  // params: {
852
846
  // foo: { type: "int" },
@@ -860,7 +854,7 @@ describe("UrlMatcher", () => {
860
854
 
861
855
  // it("should throw an error if a param type is declared twice", ( ) => {
862
856
  // expect(( ) => {
863
- // $umf.compile("/{foo:int}", {
857
+ // $url.compile("/{foo:int}", {
864
858
  // state: {
865
859
  // params: {
866
860
  // foo: { type: "int" },
@@ -871,7 +865,7 @@ describe("UrlMatcher", () => {
871
865
  // });
872
866
 
873
867
  // it("should encode/decode dates", ( ) => {
874
- // const m = $umf.compile("/calendar/{date:date}"),
868
+ // const m = $url.compile("/calendar/{date:date}"),
875
869
  // result = m.exec("/calendar/2014-03-26");
876
870
  // const date = new Date(2014, 2, 26);
877
871
 
@@ -881,7 +875,7 @@ describe("UrlMatcher", () => {
881
875
  // });
882
876
 
883
877
  // it("should encode/decode arbitrary objects to json", ( ) => {
884
- // const m = $umf.compile("/state/{param1:json}/{param2:json}");
878
+ // const m = $url.compile("/state/{param1:json}/{param2:json}");
885
879
 
886
880
  // const params = {
887
881
  // param1: { foo: "huh", count: 3 },
@@ -898,7 +892,7 @@ describe("UrlMatcher", () => {
898
892
  // });
899
893
 
900
894
  // it("should not match invalid typed parameter values", ( ) => {
901
- // const m = $umf.compile("/users/{id:int}");
895
+ // const m = $url.compile("/users/{id:int}");
902
896
 
903
897
  // expect(m.exec("/users/1138").id).toBe(1138);
904
898
  // expect(m.exec("/users/alpha")).toBeNull();
@@ -908,7 +902,7 @@ describe("UrlMatcher", () => {
908
902
  // });
909
903
 
910
904
  // it("should automatically handle multiple search param values", ( ) => {
911
- // const m = $umf.compile("/foo/{fooid:int}?{bar:int}");
905
+ // const m = $url.compile("/foo/{fooid:int}?{bar:int}");
912
906
 
913
907
  // $url.url("/foo/5?bar=1");
914
908
  // expect(m.exec($url.path(), $url.search())).toEqual({ fooid: 5, bar: 1 });
@@ -929,7 +923,7 @@ describe("UrlMatcher", () => {
929
923
  // });
930
924
 
931
925
  // it("should allow custom types to handle multiple search param values manually", ( ) => {
932
- // $umf.type("custArray", {
926
+ // $url.type("custArray", {
933
927
  // encode: function (array) {
934
928
  // return array.join("-");
935
929
  // },
@@ -940,7 +934,7 @@ describe("UrlMatcher", () => {
940
934
  // is: Array.isArray,
941
935
  // });
942
936
 
943
- // const m = $umf.compile("/foo?{bar:custArray}", {
937
+ // const m = $url.compile("/foo?{bar:custArray}", {
944
938
  // state: { params: { bar: { array: false } } },
945
939
  // });
946
940
 
@@ -960,7 +954,7 @@ describe("UrlMatcher", () => {
960
954
 
961
955
  // describe("optional parameters", ( ) => {
962
956
  // it("should match with or without values", ( ) => {
963
- // const m = $umf.compile("/users/{id:int}", {
957
+ // const m = $url.compile("/users/{id:int}", {
964
958
  // state: {
965
959
  // params: { id: { value: null, squash: true } },
966
960
  // },
@@ -972,7 +966,7 @@ describe("UrlMatcher", () => {
972
966
  // });
973
967
 
974
968
  // it("should correctly match multiple", ( ) => {
975
- // const m = $umf.compile("/users/{id:int}/{state:[A-Z]+}", {
969
+ // const m = $url.compile("/users/{id:int}/{state:[A-Z]+}", {
976
970
  // state: {
977
971
  // params: {
978
972
  // id: { value: null, squash: true },
@@ -994,7 +988,7 @@ describe("UrlMatcher", () => {
994
988
  // });
995
989
 
996
990
  // it("should correctly format with or without values", ( ) => {
997
- // const m = $umf.compile("/users/{id:int}", {
991
+ // const m = $url.compile("/users/{id:int}", {
998
992
  // state: {
999
993
  // params: { id: { value: null } },
1000
994
  // },
@@ -1004,7 +998,7 @@ describe("UrlMatcher", () => {
1004
998
  // });
1005
999
 
1006
1000
  // it("should correctly format multiple", ( ) => {
1007
- // const m = $umf.compile("/users/{id:int}/{state:[A-Z]+}", {
1001
+ // const m = $url.compile("/users/{id:int}/{state:[A-Z]+}", {
1008
1002
  // state: {
1009
1003
  // params: {
1010
1004
  // id: { value: null, squash: true },
@@ -1020,7 +1014,7 @@ describe("UrlMatcher", () => {
1020
1014
  // });
1021
1015
 
1022
1016
  // it("should match in between static segments", ( ) => {
1023
- // const m = $umf.compile("/users/{user:int}/photos", {
1017
+ // const m = $url.compile("/users/{user:int}/photos", {
1024
1018
  // state: {
1025
1019
  // params: { user: { value: 5, squash: true } },
1026
1020
  // },
@@ -1032,7 +1026,7 @@ describe("UrlMatcher", () => {
1032
1026
  // });
1033
1027
 
1034
1028
  // it("should correctly format with an optional followed by a required parameter", ( ) => {
1035
- // const m = $umf.compile("/home/:user/gallery/photos/:photo", {
1029
+ // const m = $url.compile("/home/:user/gallery/photos/:photo", {
1036
1030
  // state: {
1037
1031
  // params: {
1038
1032
  // user: { value: null, squash: true },
@@ -1048,7 +1042,7 @@ describe("UrlMatcher", () => {
1048
1042
 
1049
1043
  // describe("default values", ( ) => {
1050
1044
  // it("should populate if not supplied in URL", ( ) => {
1051
- // const m = $umf.compile("/users/{id:int}/{test}", {
1045
+ // const m = $url.compile("/users/{id:int}/{test}", {
1052
1046
  // state: {
1053
1047
  // params: {
1054
1048
  // id: { value: 0, squash: true },
@@ -1064,7 +1058,7 @@ describe("UrlMatcher", () => {
1064
1058
  // });
1065
1059
 
1066
1060
  // it("should populate even if the regexp requires 1 or more chars", ( ) => {
1067
- // const m = $umf.compile(
1061
+ // const m = $url.compile(
1068
1062
  // "/record/{appId}/{recordId:[0-9a-fA-F]{10,24}}",
1069
1063
  // {
1070
1064
  // state: {
@@ -1079,7 +1073,7 @@ describe("UrlMatcher", () => {
1079
1073
  // });
1080
1074
 
1081
1075
  // it("should allow shorthand definitions", ( ) => {
1082
- // const m = $umf.compile("/foo/:foo", {
1076
+ // const m = $url.compile("/foo/:foo", {
1083
1077
  // state: {
1084
1078
  // params: { foo: "bar" },
1085
1079
  // },
@@ -1089,7 +1083,7 @@ describe("UrlMatcher", () => {
1089
1083
 
1090
1084
  // it("should populate query params", ( ) => {
1091
1085
  // const defaults = { order: "name", limit: 25, page: 1 };
1092
- // const m = $umf.compile("/foo?order&{limit:int}&{page:int}", {
1086
+ // const m = $url.compile("/foo?order&{limit:int}&{page:int}", {
1093
1087
  // state: {
1094
1088
  // params: defaults,
1095
1089
  // },
@@ -1101,21 +1095,21 @@ describe("UrlMatcher", () => {
1101
1095
  // function barFn() {
1102
1096
  // return "Value from bar()";
1103
1097
  // }
1104
- // let m = $umf.compile("/foo/:bar", {
1098
+ // let m = $url.compile("/foo/:bar", {
1105
1099
  // state: {
1106
1100
  // params: { bar: barFn },
1107
1101
  // },
1108
1102
  // });
1109
1103
  // expect(m.exec("/foo/").bar).toBe("Value from bar()");
1110
1104
 
1111
- // m = $umf.compile("/foo/:bar", {
1105
+ // m = $url.compile("/foo/:bar", {
1112
1106
  // state: {
1113
1107
  // params: { bar: { value: barFn, squash: true } },
1114
1108
  // },
1115
1109
  // });
1116
1110
  // expect(m.exec("/foo").bar).toBe("Value from bar()");
1117
1111
 
1118
- // m = $umf.compile("/foo?bar", {
1112
+ // m = $url.compile("/foo?bar", {
1119
1113
  // state: {
1120
1114
  // params: { bar: barFn },
1121
1115
  // },
@@ -1124,7 +1118,7 @@ describe("UrlMatcher", () => {
1124
1118
  // });
1125
1119
 
1126
1120
  // it("should allow injectable functions", function ($stateParams) {
1127
- // const m = $umf.compile("/users/{user:json}", {
1121
+ // const m = $url.compile("/users/{user:json}", {
1128
1122
  // state: {
1129
1123
  // params: {
1130
1124
  // user: function ($stateParams) {
@@ -1140,7 +1134,7 @@ describe("UrlMatcher", () => {
1140
1134
  // });
1141
1135
 
1142
1136
  // xit("should match when used as prefix", ( ) => {
1143
- // const m = $umf.compile("/{lang:[a-z]{2}}/foo", {
1137
+ // const m = $url.compile("/{lang:[a-z]{2}}/foo", {
1144
1138
  // state: {
1145
1139
  // params: { lang: "de" },
1146
1140
  // },
@@ -1152,7 +1146,7 @@ describe("UrlMatcher", () => {
1152
1146
  // describe("squash policy", ( ) => {
1153
1147
  // const Session = { username: "loggedinuser" };
1154
1148
  // function getMatcher(squash) {
1155
- // return $umf.compile(
1149
+ // return $url.compile(
1156
1150
  // "/user/:userid/gallery/:galleryid/photo/:photoid",
1157
1151
  // {
1158
1152
  // state: {
@@ -1285,18 +1279,18 @@ describe("UrlMatcher", () => {
1285
1279
 
1286
1280
  // describe("strict matching", ( ) => {
1287
1281
  // it("should match with or without trailing slash", ( ) => {
1288
- // const m = $umf.compile("/users", { strict: false });
1282
+ // const m = $url.compile("/users", { strict: false });
1289
1283
  // expect(m.exec("/users")).toEqual({});
1290
1284
  // expect(m.exec("/users/")).toEqual({});
1291
1285
  // });
1292
1286
 
1293
1287
  // it("should not match multiple trailing slashes", ( ) => {
1294
- // const m = $umf.compile("/users", { strict: false });
1288
+ // const m = $url.compile("/users", { strict: false });
1295
1289
  // expect(m.exec("/users//")).toBeNull();
1296
1290
  // });
1297
1291
 
1298
1292
  // it("should match when defined with parameters", ( ) => {
1299
- // const m = $umf.compile("/users/{name}", {
1293
+ // const m = $url.compile("/users/{name}", {
1300
1294
  // strict: false,
1301
1295
  // state: {
1302
1296
  // params: {