fix(tree): reassign fullpath when register new node which the same current node (#2366)

* fix(tree): assign fullpath to current node by fullpath of new node if current node the same new node

* test(router-test): reverse the order when register router when test func GetFullPath

* chg(tree-test): update test case with register new route in TestRouteContextHoldsFullPath

Co-authored-by: vinhha <vinhha@vng.com.vn>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
vinhha96 2020-05-11 12:25:49 +07:00 committed by GitHub
parent d17270dd90
commit a6e8665e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -593,6 +593,9 @@ func TestRouteContextHoldsFullPath(t *testing.T) {
"/simple-two/one-two",
"/project/:name/build/*params",
"/project/:name/bui",
"/user/:id/status",
"/user/:id",
"/user/:id/profile",
}
for _, route := range routes {

View File

@ -240,6 +240,7 @@ walk:
panic("handlers are already registered for path '" + fullPath + "'")
}
n.handlers = handlers
n.fullPath = fullPath
return
}
}