feat: show real neighboring pages during back and forward swipes

This commit is contained in:
randogoth 2026-10-11 11:05:03 +03:00
parent 4e07c9a305
commit c104c2026b
7 changed files with 283 additions and 71 deletions

View 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');
});
}