This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,9 @@ function $RouteProvider() {
146
146
if ( angular . isUndefined ( routeCopy . reloadOnSearch ) ) {
147
147
routeCopy . reloadOnSearch = true ;
148
148
}
149
+ if ( angular . isUndefined ( routeCopy . caseInsensitiveMatch ) ) {
150
+ routeCopy . caseInsensitiveMatch = this . caseInsensitiveMatch ;
151
+ }
149
152
routes [ path ] = angular . extend (
150
153
routeCopy ,
151
154
path && pathRegExp ( path , routeCopy )
@@ -166,6 +169,15 @@ function $RouteProvider() {
166
169
return this ;
167
170
} ;
168
171
172
+ /**
173
+ * @ngdoc property
174
+ * @name $routeProvider#caseInsensitiveMatch
175
+ *
176
+ * @property {boolean } caseInsensitiveMatch Value of the `caseInsensitiveMatch` property
177
+ * for newly defined routes. Defaults to `false`.
178
+ */
179
+ this . caseInsensitiveMatch = false ;
180
+
169
181
/**
170
182
* @param path {string} path
171
183
* @param opts {Object} options
Original file line number Diff line number Diff line change @@ -237,6 +237,31 @@ describe('$route', function() {
237
237
} ) ;
238
238
} ) ;
239
239
240
+ it ( 'should allow configuring caseInsensitiveMatch on the route provider level' , function ( ) {
241
+ module ( function ( $routeProvider ) {
242
+ $routeProvider . caseInsensitiveMatch = true ;
243
+ $routeProvider . when ( '/Blank' , { template : 'blank' } ) ;
244
+ $routeProvider . otherwise ( { template : 'other' } ) ;
245
+ } ) ;
246
+ inject ( function ( $route , $location , $rootScope ) {
247
+ $location . path ( '/bLaNk' ) ;
248
+ $rootScope . $digest ( ) ;
249
+ expect ( $route . current . template ) . toBe ( 'blank' ) ;
250
+ } ) ;
251
+ } ) ;
252
+
253
+ it ( 'should allow overriding provider\'s caseInsensitiveMatch setting on the route level' , function ( ) {
254
+ module ( function ( $routeProvider ) {
255
+ $routeProvider . caseInsensitiveMatch = true ;
256
+ $routeProvider . when ( '/Blank' , { template : 'blank' , caseInsensitiveMatch : false } ) ;
257
+ $routeProvider . otherwise ( { template : 'other' } ) ;
258
+ } ) ;
259
+ inject ( function ( $route , $location , $rootScope ) {
260
+ $location . path ( '/bLaNk' ) ;
261
+ $rootScope . $digest ( ) ;
262
+ expect ( $route . current . template ) . toBe ( 'other' ) ;
263
+ } ) ;
264
+ } ) ;
240
265
241
266
it ( 'should not change route when location is canceled' , function ( ) {
242
267
module ( function ( $routeProvider ) {
You can’t perform that action at this time.
0 commit comments