@@ -59,6 +59,30 @@ def test_pretty_names_from_filename(self):
59
59
self .assertEqual (display_link .text .strip (), "test_molecule_no_context.html" )
60
60
self .assertEqual (render_link .text .strip (), pattern_path )
61
61
62
+ def test_pretty_names_from_filename_containing_dashes (self ):
63
+ pattern_path = "patterns/molecules/test-molecule/test-molecule.html"
64
+ test_molecule_display_url = reverse (
65
+ "pattern_library:display_pattern" ,
66
+ kwargs = {"pattern_template_name" : pattern_path },
67
+ )
68
+ test_molecule_render_url = reverse (
69
+ "pattern_library:render_pattern" ,
70
+ kwargs = {"pattern_template_name" : pattern_path },
71
+ )
72
+
73
+ response = self .client .get (test_molecule_display_url )
74
+ self .assertEqual (response .status_code , 200 )
75
+
76
+ soup = BeautifulSoup (response .content , features = "html.parser" )
77
+
78
+ display_link = soup .select_one (
79
+ f'.list__item>a[href="{ test_molecule_display_url } "]'
80
+ )
81
+ render_link = soup .select_one (f'a[href="{ test_molecule_render_url } "]' )
82
+
83
+ self .assertEqual (display_link .text .strip (), "test-molecule.html" )
84
+ self .assertEqual (render_link .text .strip (), pattern_path )
85
+
62
86
def test_includes (self ):
63
87
pattern_path = "patterns/atoms/test_includes/test_includes.html"
64
88
display_url = reverse (
@@ -92,6 +116,7 @@ def test_fragments(self):
92
116
for template_name in [
93
117
"patterns/atoms/test_atom/test_atom.html" ,
94
118
"patterns/molecules/test_molecule/test_molecule.html" ,
119
+ "patterns/molecules/test-molecule/test-molecule.html" ,
95
120
]:
96
121
with self .subTest (template_name = template_name ):
97
122
self .assertContains (
0 commit comments