implemented comprehensive accessibility (A11y) support across the app
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:marianum_mobile/widget/a11y/a11y_labels.dart';
|
||||
|
||||
void main() {
|
||||
setUpAll(() async {
|
||||
// appointmentLabel formatiert über formatHm() (Jiffy) – Locale einmal laden.
|
||||
await Jiffy.setLocale('de');
|
||||
});
|
||||
|
||||
group('A11yLabels.appointmentLabel', () {
|
||||
test('setzt Fach, Ort und Zeitspanne zusammen', () {
|
||||
final label = A11yLabels.appointmentLabel(
|
||||
subject: 'Mathe',
|
||||
location: 'Raum 101',
|
||||
start: DateTime(2026, 5, 8, 8, 0),
|
||||
end: DateTime(2026, 5, 8, 8, 45),
|
||||
crossedOut: false,
|
||||
);
|
||||
expect(label, 'Mathe, Raum 101, 08:00–08:45');
|
||||
});
|
||||
|
||||
test('hängt bei Ausfall den Ausfall-Hinweis an', () {
|
||||
final label = A11yLabels.appointmentLabel(
|
||||
subject: 'Deutsch',
|
||||
location: 'Raum 5',
|
||||
start: DateTime(2026, 5, 8, 9, 0),
|
||||
end: DateTime(2026, 5, 8, 9, 45),
|
||||
crossedOut: true,
|
||||
);
|
||||
expect(label, endsWith(A11yLabels.cancelled));
|
||||
expect(label, 'Deutsch, Raum 5, 09:00–09:45, Ausfall');
|
||||
});
|
||||
|
||||
test('glättet Zeilenumbrüche im Ort zu Trennern', () {
|
||||
final label = A11yLabels.appointmentLabel(
|
||||
subject: 'Sport',
|
||||
location: 'Halle\nHr. Müller',
|
||||
start: DateTime(2026, 5, 8, 10, 0),
|
||||
end: DateTime(2026, 5, 8, 10, 45),
|
||||
crossedOut: false,
|
||||
);
|
||||
expect(label, 'Sport, Halle, Hr. Müller, 10:00–10:45');
|
||||
});
|
||||
|
||||
test('lässt einen leeren Ort weg', () {
|
||||
final label = A11yLabels.appointmentLabel(
|
||||
subject: 'Pause',
|
||||
location: '',
|
||||
start: DateTime(2026, 5, 8, 11, 0),
|
||||
end: DateTime(2026, 5, 8, 11, 15),
|
||||
crossedOut: false,
|
||||
);
|
||||
expect(label, 'Pause, 11:00–11:15');
|
||||
});
|
||||
});
|
||||
|
||||
group('A11yLabels.moreAppointments', () {
|
||||
test('pluralisiert die Overflow-Beschriftung', () {
|
||||
expect(A11yLabels.moreAppointments(3), '+3 weitere Termine');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user