A source is now shared by learning paths and studysets (core/citation/): authors as full names, year, title, what it is a part of, publisher, ISBN, link, and a citation kept as a file brought it. formatCitation cites it in APA 7, MLA 9 or Chicago 18: it inverts and abbreviates names itself (particles, suffixes, names written as already cited stay), sets a work of its own in italics and a part of something apart from the whole, and writes a missing year as "n.d." in APA and Chicago. - Settings: a Citations card per device, with a preview and a link to the style's own guide. - Studysets: a Bibliography button opens the works cited, to read and, behind its pencil, to change (studyset schema 4). - Steps: sources edited through the same sheet, opened from an "N sources" button in the runner (step schema 2; schema 1 reads on). - Path import: steps' sources, text kept as written, the old format's "citation" read as what a source is part of. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
59 lines
2 KiB
Dart
59 lines
2 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/about/bloc/about_bloc.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/about/data/about_repository.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
import '../../support/fake_about_gateway.dart';
|
|
import '../../support/pump_app.dart';
|
|
import '../../support/test_dependencies.dart';
|
|
|
|
void main() {
|
|
group('AboutBloc', () {
|
|
test('finds where the instance says its source is', () async {
|
|
final bloc = AboutBloc(AboutRepository(FakeAboutGateway()))
|
|
..add(const AboutEventStarted());
|
|
addTearDown(bloc.close);
|
|
|
|
await expectLater(
|
|
bloc.stream,
|
|
emits(const AboutStateLoaded('https://example.org/halkyon-learn')),
|
|
);
|
|
});
|
|
|
|
test('says so when the instance cannot be reached', () async {
|
|
final gateway = FakeAboutGateway()
|
|
..unreachable = Exception('No connection');
|
|
final bloc = AboutBloc(AboutRepository(gateway))
|
|
..add(const AboutEventStarted());
|
|
addTearDown(bloc.close);
|
|
|
|
await expectLater(bloc.stream, emits(const AboutStateUnreachable()));
|
|
});
|
|
});
|
|
|
|
testWidgets('profile → settings → about shows the licences and the source', (
|
|
tester,
|
|
) async {
|
|
await pumpApp(tester, testDependencies());
|
|
|
|
await openTab(tester, 'Profile');
|
|
await tester.tap(find.byTooltip('Settings'));
|
|
await tester.pumpAndSettle();
|
|
await tester.scrollUntilVisible(
|
|
find.text('About Halkyon Learn'),
|
|
200,
|
|
// The citation preview is selectable, a scroll view of its own.
|
|
scrollable: find.byType(Scrollable).first,
|
|
);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('About Halkyon Learn'));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(
|
|
find.textContaining('GNU Affero General Public License'),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text('https://example.org/halkyon-learn'), findsOneWidget);
|
|
expect(find.text('View licenses'), findsOneWidget);
|
|
});
|
|
}
|