Skip to content

Commit 7396c1a

Browse files
committed
Display 'Available extensions' in more, correct, places
We weren't displaying them on enums, mixins, or extension types. Also fixed some capitalization, and margins.
1 parent dc56630 commit 7396c1a

File tree

11 files changed

+185
-113
lines changed

11 files changed

+185
-113
lines changed

lib/resources/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ footer a, footer a:hover {
661661
}
662662

663663
.markdown.desc {
664+
margin-bottom: 1em;
664665
max-width: 700px;
665666
}
666667

lib/src/generator/templates.aot_renderers_for_html.dart

Lines changed: 127 additions & 100 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ #hasPotentiallyApplicableExtensions }}
2+
<dt>Available extensions</dt>
3+
<dd><ul class="comma-separated clazz-relationships">
4+
{{ #potentiallyApplicableExtensionsSorted }}
5+
<li>{{{ linkedName }}}</li>
6+
{{ /potentiallyApplicableExtensionsSorted }}
7+
</ul></dd>
8+
{{ /hasPotentiallyApplicableExtensions }}

lib/templates/_mixed_in_types.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ #hasPublicMixedInTypes }}
2-
<dt>Mixed in types</dt>
2+
<dt>Mixed-in types</dt>
33
<dd>
44
<ul class="comma-separated {{ relationshipsClass }}">
55
{{ #publicMixedInTypes }}

lib/templates/class.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@
2828
</ul></dd>
2929
{{ /hasPublicImplementers }}
3030

31-
{{ #hasPotentiallyApplicableExtensions }}
32-
<dt>Available Extensions</dt>
33-
<dd><ul class="comma-separated clazz-relationships">
34-
{{ #potentiallyApplicableExtensionsSorted }}
35-
<li>{{{ linkedName }}}</li>
36-
{{ /potentiallyApplicableExtensionsSorted }}
37-
</ul></dd>
38-
{{ /hasPotentiallyApplicableExtensions }}
39-
31+
{{ >available_extensions }}
4032
{{ >container_annotations }}
4133
</dl>
4234
</section>

lib/templates/enum.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ <h1>
2323
{{ >super_chain }}
2424
{{ >interfaces }}
2525
{{ >mixed_in_types }}
26+
{{ >available_extensions }}
2627
{{ >container_annotations }}
2728
</dl>
2829
</section>

lib/templates/extension_type.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
{{ /publicImplementersSorted }}
3232
</ul></dd>
3333
{{ /hasPublicImplementers }}
34+
{{ >available_extensions }}
3435
</dl>
3536
{{ >container_annotations }}
3637
</section>

lib/templates/mixin.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<section>
1717
<dl class="dl-horizontal">
1818
{{ #hasPublicSuperclassConstraints }}
19-
<dt>Superclass Constraints</dt>
19+
<dt>Superclass constraints</dt>
2020
<dd><ul class="comma-separated dark mixin-relationships">
2121
{{ #publicSuperclassConstraints }}
2222
<li>{{{ linkedName }}}</li>
@@ -28,7 +28,7 @@
2828
{{ >interfaces }}
2929

3030
{{ #hasPublicImplementers }}
31-
<dt>Mixin Applications</dt>
31+
<dt>Mixin applications</dt>
3232
<dd>
3333
<ul class="comma-separated mixin-relationships">
3434
{{ #publicImplementersSorted }}
@@ -37,6 +37,7 @@
3737
</ul>
3838
</dd>
3939
{{ /hasPublicImplementers }}
40+
{{ >available_extensions }}
4041

4142
{{ >annotations }}
4243
</dl>

test/templates/class_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ mixin M on _M {}
149149
]);
150150
}
151151

152+
void test_availableExtensions_direct() async {
153+
await createPackageWithLibrary('''
154+
class C {}
155+
extension E on C {}
156+
''');
157+
var baseLines = readLines(['lib', 'C-class.html']);
158+
159+
baseLines.expectMainContentContainsAllInOrder([
160+
matches('<dt>Available extensions</dt>'),
161+
matches('<dd><ul class="comma-separated clazz-relationships">'),
162+
matches('<li><a href="../lib/E.html">E</a></li>'),
163+
matches('</ul></dd>'),
164+
]);
165+
}
166+
152167
void test_constructor_named() async {
153168
await createPackageWithLibrary('''
154169
class C {

test/templates/enum_test.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ enum EnumWithDefaultConstructor {
9191
/// Doc comment for [six].
9292
six;
9393
}
94+
95+
extension Ext<T> on E<T> {}
9496
'''),
9597
],
9698
resourceProvider: resourceProvider,
@@ -158,13 +160,22 @@ enum EnumWithDefaultConstructor {
158160
expect(
159161
eLines,
160162
containsAllInOrder([
161-
matches('<dt>Mixed in types</dt>'),
163+
matches('<dt>Mixed-in types</dt>'),
162164
matches('<a href="../lib/M-mixin.html">M</a>'
163165
'<span class="signature">&lt;<wbr>'
164166
'<span class="type-parameter">T</span>&gt;</span>'),
165167
]));
166168
});
167169

170+
test('enum page contains available extensions', () async {
171+
expect(
172+
eLines,
173+
containsAllInOrder([
174+
matches('<dt>Available extensions</dt>'),
175+
matches('<a href="../lib/E.html">E</a></span>'),
176+
]));
177+
});
178+
168179
test('enum page contains annotations', () async {
169180
eLines.expectMainContentContainsAllInOrder([
170181
matches('<dt>Annotations</dt>'),

0 commit comments

Comments
 (0)