Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPLAT-15997 Scope Queries to the Body Element #37

Merged
merged 3 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/react/render/render.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ RenderResult render(
/// {@category Queries}
@sealed
class RenderResult extends ScopedQueries {
RenderResult._(this._jsRenderResult, this._renderedElement) : super(() => _jsRenderResult.container);
RenderResult._(this._jsRenderResult, this._renderedElement) : super(() => _jsRenderResult.baseElement);

final JsRenderResult _jsRenderResult;

Expand Down
3 changes: 2 additions & 1 deletion test/unit/dom/matchers/has_form_values_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void main() {
group('hasFormValues matcher', () {
const rootElemTestId = 'root-of-test-form';
RenderResult renderFormWithValues(
/*ReactDomComponentFactoryProxy*/ dynamic rootElem, List<_FormElemDefinition> els) {
/*ReactDomComponentFactoryProxy*/ dynamic rootElem,
List<_FormElemDefinition> els) {
Comment on lines +42 to +43
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are formatting changes.. I'm not sure why they're there (I formatted on 2.13.4). The only real change is in render.dart and then any test files

assert(rootElem == react.form || rootElem == react.fieldset);

final vDom = rootElem(
Expand Down
4 changes: 1 addition & 3 deletions test/unit/dom/matchers/is_partially_checked_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ void main() {
});

test('An element with role="checkbox"', () {
final cboxEl = DivElement()
..setAttribute('role', 'checkbox')
..setAttribute('aria-checked', 'mixed');
final cboxEl = DivElement()..setAttribute('role', 'checkbox')..setAttribute('aria-checked', 'mixed');
shouldPass(cboxEl, isPartiallyChecked);
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/unit/dom/queries/by_label_text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('no form control was found associated to that label')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -105,7 +105,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('no form control was found associated to that label')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -121,7 +121,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('no form control was found associated to that label')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -138,7 +138,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('no form control was found associated to that label')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down
32 changes: 16 additions & 16 deletions test/unit/dom/queries/by_role_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "dialog"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -124,7 +124,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "dialog"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -141,7 +141,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "dialog"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -159,7 +159,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "dialog"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down Expand Up @@ -202,7 +202,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "option"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -220,7 +220,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "option"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -237,7 +237,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "option"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -255,7 +255,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "option"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down Expand Up @@ -498,7 +498,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "checkbox"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -516,7 +516,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "checkbox"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -533,7 +533,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "checkbox"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -551,7 +551,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "checkbox"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down Expand Up @@ -699,7 +699,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "switch"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -717,7 +717,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "switch"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -734,7 +734,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "switch"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -752,7 +752,7 @@ void main() {
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an accessible element with the role "switch"')),
hasToStringValue(contains('Here are the accessible roles:')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down
40 changes: 20 additions & 20 deletions test/unit/dom/queries/by_testid_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand All @@ -76,7 +76,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -96,7 +96,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -116,7 +116,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand Down Expand Up @@ -154,7 +154,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand All @@ -164,7 +164,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -184,7 +184,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -201,7 +201,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -223,7 +223,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -245,7 +245,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down Expand Up @@ -290,7 +290,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-3"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand All @@ -300,7 +300,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -324,7 +324,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -344,7 +344,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-3"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand Down Expand Up @@ -386,7 +386,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="testId-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});

Expand All @@ -396,7 +396,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -420,7 +420,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Unable to find an element by: [$defaultTestIdKey="fail"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -437,7 +437,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -461,7 +461,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand All @@ -485,7 +485,7 @@ void main() {
throwsA(allOf(
isA<TestingLibraryElementError>(),
hasToStringValue(contains('Found multiple elements by: [$defaultTestIdKey="estid-2"]')),
hasToStringValue(contains(rtl.prettyDOM(view.container))),
hasToStringValue(contains(rtl.prettyDOM(view.baseElement))),
)));
});
});
Expand Down
Loading