halkyon/packages/halkyon_ui/test/widget/skeleton_test.dart
Tizian 「ティツィアーン」 5641285d31
feat(learn): Explore by what a licence allows, a skeleton while the library loads, and an assistant's agreement per provider (ADR 0005, rule 12; ADR 0021, D66)
- Explore filters by what a studyset's licence lets a learner do: adapt
  it (no NoDerivatives) and use it commercially (no NonCommercial),
  which the instance reads from the release's licence
  (ExploreQuery.adaptable, commercial) and the app the same way
  (LicenseUse). An instance from before ignores both.
- While the studysets are read, the Library shows shimmering skeletons
  of their cards rather than a spinner: halkyon_ui's new Shimmer and
  SkeletonBox, still where the system asks for no animations.
- The scope's "Include private studysets" is offered only while the
  person has a private studyset.
- An agreement to what goes where is per provider (protocol and host):
  agreeing to one assistant agrees to every assistant of that provider,
  those granted later too, and the agreement sheet says so. No
  migration: it is written on every grant of the provider, so taking
  one back keeps it for the others, and read per provider from any of
  them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-02 05:19:18 +01:00

46 lines
1.5 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
void main() {
Future<void> show(WidgetTester tester, {bool still = false}) =>
tester.pumpWidget(
MaterialApp(
theme: appTheme(Brightness.light),
home: MediaQuery(
data: MediaQueryData(disableAnimations: still),
child: const Scaffold(
body: Shimmer(
child: Column(
children: [
SkeletonBox(width: 120, height: 18),
SkeletonBox(height: 12),
],
),
),
),
),
),
);
testWidgets('a skeleton stands where content will, in the theme’s '
'muted colour, a light band sweeping across it', (tester) async {
await show(tester);
expect(tester.getSize(find.byType(SkeletonBox).first), const Size(120, 18));
expect(find.byType(ShaderMask), findsOneWidget);
expect(tester.hasRunningAnimations, isTrue);
await tester.pump(const Duration(seconds: 1));
expect(tester.hasRunningAnimations, isTrue, reason: 'sweeping on');
});
testWidgets('it stands still where the system asks for no animations', (
tester,
) async {
await show(tester, still: true);
expect(find.byType(SkeletonBox), findsNWidgets(2));
expect(find.byType(ShaderMask), findsNothing);
expect(tester.hasRunningAnimations, isFalse);
});
}