Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
68ff032f
Commit
68ff032f
authored
Feb 14, 2017
by
Adam Barth
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove mentions of ScrollableViewport from flutter_markdown (#8132)
Also, actually run the flutter_markdown tests.
parent
fd30f631
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
33 deletions
+40
-33
test.dart
dev/bots/test.dart
+1
-0
markdown.dart
packages/flutter_markdown/lib/src/markdown.dart
+8
-5
markdown_raw.dart
packages/flutter_markdown/lib/src/markdown_raw.dart
+9
-6
flutter_markdown_test.dart
packages/flutter_markdown/test/flutter_markdown_test.dart
+22
-22
No files found.
dev/bots/test.dart
View file @
68ff032f
...
...
@@ -66,6 +66,7 @@ Future<Null> main() async {
);
await
_runAllDartTests
(
p
.
join
(
flutterRoot
,
'packages'
,
'flutter_driver'
));
await
_runFlutterTest
(
p
.
join
(
flutterRoot
,
'packages'
,
'flutter_test'
));
await
_runFlutterTest
(
p
.
join
(
flutterRoot
,
'packages'
,
'flutter_markdown'
));
await
_runAllDartTests
(
p
.
join
(
flutterRoot
,
'packages'
,
'flutter_tools'
),
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
flutterRoot
},
);
...
...
packages/flutter_markdown/lib/src/markdown.dart
View file @
68ff032f
...
...
@@ -50,11 +50,14 @@ class Markdown extends MarkdownRaw {
}
}
/// A [Widget] that renders markdown formatted text. It supports all standard
/// markdowns from the original markdown specification found here:
/// https://daringfireball.net/projects/markdown/ This class doesn't implement
/// any scrolling behavior, if you want scrolling either wrap the widget in
/// a [ScrollableViewport] or use the [Markdown] widget.
/// A [Widget] that renders markdown formatted text.
///
/// It supports all standard markdowns from the original markdown specification
/// found here: <https://daringfireball.net/projects/markdown/>
///
/// This class doesn't implement any scrolling behavior, if you want scrolling
/// either wrap the widget in a [SingleChildScrollView] or use the [Markdown]
/// widget.
class
MarkdownBody
extends
MarkdownBodyRaw
{
/// Creates a new Markdown [Widget] that renders the markdown formatted string
...
...
packages/flutter_markdown/lib/src/markdown_raw.dart
View file @
68ff032f
...
...
@@ -80,11 +80,14 @@ class MarkdownRaw extends StatelessWidget {
}
}
/// A [Widget] that renders markdown formatted text. It supports all standard
/// markdowns from the original markdown specification found here:
/// https://daringfireball.net/projects/markdown/ This class doesn't implement
/// any scrolling behavior, if you want scrolling either wrap the widget in
/// a [ScrollableViewport] or use the [MarkdownRaw] widget.
/// A [Widget] that renders markdown formatted text.
///
/// It supports all standard markdowns from the original markdown specification
/// found here: <https://daringfireball.net/projects/markdown/>.
///
/// This class doesn't implement any scrolling behavior, if you want scrolling
/// either wrap the widget in a [SingleChildScrollView] or use the [MarkdownRaw]
/// widget.
class
MarkdownBodyRaw
extends
StatefulWidget
{
/// Creates a new Markdown [Widget] that renders the markdown formatted string
...
...
@@ -93,7 +96,7 @@ class MarkdownBodyRaw extends StatefulWidget {
/// highlighting, but it's possible to pass in a custom [syntaxHighlighter].
///
/// Typically, you may want to wrap the [MarkdownBodyRaw] widget in a
/// a [S
crollableViewport
], or use the [Markdown class].
/// a [S
ingleChildScrollView
], or use the [Markdown class].
///
/// ```dart
/// new SingleChildScrollView(
...
...
packages/flutter_markdown/test/flutter_markdown_test.dart
View file @
68ff032f
...
...
@@ -9,31 +9,31 @@ import 'package:flutter/widgets.dart';
import
'package:flutter/material.dart'
;
void
main
(
)
{
testWidgets
(
'Simple string'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'Hello'
));
testWidgets
(
'Simple string'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'Hello'
));
Iterable
<
Widget
>
widgets
=
tester
.
allWidgets
;
_expectWidgetTypes
(
widgets
,
<
Type
>[
MarkdownBody
,
Column
,
Container
,
Padding
,
RichText
]);
_expectTextStrings
(
widgets
,
<
String
>[
'Hello'
]);
});
testWidgets
(
'Header'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'# Header'
));
testWidgets
(
'Header'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'# Header'
));
Iterable
<
Widget
>
widgets
=
tester
.
allWidgets
;
_expectWidgetTypes
(
widgets
,
<
Type
>[
MarkdownBody
,
Column
,
Container
,
Padding
,
RichText
]);
_expectTextStrings
(
widgets
,
<
String
>[
'Header'
]);
});
testWidgets
(
'Empty string'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
''
));
testWidgets
(
'Empty string'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
''
));
Iterable
<
Widget
>
widgets
=
tester
.
allWidgets
;
_expectWidgetTypes
(
widgets
,
<
Type
>[
MarkdownBody
,
Column
]);
});
testWidgets
(
'Ordered list'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'1. Item 1
\n
1. Item 2
\n
2. Item 3'
));
testWidgets
(
'Ordered list'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'1. Item 1
\n
1. Item 2
\n
2. Item 3'
));
Iterable
<
Widget
>
widgets
=
tester
.
allWidgets
;
_expectTextStrings
(
widgets
,
<
String
>[
...
...
@@ -46,8 +46,8 @@ void main() {
);
});
testWidgets
(
'Unordered list'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'- Item 1
\n
- Item 2
\n
- Item 3'
));
testWidgets
(
'Unordered list'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MarkdownBody
(
data:
'- Item 1
\n
- Item 2
\n
- Item 3'
));
Iterable
<
Widget
>
widgets
=
tester
.
allWidgets
;
_expectTextStrings
(
widgets
,
<
String
>[
...
...
@@ -60,13 +60,13 @@ void main() {
);
});
testWidgets
(
'Scrollable wrapping'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Markdown
(
data:
''
));
testWidgets
(
'Scrollable wrapping'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Markdown
(
data:
''
));
List
<
Widget
>
widgets
=
tester
.
allWidgets
.
toList
();
_expectWidgetTypes
(
widgets
.
take
(
2
),
<
Type
>[
Markdown
,
S
crollableViewport
,
S
ingleChildScrollView
,
]);
_expectWidgetTypes
(
widgets
.
reversed
.
take
(
3
).
toList
().
reversed
,
<
Type
>[
Padding
,
...
...
@@ -75,8 +75,8 @@ void main() {
]);
});
testWidgets
(
'Links'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Markdown
(
data:
'[Link Text](href)'
));
testWidgets
(
'Links'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'[Link Text](href)'
));
RichText
textWidget
=
tester
.
allWidgets
.
firstWhere
((
Widget
widget
)
=>
widget
is
RichText
);
TextSpan
span
=
textWidget
.
text
;
...
...
@@ -84,29 +84,29 @@ void main() {
expect
(
span
.
children
[
0
].
recognizer
.
runtimeType
,
equals
(
TapGestureRecognizer
));
});
testWidgets
(
'Changing config - data'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data1'
));
testWidgets
(
'Changing config - data'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data1'
));
_expectTextStrings
(
tester
.
allWidgets
,
<
String
>[
'Data1'
]);
String
stateBefore
=
WidgetsBinding
.
instance
.
renderViewElement
.
toStringDeep
();
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data1'
));
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data1'
));
String
stateAfter
=
WidgetsBinding
.
instance
.
renderViewElement
.
toStringDeep
();
expect
(
stateBefore
,
equals
(
stateAfter
));
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data2'
));
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'Data2'
));
_expectTextStrings
(
tester
.
allWidgets
,
<
String
>[
'Data2'
]);
});
testWidgets
(
'Changing config - style'
,
(
WidgetTester
tester
)
{
testWidgets
(
'Changing config - style'
,
(
WidgetTester
tester
)
async
{
ThemeData
theme
=
new
ThemeData
.
light
();
MarkdownStyle
style1
=
new
MarkdownStyle
.
defaultFromTheme
(
theme
);
MarkdownStyle
style2
=
new
MarkdownStyle
.
largeFromTheme
(
theme
);
tester
.
pumpWidget
(
new
Markdown
(
data:
'Test'
,
markdownStyle:
style1
));
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'Test'
,
markdownStyle:
style1
));
String
stateBefore
=
WidgetsBinding
.
instance
.
renderViewElement
.
toStringDeep
();
tester
.
pumpWidget
(
new
Markdown
(
data:
'Test'
,
markdownStyle:
style2
));
await
tester
.
pumpWidget
(
new
Markdown
(
data:
'Test'
,
markdownStyle:
style2
));
String
stateAfter
=
WidgetsBinding
.
instance
.
renderViewElement
.
toStringDeep
();
expect
(
stateBefore
,
isNot
(
stateAfter
));
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment