mirror of
https://github.com/flutter/packages.git
synced 2025-07-04 01:33:59 +08:00
[flutter_markdown] fix for latest pkg:markdown part 2 (#2797)
This commit is contained in:
@ -6,6 +6,7 @@ import 'package:flutter/gestures.dart';
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'utils.dart';
|
import 'utils.dart';
|
||||||
|
|
||||||
void main() => defineTests();
|
void main() => defineTests();
|
||||||
@ -628,7 +629,13 @@ void defineTests() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expectValidLink('link');
|
expectValidLink('link');
|
||||||
|
if (!newMarkdown) {
|
||||||
|
// For pkg:markdown <= v6.0.1
|
||||||
expectLinkTap(linkTapResults, const MarkdownLink('link', 'foo\bar'));
|
expectLinkTap(linkTapResults, const MarkdownLink('link', 'foo\bar'));
|
||||||
|
} else {
|
||||||
|
// For pkg:markdown > v6.0.1
|
||||||
|
expectLinkTap(linkTapResults, const MarkdownLink('link', 'foo%08ar'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -649,8 +656,15 @@ void defineTests() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expectValidLink('link');
|
expectValidLink('link');
|
||||||
|
if (!newMarkdown) {
|
||||||
|
// For pkg:markdown <= v6.0.1
|
||||||
expectLinkTap(
|
expectLinkTap(
|
||||||
linkTapResults, const MarkdownLink('link', 'foo%20bä'));
|
linkTapResults, const MarkdownLink('link', 'foo%20bä'));
|
||||||
|
} else {
|
||||||
|
// For pkg:markdown > v6.0.1
|
||||||
|
expectLinkTap(
|
||||||
|
linkTapResults, const MarkdownLink('link', 'foo%20b%C3%A4'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -759,8 +773,15 @@ void defineTests() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expectValidLink('link');
|
expectValidLink('link');
|
||||||
|
if (!newMarkdown) {
|
||||||
|
// For pkg:markdown <= v6.0.1
|
||||||
expectLinkTap(linkTapResults,
|
expectLinkTap(linkTapResults,
|
||||||
const MarkdownLink('link', '/url', 'title %22"'));
|
const MarkdownLink('link', '/url', 'title %22"'));
|
||||||
|
} else {
|
||||||
|
// For pkg:markdown > v6.0.1
|
||||||
|
expectLinkTap(linkTapResults,
|
||||||
|
const MarkdownLink('link', '/url', 'title ""'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -781,8 +802,15 @@ void defineTests() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expectValidLink('link');
|
expectValidLink('link');
|
||||||
|
if (!newMarkdown) {
|
||||||
|
// For pkg:markdown <= v6.0.1
|
||||||
expectLinkTap(linkTapResults,
|
expectLinkTap(linkTapResults,
|
||||||
const MarkdownLink('link', '/url\u{C2A0}%22title%22'));
|
const MarkdownLink('link', '/url\u{C2A0}%22title%22'));
|
||||||
|
} else {
|
||||||
|
// For pkg:markdown > v6.0.1
|
||||||
|
expectLinkTap(linkTapResults,
|
||||||
|
const MarkdownLink('link', '/url%EC%8A%A0%22title%22'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -825,8 +853,17 @@ void defineTests() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expectValidLink('link');
|
expectValidLink('link');
|
||||||
|
if (!newMarkdown) {
|
||||||
|
// For pkg:markdown <= v6.0.1
|
||||||
expectLinkTap(linkTapResults,
|
expectLinkTap(linkTapResults,
|
||||||
const MarkdownLink('link', '/url', 'title %22and%22 title'));
|
const MarkdownLink('link', '/url', 'title %22and%22 title'));
|
||||||
|
} else {
|
||||||
|
// For pkg:markdown > v6.0.1
|
||||||
|
expectLinkTap(
|
||||||
|
linkTapResults,
|
||||||
|
const MarkdownLink('link', '/url', 'title "and" title'),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -5,13 +5,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:markdown/markdown.dart' as md show version;
|
|
||||||
|
|
||||||
import 'utils.dart';
|
import 'utils.dart';
|
||||||
|
|
||||||
// TODO(kevmoo): delete this once the min version of pkg:markdown is updated
|
|
||||||
final bool _newMarkdown = md.version.compareTo('6.0.1') > 0;
|
|
||||||
|
|
||||||
void main() => defineTests();
|
void main() => defineTests();
|
||||||
|
|
||||||
void defineTests() {
|
void defineTests() {
|
||||||
@ -395,7 +391,7 @@ void defineTests() {
|
|||||||
|
|
||||||
expectTableSize(3, 2);
|
expectTableSize(3, 2);
|
||||||
|
|
||||||
if (!_newMarkdown) {
|
if (!newMarkdown) {
|
||||||
// For pkg:markdown <= v6.0.1
|
// For pkg:markdown <= v6.0.1
|
||||||
expect(find.byType(RichText), findsNWidgets(6));
|
expect(find.byType(RichText), findsNWidgets(6));
|
||||||
final List<String?> text = find
|
final List<String?> text = find
|
||||||
@ -464,7 +460,7 @@ void defineTests() {
|
|||||||
.toList();
|
.toList();
|
||||||
expect(text[0], '| abc | def | | --- | | bar |');
|
expect(text[0], '| abc | def | | --- | | bar |');
|
||||||
},
|
},
|
||||||
skip: !_newMarkdown,
|
skip: !newMarkdown,
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
@ -489,7 +485,7 @@ void defineTests() {
|
|||||||
|
|
||||||
expectTableSize(3, 2);
|
expectTableSize(3, 2);
|
||||||
|
|
||||||
if (!_newMarkdown) {
|
if (!newMarkdown) {
|
||||||
// For pkg:markdown <= v6.0.1
|
// For pkg:markdown <= v6.0.1
|
||||||
expect(find.byType(RichText), findsNWidgets(5));
|
expect(find.byType(RichText), findsNWidgets(5));
|
||||||
final List<String?> cellText = find
|
final List<String?> cellText = find
|
||||||
|
@ -9,6 +9,10 @@ import 'package:flutter/gestures.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:markdown/markdown.dart' as md show version;
|
||||||
|
|
||||||
|
// TODO(Zhiguang): delete this once the min version of pkg:markdown is updated
|
||||||
|
final bool newMarkdown = md.version.compareTo('6.0.1') > 0;
|
||||||
|
|
||||||
final TextTheme textTheme = Typography.material2018()
|
final TextTheme textTheme = Typography.material2018()
|
||||||
.black
|
.black
|
||||||
|
Reference in New Issue
Block a user