feat: show real neighboring pages during back and forward swipes
This commit is contained in:
parent
4e07c9a305
commit
c104c2026b
7 changed files with 283 additions and 71 deletions
39
app/test/fetch_actor_test.dart
Normal file
39
app/test/fetch_actor_test.dart
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import 'package:actors/actors.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:mews/application/actors/fetch_actor.dart';
|
||||
|
||||
const page = '''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><title>Parsed</title><meta name="mews-profile" content="0.1" /></head>
|
||||
<body><p>Some content.</p></body>
|
||||
</html>
|
||||
''';
|
||||
|
||||
void main() {
|
||||
test('ParseSource parses without touching the network', () async {
|
||||
final actor = Actor.create(FetchHandler.new);
|
||||
addTearDown(actor.close);
|
||||
|
||||
final result = await actor
|
||||
.send(const ParseSource(url: 'https://example.com/parsed.html', source: page));
|
||||
|
||||
expect(result, isA<FetchPageOk>());
|
||||
final ok = result as FetchPageOk;
|
||||
expect(ok.page.title, 'Parsed');
|
||||
expect(ok.page.isMews, isTrue);
|
||||
expect(ok.notModified, isFalse);
|
||||
});
|
||||
|
||||
test('ParseSource reports broken markup with its source', () async {
|
||||
final actor = Actor.create(FetchHandler.new);
|
||||
addTearDown(actor.close);
|
||||
|
||||
final result = await actor.send(
|
||||
const ParseSource(url: 'https://example.com/broken.html', source: '<p>nope'));
|
||||
|
||||
expect(result, isA<FetchParseError>());
|
||||
expect((result as FetchParseError).source, '<p>nope');
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue