Skip to content

Commit 09d0a68

Browse files
Fix warnings
1 parent 35cff8e commit 09d0a68

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

example/test/get_dom_node_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class _SimpleComponent extends react.Component2 {
4040
var refToElement;
4141

4242
@override
43-
componentWillUnmount() => print("unmount");
43+
componentWillUnmount() => print('unmount');
4444

4545
@override
4646
componentDidMount() {
47-
print("mount");
47+
print('mount');
4848
customAssert('ref to span return span ', refToSpan.text == 'Test');
4949
// ignore: deprecated_member_use_from_same_package
5050
customAssert('findDOMNode works on this', react_dom.findDOMNode(this) != null);

example/test/unmount_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var SimpleComponent = react.registerComponent2(() => _SimpleComponent());
88

99
class _SimpleComponent extends react.Component2 {
1010
@override
11-
componentDidMount() => print("mount");
11+
componentDidMount() => print('mount');
1212

1313
@override
1414
componentWillUnmount() => print('unmount');

lib/react_dom.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
library react_dom;
66

77
// ignore: deprecated_member_use_from_same_package
8-
import 'dart:html';
9-
108
import 'package:react/react.dart' show Component;
119
import 'package:react/react_client/react_interop.dart' show ReactDom;
1210
import 'package:react/src/react_client/create_root.dart' show ReactRoot, createRoot;

lib/react_test_utils.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import 'package:react/src/react_test_utils/internal_test_utils.dart' as itu;
3737
/// * For DOM components, this with return the String corresponding to its tagName ('div', 'a', etc.).
3838
/// * For custom composite components React.createClass()-based components, this will return the [ReactClass].
3939
@Deprecated('Use the react_testing_library package instead.')
40-
final getComponentTypeV2 = itu.getComponentTypeV2;
40+
const getComponentTypeV2 = itu.getComponentTypeV2;
4141

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

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

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

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

180180
@JS('React.addons.TestUtils.scryRenderedComponentsWithType')
181181
external List<dynamic> /* [1] */ _scryRenderedComponentsWithType(/* [1] */ tree, dynamic type);

lib/src/react_client/private_utils.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ void validateJsApi() {
5858
createReactDartComponentClass(null, null, null);
5959
createReactDartComponentClass2(null, null, null);
6060
_isJsApiValid = true;
61-
} on NoSuchMethodError catch (e) {
61+
} on NoSuchMethodError catch (_) {
6262
throw Exception('react.js and react_dom.js must be loaded.');
6363
} catch (_) {
64-
rethrow;
6564
throw Exception('Loaded react.js must include react-dart JS interop helpers.');
6665
}
6766
}

0 commit comments

Comments
 (0)