@@ -126,6 +126,24 @@ describe('Path.extractParams', function () {
126
126
} ) ;
127
127
} ) ;
128
128
} ) ;
129
+
130
+ describe ( 'when a param has dots' , function ( ) {
131
+ var pattern = '/:query/with/:domain' ;
132
+
133
+ describe ( 'and the path matches' , function ( ) {
134
+ it ( 'returns an object with the params' , function ( ) {
135
+ expect ( Path . extractParams ( pattern , '/foo/with/foo.app' ) ) . toEqual ( { query : 'foo' , domain : 'foo.app' } ) ;
136
+ expect ( Path . extractParams ( pattern , '/foo.ap/with/foo' ) ) . toEqual ( { query : 'foo.ap' , domain : 'foo' } ) ;
137
+ expect ( Path . extractParams ( pattern , '/foo.ap/with/foo.app' ) ) . toEqual ( { query : 'foo.ap' , domain : 'foo.app' } ) ;
138
+ } ) ;
139
+ } ) ;
140
+
141
+ describe ( 'and the path does not match' , function ( ) {
142
+ it ( 'returns null' , function ( ) {
143
+ expect ( Path . extractParams ( pattern , '/foo.ap' ) ) . toBe ( null ) ;
144
+ } ) ;
145
+ } ) ;
146
+ } ) ;
129
147
} ) ;
130
148
131
149
describe ( 'Path.injectParams' , function ( ) {
@@ -169,6 +187,12 @@ describe('Path.injectParams', function () {
169
187
expect ( Path . injectParams ( pattern , { id : 'the/id' } ) ) . toEqual ( 'comments/the/id/edit' ) ;
170
188
} ) ;
171
189
} ) ;
190
+
191
+ describe ( 'and some params contain dots' , function ( ) {
192
+ it ( 'returns the correct path' , function ( ) {
193
+ expect ( Path . injectParams ( pattern , { id : 'alt.black.helicopter' } ) ) . toEqual ( 'comments/alt.black.helicopter/edit' ) ;
194
+ } ) ;
195
+ } ) ;
172
196
} ) ;
173
197
174
198
describe ( 'when a pattern has multiple splats' , function ( ) {
0 commit comments