@@ -3,18 +3,42 @@ import { NavEntry, TextContentEntry } from '../NavEntry'
33
44const mockEntry : TextContentEntry = {
55 id : 'entry1' ,
6- data : { id : 'Entry1 ' , section : 'section1' } ,
6+ data : { id : 'Entry 1 Title ' , section : 'section1' } ,
77}
88
99describe ( 'NavEntry' , ( ) => {
1010 it ( 'renders without crashing' , ( ) => {
1111 render ( < NavEntry entry = { mockEntry } isActive = { false } /> )
12- expect ( screen . getByText ( 'Entry1 ' ) ) . toBeInTheDocument ( )
12+ expect ( screen . getByText ( 'Entry 1 Title ' ) ) . toBeInTheDocument ( )
1313 } )
1414
15- it ( 'renders the correct link' , ( ) => {
15+ it ( 'renders the correct link with kebab-cased title ' , ( ) => {
1616 render ( < NavEntry entry = { mockEntry } isActive = { false } /> )
17- expect ( screen . getByRole ( 'link' ) ) . toHaveAttribute ( 'href' , '/section1/entry1' )
17+ expect ( screen . getByRole ( 'link' ) ) . toHaveAttribute (
18+ 'href' ,
19+ '/section1/entry-1-title' ,
20+ )
21+ } )
22+
23+ it ( 'properly transforms PatternFly text in URLs' , ( ) => {
24+ const patternflyEntry : TextContentEntry = {
25+ id : 'pf1' ,
26+ data : { id : 'PatternFly Components' , section : 'PatternFly' } ,
27+ }
28+ render ( < NavEntry entry = { patternflyEntry } isActive = { false } /> )
29+ expect ( screen . getByRole ( 'link' ) ) . toHaveAttribute (
30+ 'href' ,
31+ '/patternfly/patternfly-components' ,
32+ )
33+ } )
34+
35+ it ( 'preserves PatternFly text in display' , ( ) => {
36+ const patternflyEntry : TextContentEntry = {
37+ id : 'pf1' ,
38+ data : { id : 'PatternFly Components' , section : 'PatternFly' } ,
39+ }
40+ render ( < NavEntry entry = { patternflyEntry } isActive = { false } /> )
41+ expect ( screen . getByText ( 'PatternFly Components' ) ) . toBeInTheDocument ( )
1842 } )
1943
2044 it ( 'marks the entry as active if isActive is true' , ( ) => {
0 commit comments