@@ -35,6 +35,81 @@ void main() {
3535 argv..addAll (['--input' , packageRoot.path])..addAll (outputParam)));
3636 }
3737
38+ group ('Option handling' , () {
39+ Dartdoc dartdoc;
40+ DartdocResults results;
41+ PackageGraph p;
42+
43+ setUp (() async {
44+ dartdoc = await buildDartdoc ([], testPackageOptions);
45+ results = await dartdoc.generateDocsBase ();
46+ p = results.packageGraph;
47+ });
48+
49+ test ('generator parameters' , () async {
50+ File favicon = new File (
51+ pathLib.joinAll ([tempDir.path, 'static-assets' , 'favicon.png' ]));
52+ File index = new File (pathLib.joinAll ([tempDir.path, 'index.html' ]));
53+ expect (favicon.readAsStringSync (),
54+ contains ('Not really a png, but a test file' ));
55+ String indexString = index.readAsStringSync ();
56+ expect (indexString, contains ('Footer things' ));
57+ expect (indexString, contains ('footer.txt data' ));
58+ expect (indexString, contains ('HTML header file' ));
59+ });
60+
61+ test ('examplePathPrefix' , () async {
62+ Class UseAnExampleHere = p.allCanonicalModelElements
63+ .firstWhere ((ModelElement c) => c.name == 'UseAnExampleHere' );
64+ expect (
65+ UseAnExampleHere .documentationAsHtml,
66+ contains (
67+ 'An example of an example in an unusual example location.' ));
68+ });
69+
70+ test ('includeExternal and showUndocumentedCategories' , () async {
71+ Class Something = p.allCanonicalModelElements
72+ .firstWhere ((ModelElement c) => c.name == 'Something' );
73+ expect (Something .isPublic, isTrue);
74+ expect (Something .displayedCategories, isNotEmpty);
75+ });
76+ });
77+
78+ group ('Option handling with cross-linking' , () {
79+ DartdocResults results;
80+ Package testPackageOptions;
81+
82+ setUp (() async {
83+ results = await (await buildDartdoc (
84+ ['--link-to-remote' ], testPackageOptionsImporter))
85+ .generateDocsBase ();
86+ testPackageOptions = results.packageGraph.packages
87+ .firstWhere ((Package p) => p.name == 'test_package_options' );
88+ });
89+
90+ test ('linkToUrl' , () async {
91+ Library main = testPackageOptions.allLibraries
92+ .firstWhere ((Library l) => l.name == 'main' );
93+ Class UseAnExampleHere = main.allClasses
94+ .firstWhere ((Class c) => c.name == 'UseAnExampleHere' );
95+ expect (testPackageOptions.documentedWhere,
96+ equals (DocumentLocation .remote));
97+ expect (
98+ UseAnExampleHere .href,
99+ equals (
100+ 'https://nonexistingsuperpackage.topdomain/test_package_options/0.0.1/main/UseAnExampleHere-class.html' ));
101+ });
102+
103+ test ('includeExternal works via remote' , () async {
104+ Library unusualLibrary = testPackageOptions.allLibraries
105+ .firstWhere ((Library l) => l.name == 'unusualLibrary' );
106+ expect (
107+ unusualLibrary.allClasses
108+ .firstWhere ((Class c) => c.name == 'Something' ),
109+ isNotNull);
110+ });
111+ });
112+
38113 test ('with broken reexport chain' , () async {
39114 Dartdoc dartdoc = await buildDartdoc ([], testPackageImportExportError);
40115 DartdocResults results = await dartdoc.generateDocsBase ();
0 commit comments