fix(learn): an editor with nobody signed in above it checks nothing
The full window editor is also shown without a person's scope, as a privacy test pumps it, where GrammarHost asserted for want of one. halkyon_app's PersonScope gains maybeOf beside of. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
c23c0c80a1
commit
46be998329
2 changed files with 39 additions and 7 deletions
|
|
@ -26,6 +26,14 @@ class const PersonScope({
|
|||
return scope!.dependencies as P;
|
||||
}
|
||||
|
||||
/// As [of], or null where nobody is signed in above [context]: for what
|
||||
/// also shows outside a person's app and does without their data there.
|
||||
static P? maybeOf<P extends Disposable>(BuildContext context) =>
|
||||
context
|
||||
.getInheritedWidgetOfExactType<_PersonDependenciesScope>()
|
||||
?.dependencies
|
||||
as P?;
|
||||
|
||||
@override
|
||||
State<PersonScope> createState() => _PersonScopeState();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,23 @@ void main() {
|
|||
expect(find.text('Data of ada'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('maybeOf finds the dependencies of the person signed in '
|
||||
'above, and none where nobody is', (tester) async {
|
||||
TestPerson? found;
|
||||
Widget looking() => Builder(
|
||||
builder: (context) {
|
||||
found = PersonScope.maybeOf<TestPerson>(context);
|
||||
return const SizedBox();
|
||||
},
|
||||
);
|
||||
|
||||
await show(tester, PersonScope(person: ada, child: looking()));
|
||||
expect(found?.person, ada);
|
||||
|
||||
await show(tester, looking());
|
||||
expect(found, isNull);
|
||||
});
|
||||
|
||||
testWidgets("closes the person's data when it goes away", (tester) async {
|
||||
await show(tester, const PersonScope(person: ada, child: _Person()));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue