|
1 | 1 | describe("UrlMatcher", function () {
|
| 2 | + var provider; |
| 3 | + beforeEach(function() { |
| 4 | + angular.module('ui.router.router.test', function() {}).config(function ($urlMatcherFactoryProvider) { |
| 5 | + provider = $urlMatcherFactoryProvider; |
| 6 | + }); |
2 | 7 |
|
3 |
| - describe("provider", function () { |
4 |
| - |
5 |
| - var provider; |
6 |
| - |
7 |
| - beforeEach(function() { |
8 |
| - angular.module('ui.router.router.test', function() {}).config(function ($urlMatcherFactoryProvider) { |
9 |
| - provider = $urlMatcherFactoryProvider; |
10 |
| - }); |
11 |
| - |
12 |
| - module('ui.router.router', 'ui.router.router.test'); |
| 8 | + module('ui.router.router', 'ui.router.router.test'); |
13 | 9 |
|
14 |
| - inject(function($injector) { |
15 |
| - $injector.invoke(provider.$get); |
16 |
| - }); |
| 10 | + inject(function($injector) { |
| 11 | + $injector.invoke(provider.$get); |
17 | 12 | });
|
| 13 | + }); |
18 | 14 |
|
| 15 | + describe("provider", function () { |
19 | 16 | it("should factory matchers with correct configuration", function () {
|
20 | 17 | provider.caseInsensitive(false);
|
21 | 18 | expect(provider.compile('/hello').exec('/HELLO')).toBeNull();
|
@@ -165,6 +162,22 @@ describe("UrlMatcher", function () {
|
165 | 162 | var matcher = base.concat('/{repeat:[0-9]+}?to');
|
166 | 163 | expect(matcher).toNotBe(base);
|
167 | 164 | });
|
| 165 | + |
| 166 | + it("should respect $urlMatcherFactoryProvider.strictMode", function() { |
| 167 | + var m = new UrlMatcher('/'); |
| 168 | + provider.strictMode(false); |
| 169 | + m = m.concat("foo"); |
| 170 | + expect(m.exec("/foo")).toEqual({}); |
| 171 | + expect(m.exec("/foo/")).toEqual({}) |
| 172 | + }); |
| 173 | + |
| 174 | + it("should respect $urlMatcherFactoryProvider.caseInsensitive", function() { |
| 175 | + var m = new UrlMatcher('/'); |
| 176 | + provider.caseInsensitive(true); |
| 177 | + m = m.concat("foo"); |
| 178 | + expect(m.exec("/foo")).toEqual({}); |
| 179 | + expect(m.exec("/FOO")).toEqual({}); |
| 180 | + }); |
168 | 181 | });
|
169 | 182 | });
|
170 | 183 |
|
|
0 commit comments