@@ -74,52 +74,53 @@ analyzer:
7474 dartdocOptions: '''
7575dartdoc:
7676 categories:
77- One :
77+ cat1 :
7878 markdown: one.md
79+ displayName: One
7980 Documented:
8081 markdown: documented.md
8182''' ,
8283 libFiles: [
8384 d.file ('lib.dart' , '''
8485/// A class.
85- /// {@category One }
86+ /// {@category cat1 }
8687class C1 {}
8788
8889/// A constant.
89- /// {@category One }
90+ /// {@category cat1 }
9091const c1 = 1;
9192
9293/// An enum.
93- /// {@category One }
94+ /// {@category cat1 }
9495enum E1 { one, two }
9596
9697/// A function.
97- /// {@category One }
98+ /// {@category cat1 }
9899void F1() {}
99100
100101/// A mixin.
101- /// {@category One }
102+ /// {@category cat1 }
102103mixin M1 {}
103104
104105/// A property.
105- /// {@category One }
106+ /// {@category cat1 }
106107var p1 = 1;
107108
108109/// A typedef.
109- /// {@category One }
110+ /// {@category cat1 }
110111typedef T1 = void Function();
111112
112113/// A typedef.
113- /// {@category One }
114+ /// {@category cat1 }
114115// TODO(srawlins): Properly unit-test "typedef pointing to typedef".
115116typedef T2 = T1;
116117
117118/// An extension.
118- /// {@category One }
119+ /// {@category cat1 }
119120extension Ex on int {}
120121
121122/// An extension type.
122- /// {@category One }
123+ /// {@category cat1 }
123124extension type ExType(int it) {}
124125''' ),
125126 d.file ('other.dart' , '''
@@ -136,7 +137,7 @@ library;
136137 await utils.writeDartdocResources (resourceProvider);
137138 await (await buildDartdoc ()).generateDocs ();
138139 topicOneLines = resourceProvider
139- .getFile (path.join (packagePath, 'doc' , 'topics' , 'One -topic.html' ))
140+ .getFile (path.join (packagePath, 'doc' , 'topics' , 'cat1 -topic.html' ))
140141 .readAsStringSync ()
141142 .split ('\n ' );
142143 indexPageLines = resourceProvider
@@ -145,6 +146,14 @@ library;
145146 .split ('\n ' );
146147 });
147148
149+ test ('redirect category file created' , () async {
150+ final redirectContent = resourceProvider
151+ .getFile (path.join (packagePath, 'doc' , 'topics' , 'One-topic.html' ))
152+ .readAsStringSync ();
153+
154+ expect (redirectContent, contains ('<meta http-equiv="refresh" content="0;' ));
155+ });
156+
148157 test ('page links to classes annotated with category' , () async {
149158 topicOneLines.expectMainContentContainsAllInOrder ([
150159 matches ('<h2>Classes</h2>' ),
@@ -214,7 +223,7 @@ library;
214223 topicOneLines,
215224 containsAllInOrder ([
216225 matches ('<div id="dartdoc-sidebar-right" ' ),
217- matches ('<a href="../topics/One -topic.html#classes">Classes</a>' ),
226+ matches ('<a href="../topics/cat1 -topic.html#classes">Classes</a>' ),
218227 matches ('<a href="../lib/C1-class.html">C1</a>' ),
219228 ]),
220229 );
@@ -225,7 +234,7 @@ library;
225234 topicOneLines,
226235 containsAllInOrder ([
227236 matches ('<div id="dartdoc-sidebar-right" ' ),
228- matches ('<a href="../topics/One -topic.html#enums">Enums</a>' ),
237+ matches ('<a href="../topics/cat1 -topic.html#enums">Enums</a>' ),
229238 matches ('<a href="../lib/E1.html">E1</a>' ),
230239 ]),
231240 );
@@ -236,7 +245,7 @@ library;
236245 topicOneLines,
237246 containsAllInOrder ([
238247 matches ('<div id="dartdoc-sidebar-right" ' ),
239- matches ('<a href="../topics/One -topic.html#mixins">Mixins</a>' ),
248+ matches ('<a href="../topics/cat1 -topic.html#mixins">Mixins</a>' ),
240249 matches ('<a href="../lib/M1-mixin.html">M1</a>' ),
241250 ]),
242251 );
@@ -247,7 +256,7 @@ library;
247256 topicOneLines,
248257 containsAllInOrder ([
249258 matches ('<div id="dartdoc-sidebar-right" ' ),
250- matches ('<a href="../topics/One -topic.html#constants">Constants</a>' ),
259+ matches ('<a href="../topics/cat1 -topic.html#constants">Constants</a>' ),
251260 matches ('<a href="../lib/c1-constant.html">c1</a>' ),
252261 ]),
253262 );
@@ -258,7 +267,8 @@ library;
258267 topicOneLines,
259268 containsAllInOrder ([
260269 matches ('<div id="dartdoc-sidebar-right" ' ),
261- matches ('<a href="../topics/One-topic.html#properties">Properties</a>' ),
270+ matches (
271+ '<a href="../topics/cat1-topic.html#properties">Properties</a>' ),
262272 matches ('<a href="../lib/p1.html">p1</a>' ),
263273 ]),
264274 );
@@ -269,7 +279,7 @@ library;
269279 topicOneLines,
270280 containsAllInOrder ([
271281 matches ('<div id="dartdoc-sidebar-right" ' ),
272- matches ('<a href="../topics/One -topic.html#functions">Functions</a>' ),
282+ matches ('<a href="../topics/cat1 -topic.html#functions">Functions</a>' ),
273283 matches ('<a href="../lib/F1.html">F1</a>' ),
274284 ]),
275285 );
@@ -280,7 +290,7 @@ library;
280290 topicOneLines,
281291 containsAllInOrder ([
282292 matches ('<div id="dartdoc-sidebar-right" ' ),
283- matches ('<a href="../topics/One -topic.html#typedefs">Typedefs</a>' ),
293+ matches ('<a href="../topics/cat1 -topic.html#typedefs">Typedefs</a>' ),
284294 matches ('<a href="../lib/T1.html">T1</a>' ),
285295 ]),
286296 );
@@ -291,7 +301,8 @@ library;
291301 topicOneLines,
292302 containsAllInOrder ([
293303 matches ('<div id="dartdoc-sidebar-right" ' ),
294- matches ('<a href="../topics/One-topic.html#extensions">Extensions</a>' ),
304+ matches (
305+ '<a href="../topics/cat1-topic.html#extensions">Extensions</a>' ),
295306 matches ('<a href="../lib/Ex.html">Ex</a>' ),
296307 ]),
297308 );
@@ -302,7 +313,7 @@ library;
302313 topicOneLines,
303314 containsAllInOrder ([
304315 matches ('<div id="dartdoc-sidebar-right" ' ),
305- matches ('<a href="../topics/One -topic.html#extension-types">'
316+ matches ('<a href="../topics/cat1 -topic.html#extension-types">'
306317 'Extension Types</a>' ),
307318 matches ('<a href="../lib/ExType-extension-type.html">ExType</a>' ),
308319 ]),
0 commit comments