Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
greglittlefield-wf committed Nov 7, 2023
1 parent 35cff8e commit 09d0a68
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions example/test/get_dom_node_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class _SimpleComponent extends react.Component2 {
var refToElement;

@override
componentWillUnmount() => print("unmount");
componentWillUnmount() => print('unmount');

@override
componentDidMount() {
print("mount");
print('mount');
customAssert('ref to span return span ', refToSpan.text == 'Test');
// ignore: deprecated_member_use_from_same_package
customAssert('findDOMNode works on this', react_dom.findDOMNode(this) != null);
Expand Down
2 changes: 1 addition & 1 deletion example/test/unmount_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var SimpleComponent = react.registerComponent2(() => _SimpleComponent());

class _SimpleComponent extends react.Component2 {
@override
componentDidMount() => print("mount");
componentDidMount() => print('mount');

@override
componentWillUnmount() => print('unmount');
Expand Down
2 changes: 0 additions & 2 deletions lib/react_dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
library react_dom;

// ignore: deprecated_member_use_from_same_package
import 'dart:html';

import 'package:react/react.dart' show Component;
import 'package:react/react_client/react_interop.dart' show ReactDom;
import 'package:react/src/react_client/create_root.dart' show ReactRoot, createRoot;
Expand Down
10 changes: 5 additions & 5 deletions lib/react_test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import 'package:react/src/react_test_utils/internal_test_utils.dart' as itu;
/// * For DOM components, this with return the String corresponding to its tagName ('div', 'a', etc.).
/// * For custom composite components React.createClass()-based components, this will return the [ReactClass].
@Deprecated('Use the react_testing_library package instead.')
final getComponentTypeV2 = itu.getComponentTypeV2;
const getComponentTypeV2 = itu.getComponentTypeV2;

@Deprecated('Use the react_testing_library package instead.')
typedef ComponentTestFunction = bool Function(dynamic /* [1] */ component);
Expand Down Expand Up @@ -155,17 +155,17 @@ external dynamic /* [1] */ _findRenderedComponentWithType(/* [1] */ tree, dynami
/// Returns true if element is a composite component.
/// (created with React.createClass()).
@Deprecated('Use the react_testing_library package instead.')
final isCompositeComponent = itu.isCompositeComponent;
const isCompositeComponent = itu.isCompositeComponent;

/// Returns `true` if instance is a custom composite component created using `React.createClass()`
/// that is of the [ReactComponentFactoryProxy.type] of the provided [componentFactory].
@Deprecated('Use the react_testing_library package instead.')
final isCompositeComponentWithTypeV2 = itu.isCompositeComponentWithTypeV2;
const isCompositeComponentWithTypeV2 = itu.isCompositeComponentWithTypeV2;

/// Returns true if instance is a DOM component (such as a <div> or <span>).
@JS('React.addons.TestUtils.isDOMComponent')
@Deprecated('Use the react_testing_library package instead.')
final isDOMComponent = itu.isDOMComponent;
const isDOMComponent = itu.isDOMComponent;

/// Returns true if [object] is a valid React component.
@JS('React.addons.TestUtils.isElement')
Expand All @@ -175,7 +175,7 @@ external bool isElement(dynamic object);
/// Returns `true` if [element] is a [ReactElement]
/// that is of the [ReactComponentFactoryProxy.type] of the provided [componentFactory].
@Deprecated('Use the react_testing_library package instead.')
final isElementOfTypeV2 = itu.isElementOfTypeV2;
const isElementOfTypeV2 = itu.isElementOfTypeV2;

@JS('React.addons.TestUtils.scryRenderedComponentsWithType')
external List<dynamic> /* [1] */ _scryRenderedComponentsWithType(/* [1] */ tree, dynamic type);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/react_client/private_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ void validateJsApi() {
createReactDartComponentClass(null, null, null);
createReactDartComponentClass2(null, null, null);
_isJsApiValid = true;
} on NoSuchMethodError catch (e) {
} on NoSuchMethodError catch (_) {
throw Exception('react.js and react_dom.js must be loaded.');
} catch (_) {
rethrow;
throw Exception('Loaded react.js must include react-dart JS interop helpers.');
}
}
Expand Down

0 comments on commit 09d0a68

Please sign in to comment.