|
1 | 1 | var module = angular.mock.module;
|
2 | 2 | var uiRouter = require("ui-router");
|
3 |
| -var provide, UrlMatcher, ParamSet, Param; |
| 3 | +var ParamSet = uiRouter.params.ParamSet; |
| 4 | +var Param = uiRouter.params.Param; |
| 5 | +var provide, UrlMatcher; |
4 | 6 |
|
5 | 7 | beforeEach(function() {
|
6 | 8 | var app = angular.module('ui.router.router.test', function () { });
|
7 | 9 | app.config(function ($urlMatcherFactoryProvider) {
|
8 | 10 | provider = $urlMatcherFactoryProvider;
|
9 | 11 | UrlMatcher = provider.UrlMatcher;
|
10 | 12 | ParamSet = provider.ParamSet;
|
11 |
| - Param = provider.Param; |
| 13 | + //Param = provider.Param; |
12 | 14 | });
|
13 | 15 | });
|
14 | 16 |
|
@@ -503,7 +505,7 @@ describe("urlMatcherFactory", function () {
|
503 | 505 | expect($umf.compile('/hello/world').exec('/heLLo/WORLD')).toBeNull();
|
504 | 506 | });
|
505 | 507 |
|
506 |
| - it("should handle case insensistive URL", function () { |
| 508 | + it("should handle case insensitive URL", function () { |
507 | 509 | $umf.caseInsensitive(true);
|
508 | 510 | expect($umf.compile('/hello/world').exec('/heLLo/WORLD')).toEqual({});
|
509 | 511 | });
|
@@ -882,6 +884,22 @@ describe("urlMatcherFactory", function () {
|
882 | 884 | });
|
883 | 885 | });
|
884 | 886 |
|
| 887 | + describe(".$$own", function() { |
| 888 | + it("should return a new ParamSet which does not expose ancestor Params (only exposes own Params)", function() { |
| 889 | + var grandparent = new ParamSet({ grandparent: params.grandparent }); |
| 890 | + var parent = grandparent.$$new({ parent: params.parent }); |
| 891 | + var child = parent.$$new({ child: params.child }); |
| 892 | + |
| 893 | + expect(child.grandparent).toBe(params.grandparent); |
| 894 | + var own = child.$$own(); |
| 895 | + |
| 896 | + expect(own.$$keys()).toEqual(["child"]); |
| 897 | + expect(own.child).toBe(params.child); |
| 898 | + expect(own.parent).toBeUndefined(); |
| 899 | + expect(own.grandparent).toBeUndefined(); |
| 900 | + }); |
| 901 | + }); |
| 902 | + |
885 | 903 | describe(".$$keys", function() {
|
886 | 904 | it("should return keys for current param set", function() {
|
887 | 905 | var ps = new ParamSet();
|
|
0 commit comments