@@ -168,6 +168,8 @@ void main() {
168
168
TopLevelVariable testingCodeSyntaxInOneLiners;
169
169
170
170
Class specialList;
171
+ Class baseForDocComments;
172
+ Method doAwesomeStuff;
171
173
Class subForDocComments;
172
174
173
175
ModelFunction short;
@@ -196,9 +198,72 @@ void main() {
196
198
subForDocComments =
197
199
fakeLibrary.classes.firstWhere ((c) => c.name == 'SubForDocComments' );
198
200
201
+ baseForDocComments =
202
+ fakeLibrary.classes.firstWhere ((c) => c.name == 'BaseForDocComments' );
203
+ doAwesomeStuff = baseForDocComments.instanceMethods
204
+ .firstWhere ((m) => m.name == 'doAwesomeStuff' );
205
+
199
206
short = fakeLibrary.functions.firstWhere ((f) => f.name == 'short' );
200
207
});
201
208
209
+ group ('doc references' , () {
210
+ String docsAsHtml;
211
+
212
+ setUp (() {
213
+ docsAsHtml = doAwesomeStuff.documentationAsHtml;
214
+ });
215
+
216
+ test ('codeifies a class from the SDK' , () {
217
+ expect (docsAsHtml,
218
+ contains ('<code class="prettyprint lang-dart">String</code>' ));
219
+ });
220
+
221
+ test ('codeifies a reference to its parameter' , () {
222
+ expect (docsAsHtml,
223
+ contains ('<code class="prettyprint lang-dart">value</code>' ));
224
+ });
225
+
226
+ test ('links to a reference to its class' , () {
227
+ expect (docsAsHtml, contains (
228
+ '<a href="fake/BaseForDocComments-class.html">BaseForDocComments</a>' ));
229
+ });
230
+
231
+ test ('links to a reference to a top-level const' , () {
232
+ expect (
233
+ docsAsHtml, contains ('<a href="">NAME_WITH_TWO_UNDERSCORES</a>' ));
234
+ });
235
+
236
+ test ('links to a method in this class' , () {
237
+ expect (docsAsHtml, contains (
238
+ '<a href="fake/BaseForDocComments/anotherMethod.html">anotherMethod</a>' ));
239
+ });
240
+
241
+ test ('links to a top-level function in this library' , () {
242
+ expect (docsAsHtml, contains (
243
+ '<a href="fake/topLevelFunction.html">topLevelFunction</a>' ));
244
+ });
245
+
246
+ test ('links to top-level function from an imported library' , () {
247
+ expect (
248
+ docsAsHtml, contains ('<a href="ex/function1.html">function1</a>' ));
249
+ });
250
+
251
+ test ('links to a class from an imported lib' , () {
252
+ expect (docsAsHtml, contains ('<a href="ex/Apple-class.html">Apple</a>' ));
253
+ });
254
+
255
+ test ('links to a top-level const from an imported lib' , () {
256
+ expect (docsAsHtml, contains (
257
+ '<a href="fake/incorrectDocReference.html">incorrectDocReference</a>' ));
258
+ });
259
+
260
+ test ('links to a top-level variable with a prefix from an imported lib' ,
261
+ () {
262
+ expect (docsAsHtml,
263
+ contains ('<a href="">css.theOnlyThingInTheLibrary</a>' ));
264
+ });
265
+ });
266
+
202
267
test ('multi-underscore names in brackets do not become italicized' , () {
203
268
expect (short.documentation, contains ('[NAME_WITH_TWO_UNDERSCORES]' ));
204
269
expect (short.documentation, contains ('[NAME_SINGLEUNDERSCORE]' ));
0 commit comments