@@ -74,52 +74,53 @@ analyzer:
74
74
dartdocOptions: '''
75
75
dartdoc:
76
76
categories:
77
- One :
77
+ cat1 :
78
78
markdown: one.md
79
+ displayName: One
79
80
Documented:
80
81
markdown: documented.md
81
82
''' ,
82
83
libFiles: [
83
84
d.file ('lib.dart' , '''
84
85
/// A class.
85
- /// {@category One }
86
+ /// {@category cat1 }
86
87
class C1 {}
87
88
88
89
/// A constant.
89
- /// {@category One }
90
+ /// {@category cat1 }
90
91
const c1 = 1;
91
92
92
93
/// An enum.
93
- /// {@category One }
94
+ /// {@category cat1 }
94
95
enum E1 { one, two }
95
96
96
97
/// A function.
97
- /// {@category One }
98
+ /// {@category cat1 }
98
99
void F1() {}
99
100
100
101
/// A mixin.
101
- /// {@category One }
102
+ /// {@category cat1 }
102
103
mixin M1 {}
103
104
104
105
/// A property.
105
- /// {@category One }
106
+ /// {@category cat1 }
106
107
var p1 = 1;
107
108
108
109
/// A typedef.
109
- /// {@category One }
110
+ /// {@category cat1 }
110
111
typedef T1 = void Function();
111
112
112
113
/// A typedef.
113
- /// {@category One }
114
+ /// {@category cat1 }
114
115
// TODO(srawlins): Properly unit-test "typedef pointing to typedef".
115
116
typedef T2 = T1;
116
117
117
118
/// An extension.
118
- /// {@category One }
119
+ /// {@category cat1 }
119
120
extension Ex on int {}
120
121
121
122
/// An extension type.
122
- /// {@category One }
123
+ /// {@category cat1 }
123
124
extension type ExType(int it) {}
124
125
''' ),
125
126
d.file ('other.dart' , '''
@@ -136,7 +137,7 @@ library;
136
137
await utils.writeDartdocResources (resourceProvider);
137
138
await (await buildDartdoc ()).generateDocs ();
138
139
topicOneLines = resourceProvider
139
- .getFile (path.join (packagePath, 'doc' , 'topics' , 'One -topic.html' ))
140
+ .getFile (path.join (packagePath, 'doc' , 'topics' , 'cat1 -topic.html' ))
140
141
.readAsStringSync ()
141
142
.split ('\n ' );
142
143
indexPageLines = resourceProvider
@@ -145,6 +146,14 @@ library;
145
146
.split ('\n ' );
146
147
});
147
148
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
+
148
157
test ('page links to classes annotated with category' , () async {
149
158
topicOneLines.expectMainContentContainsAllInOrder ([
150
159
matches ('<h2>Classes</h2>' ),
@@ -214,7 +223,7 @@ library;
214
223
topicOneLines,
215
224
containsAllInOrder ([
216
225
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>' ),
218
227
matches ('<a href="../lib/C1-class.html">C1</a>' ),
219
228
]),
220
229
);
@@ -225,7 +234,7 @@ library;
225
234
topicOneLines,
226
235
containsAllInOrder ([
227
236
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>' ),
229
238
matches ('<a href="../lib/E1.html">E1</a>' ),
230
239
]),
231
240
);
@@ -236,7 +245,7 @@ library;
236
245
topicOneLines,
237
246
containsAllInOrder ([
238
247
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>' ),
240
249
matches ('<a href="../lib/M1-mixin.html">M1</a>' ),
241
250
]),
242
251
);
@@ -247,7 +256,7 @@ library;
247
256
topicOneLines,
248
257
containsAllInOrder ([
249
258
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>' ),
251
260
matches ('<a href="../lib/c1-constant.html">c1</a>' ),
252
261
]),
253
262
);
@@ -258,7 +267,8 @@ library;
258
267
topicOneLines,
259
268
containsAllInOrder ([
260
269
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>' ),
262
272
matches ('<a href="../lib/p1.html">p1</a>' ),
263
273
]),
264
274
);
@@ -269,7 +279,7 @@ library;
269
279
topicOneLines,
270
280
containsAllInOrder ([
271
281
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>' ),
273
283
matches ('<a href="../lib/F1.html">F1</a>' ),
274
284
]),
275
285
);
@@ -280,7 +290,7 @@ library;
280
290
topicOneLines,
281
291
containsAllInOrder ([
282
292
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>' ),
284
294
matches ('<a href="../lib/T1.html">T1</a>' ),
285
295
]),
286
296
);
@@ -291,7 +301,8 @@ library;
291
301
topicOneLines,
292
302
containsAllInOrder ([
293
303
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>' ),
295
306
matches ('<a href="../lib/Ex.html">Ex</a>' ),
296
307
]),
297
308
);
@@ -302,7 +313,7 @@ library;
302
313
topicOneLines,
303
314
containsAllInOrder ([
304
315
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">'
306
317
'Extension Types</a>' ),
307
318
matches ('<a href="../lib/ExType-extension-type.html">ExType</a>' ),
308
319
]),
0 commit comments