From 1c5aff12225fc034c5cb28613144f6124ff2f6e5 Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Mon, 12 Jun 2017 12:38:28 -0700 Subject: [PATCH 1/4] AbstractTransition lifecycle methods must be called by subclasses --- lib/src/component/abstract_transition.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/component/abstract_transition.dart b/lib/src/component/abstract_transition.dart index 6a5bdcf57..56926ba03 100644 --- a/lib/src/component/abstract_transition.dart +++ b/lib/src/component/abstract_transition.dart @@ -17,6 +17,7 @@ library abstract_transition; import 'dart:async'; import 'dart:html'; +import 'package:meta/meta.dart'; import 'package:over_react/over_react.dart'; @AbstractProps() @@ -175,6 +176,7 @@ abstract class AbstractTransitionComponent Date: Mon, 12 Jun 2017 12:49:15 -0700 Subject: [PATCH 2/4] ResizeSensor lifecycle methods must be called by subclasses --- lib/src/component/resize_sensor.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/src/component/resize_sensor.dart b/lib/src/component/resize_sensor.dart index e0bad15b8..28d95788a 100644 --- a/lib/src/component/resize_sensor.dart +++ b/lib/src/component/resize_sensor.dart @@ -19,6 +19,7 @@ library resize_sensor; import 'dart:collection'; import 'dart:html'; +import 'package:meta/meta.dart'; import 'package:platform_detect/platform_detect.dart'; import 'package:react/react.dart' as react; import 'package:over_react/over_react.dart'; @@ -102,6 +103,7 @@ class ResizeSensorComponent extends UiComponent with _SafeAni ..addProps(ResizeSensorPropsMixin.defaultProps) ); + @mustCallSuper @override void componentWillUnmount() { super.componentWillUnmount(); @@ -109,6 +111,7 @@ class ResizeSensorComponent extends UiComponent with _SafeAni cancelAnimationFrames(); } + @mustCallSuper @override void componentDidMount() { if (props.quickMount) { From 9c1795681d5fb6170a7137578a74cc0bdc981b2c Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Mon, 12 Jun 2017 12:49:29 -0700 Subject: [PATCH 3/4] =?UTF-8?q?Add=20memory-related=20lints=20/=20clean=20?= =?UTF-8?q?=E2=80=98em=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .analysis_options | 2 ++ test/over_react/component/resize_sensor_test.dart | 2 +- test/over_react/component_declaration/flux_component_test.dart | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.analysis_options b/.analysis_options index f0b02a5df..df7edbf8c 100644 --- a/.analysis_options +++ b/.analysis_options @@ -11,6 +11,8 @@ linter: - avoid_init_to_null - avoid_return_types_on_setters - camel_case_types + - cancel_subscriptions + - close_sinks - empty_constructor_bodies - hash_and_equals - library_names diff --git a/test/over_react/component/resize_sensor_test.dart b/test/over_react/component/resize_sensor_test.dart index 7b02eb2e1..940b7968d 100644 --- a/test/over_react/component/resize_sensor_test.dart +++ b/test/over_react/component/resize_sensor_test.dart @@ -112,7 +112,7 @@ void main() { action(); - await resizesDone; + await resizesDone.then((_) { resizes.close(); }); } /// Expect resize sensor invokes registered `onInitialize` callback. diff --git a/test/over_react/component_declaration/flux_component_test.dart b/test/over_react/component_declaration/flux_component_test.dart index 1b42efc77..ee6e3b0bb 100644 --- a/test/over_react/component_declaration/flux_component_test.dart +++ b/test/over_react/component_declaration/flux_component_test.dart @@ -152,6 +152,8 @@ void main() { await nextTick(); expect(numberOfCalls, 1, reason: 'the subscription to have been cancelled, and should not receive additional events'); + + controller.close(); }); test('should not redraw after being unmounted', () async { From 43aa8b107d16c7ecb0ef4d0fb3845da4027d5e1c Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Tue, 13 Jun 2017 08:19:47 -0700 Subject: [PATCH 4/4] Remove browser_detect dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + It is abandonware. Use Workiva’s platform_detect instead. --- pubspec.yaml | 3 +-- test/test_util/dom_util.dart | 4 ++-- test/wsd_test_util/common_component_tests.dart | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 260b57c69..5047f84c9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,10 +16,9 @@ dependencies: source_span: "^1.2.0" transformer_utils: "^0.1.1" w_flux: "^2.5.0" - platform_detect: "^1.1.1" + platform_detect: "^1.3.2" quiver: ">=0.21.4 <0.25.0" dev_dependencies: - browser_detect: "^1.0.4" matcher: ">=0.11.0 <0.13.0" coverage: "^0.7.2" dart_dev: "^1.0.5" diff --git a/test/test_util/dom_util.dart b/test/test_util/dom_util.dart index 051f87ec5..42b8c8c3b 100644 --- a/test/test_util/dom_util.dart +++ b/test/test_util/dom_util.dart @@ -18,7 +18,7 @@ import 'dart:async'; import 'dart:html'; import 'dart:js'; -import 'package:browser_detect/browser_detect.dart'; +import 'package:platform_detect/platform_detect.dart'; /// Dispatches a `transitionend` event when the CSS transition of the [element] /// is complete. Returns a [Future] that completes after the event has been dispatched. @@ -43,7 +43,7 @@ Future triggerTransitionEnd(Element element) { } // Need to use webkitTransitionEnd in Edge. See https://github.com/dart-lang/sdk/issues/26972 - var eventName = (browser.isIe && browser.version > '11') ? 'webkitTransitionEnd' : 'transitionend'; + var eventName = (browser.isInternetExplorer && browser.version.major > 11) ? 'webkitTransitionEnd' : 'transitionend'; jsEvent.callMethod('initEvent', [eventName, true, true]); diff --git a/test/wsd_test_util/common_component_tests.dart b/test/wsd_test_util/common_component_tests.dart index 6ddcacc01..cc2056aa1 100644 --- a/test/wsd_test_util/common_component_tests.dart +++ b/test/wsd_test_util/common_component_tests.dart @@ -23,7 +23,7 @@ import 'dart:html'; ]) import 'dart:mirrors'; -import 'package:browser_detect/browser_detect.dart'; +import 'package:platform_detect/platform_detect.dart'; import 'package:over_react/over_react.dart'; import 'package:over_react/src/component_declaration/component_base.dart' as component_base; import 'package:react/react_client.dart'; @@ -434,7 +434,7 @@ void commonComponentTests(BuilderOnlyUiFactory factory, { skippedPropKeys = flatten(skippedPropKeys).toList(); // TODO: Remove this short-circuit when UIP-1125. - if (browser.isIe && browser.version <= '10') return; + if (browser.isInternetExplorer && browser.version.major <= 10) return; if (shouldTestPropForwarding) { testPropForwarding(factory, childrenFactory,