redux-router-kit
Advanced tools
Comparing version 0.0.33 to 0.0.34
@@ -114,3 +114,3 @@ 'use strict'; | ||
var element = matchedRoutes.reduceRight(function (childElement, route) { | ||
var element = matchedRoutes.reduceRight(function (childElement, route, matchedRouteIndex) { | ||
var component = route.component; | ||
@@ -124,2 +124,3 @@ var components = route.components; | ||
route: route, | ||
matchedRouteIndex: matchedRouteIndex, | ||
// Deprecated | ||
@@ -126,0 +127,0 @@ routeValue: route |
@@ -95,3 +95,3 @@ 'use strict'; | ||
var testPathname = pathPattern[0] === '/' ? pathname : remainingPathname; | ||
var params = matchPathnameToPattern(testPathname, pathPattern, routeValue); | ||
var params = testPathname === '' && pathPattern === '.' ? {} : matchPathnameToPattern(testPathname, pathPattern, routeValue); | ||
@@ -98,0 +98,0 @@ if (params) { |
{ | ||
"name": "redux-router-kit", | ||
"version": "0.0.33", | ||
"version": "0.0.34", | ||
"description": "Routing tools for Redux/React", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -83,3 +83,3 @@ import React, { PropTypes } from 'react'; | ||
const element = matchedRoutes.reduceRight((childElement, route) => { | ||
const element = matchedRoutes.reduceRight((childElement, route, matchedRouteIndex) => { | ||
const { component, components } = route; | ||
@@ -92,2 +92,3 @@ if (typeof component !== 'function' && (!component || typeof components !== 'object')) { | ||
route, | ||
matchedRouteIndex, | ||
// Deprecated | ||
@@ -94,0 +95,0 @@ routeValue: route |
@@ -70,3 +70,7 @@ import pathToRegExp from 'path-to-regexp'; | ||
const testPathname = pathPattern[0] === '/' ? pathname : remainingPathname; | ||
const params = matchPathnameToPattern(testPathname, pathPattern, routeValue); | ||
const params = (testPathname === '' && pathPattern === '.') ? ( | ||
{} | ||
) : ( | ||
matchPathnameToPattern(testPathname, pathPattern, routeValue) | ||
); | ||
@@ -73,0 +77,0 @@ if (params) { |
@@ -110,1 +110,52 @@ import test from 'ava'; | ||
}); | ||
test('match index route', t => { | ||
const routeMatch = matchRoutes({ | ||
'/todos': { | ||
name: 'todos', | ||
routes: { | ||
'.': { | ||
name: 'todos-index' | ||
}, | ||
':id': { | ||
name: 'todo' | ||
} | ||
} | ||
} | ||
}, '/todos'); | ||
t.same(routeMatch.key, ['/todos', '.']); | ||
}); | ||
test('match index route at root', t => { | ||
const routeMatch = matchRoutes({ | ||
'/': { | ||
name: 'root', | ||
routes: { | ||
'.': { | ||
name: 'home' | ||
}, | ||
'todos': { | ||
name: 'todos' | ||
} | ||
} | ||
} | ||
}, '/'); | ||
t.same(routeMatch.key, ['/', '.']); | ||
}); | ||
test('match unknown route at root', t => { | ||
const routeMatch = matchRoutes({ | ||
'/': { | ||
name: 'root', | ||
routes: { | ||
'todos': { | ||
name: 'todos' | ||
}, | ||
'*': { | ||
name: 'unknown' | ||
} | ||
} | ||
} | ||
}, '/todo'); | ||
t.same(routeMatch.key, ['/', '*']); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
429737
9648