This commit was merged in pull request #295.
This commit is contained in:
@@ -938,10 +938,13 @@ class _UnsubscribeChip extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final uri = _parseUnsubscribeUri(header);
|
final uri = _parseUnsubscribeUri(header);
|
||||||
if (uri == null) return const SizedBox.shrink();
|
if (uri == null) return const SizedBox.shrink();
|
||||||
return ActionChip(
|
return Tooltip(
|
||||||
avatar: const Icon(Icons.unsubscribe_outlined, size: 16),
|
message: uri.toString(),
|
||||||
label: const Text('Unsubscribe'),
|
child: ActionChip(
|
||||||
onPressed: () => launchUrl(uri, mode: LaunchMode.externalApplication),
|
avatar: const Icon(Icons.unsubscribe_outlined, size: 16),
|
||||||
|
label: const Text('Unsubscribe'),
|
||||||
|
onPressed: () => launchUrl(uri, mode: LaunchMode.externalApplication),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -475,6 +475,44 @@ void main() {
|
|||||||
expect(find.text('Share'), findsOneWidget);
|
expect(find.text('Share'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets(
|
||||||
|
'long-press on unsubscribe chip shows URL tooltip',
|
||||||
|
(tester) async {
|
||||||
|
final email = testEmail(
|
||||||
|
listUnsubscribeHeader: '<https://example.com/unsubscribe>',
|
||||||
|
);
|
||||||
|
await tester.pumpWidget(
|
||||||
|
buildApp(
|
||||||
|
initialLocation:
|
||||||
|
'/accounts/acc-1/mailboxes/INBOX/emails/acc-1%3A42',
|
||||||
|
overrides: _overrides(
|
||||||
|
body: const EmailBody(emailId: 'acc-1:42', attachments: []),
|
||||||
|
email: email,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.text('Unsubscribe'), findsOneWidget);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
find.byWidgetPredicate(
|
||||||
|
(w) =>
|
||||||
|
w is Tooltip && w.message == 'https://example.com/unsubscribe',
|
||||||
|
),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.longPress(find.text('Unsubscribe'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
find.text('https://example.com/unsubscribe'),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('Show Mail Structure opens dialog with MIME parts', (
|
testWidgets('Show Mail Structure opens dialog with MIME parts', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -588,6 +588,7 @@ Email testEmail({
|
|||||||
bool isSeen = false,
|
bool isSeen = false,
|
||||||
bool isFlagged = false,
|
bool isFlagged = false,
|
||||||
bool hasAttachment = false,
|
bool hasAttachment = false,
|
||||||
|
String? listUnsubscribeHeader,
|
||||||
}) =>
|
}) =>
|
||||||
Email(
|
Email(
|
||||||
id: id,
|
id: id,
|
||||||
@@ -603,6 +604,7 @@ Email testEmail({
|
|||||||
isSeen: isSeen,
|
isSeen: isSeen,
|
||||||
isFlagged: isFlagged,
|
isFlagged: isFlagged,
|
||||||
hasAttachment: hasAttachment,
|
hasAttachment: hasAttachment,
|
||||||
|
listUnsubscribeHeader: listUnsubscribeHeader,
|
||||||
);
|
);
|
||||||
|
|
||||||
class FakeSearchHistoryRepository implements SearchHistoryRepository {
|
class FakeSearchHistoryRepository implements SearchHistoryRepository {
|
||||||
|
|||||||
Reference in New Issue
Block a user