@@ -90,6 +90,22 @@ class GrandChildView extends BaseGrandChildView {
90
90
}
91
91
const grandChildTag = defineCE ( GrandChildView )
92
92
93
+ class BrokenView extends withRouterLinks ( LitElement ) {
94
+ createRenderRoot ( ) {
95
+ return this
96
+ }
97
+
98
+ render ( ) {
99
+ return html `
100
+ < div routerlinks >
101
+ < a id ="a-brokenrootlink " route ="root "> </ a >
102
+ < a id ="a-rootlink " route ="root " param-id ="1 "> </ a >
103
+ </ div >
104
+ `
105
+ }
106
+ }
107
+ const brokenTag = defineCE ( BrokenView )
108
+
93
109
describe ( 'routerLinks' , ( ) => {
94
110
let router , outlet , parentComponent
95
111
beforeEach ( ( ) => {
@@ -103,6 +119,7 @@ describe('routerLinks', () => {
103
119
} )
104
120
route ( 'root' , { path : 'root/:id' , component : ParentView } )
105
121
route ( 'secondroot' , { path : 'secondroot/:personId' , component : ParentView } )
122
+ route ( 'brokenroot' , { path : 'brokenroot' , component : BrokenView } )
106
123
}
107
124
parentComponent = ParentView
108
125
router = new Router ( { location : 'memory' , outlet, routes } )
@@ -358,6 +375,14 @@ describe('routerLinks', () => {
358
375
} )
359
376
} )
360
377
378
+ it ( 'should generate href even if there is a broken link configuration' , function ( ) {
379
+ return router . transitionTo ( 'brokenroot' ) . then ( async function ( ) {
380
+ const brokenEl = document . querySelector ( brokenTag )
381
+ await brokenEl . updateComplete
382
+ expect ( $ ( '#a-rootlink' ) . attr ( 'href' ) ) . to . be . equal ( '/root/1' )
383
+ } )
384
+ } )
385
+
361
386
describe ( 'when elements are added dynamically' , ( ) => {
362
387
it ( 'should generate href attributes in anchor tags with route attribute' , function ( done ) {
363
388
router . transitionTo ( 'parent' ) . then ( async function ( ) {
0 commit comments