diff --git a/Dockerfile b/Dockerfile index 170f7df0..d96a2bcb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,12 @@ FROM drydock-prod.workiva.net/workiva/dart_build_image:1 -# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile - -# Set the expected Chrome major version. This allows us to update the expected version when -# we need to roll out a new version of this base image with a new chrome version as the only change -ENV EXPECTED_CHROME_VERSION=87 - -# Install Chrome +# Chrome install adapted from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ apt-get -qq update && apt-get install -y google-chrome-stable && \ mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \ sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome -# Fail the build if the version doesn't match what we expected -RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\." - # TODO: Remove this and instead run it within the github actions CI on the stable channel once SDK lower bound is >=2.9.3 RUN dartfmt --line-length=120 --dry-run --set-exit-if-changed . @@ -46,22 +37,13 @@ RUN apt-get install -y \ wget \ && rm -rf /var/lib/apt/lists/* -# Chrome install taken from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile - -# Set the expected Chrome major version. This allows us to update the expected version when -# we need to roll out a new version of this base image with a new chrome version as the only change -ENV EXPECTED_CHROME_VERSION=87 - -# Install Chrome +# Chrome install adapted from https://github.com/Workiva/dart_unit_test_image/blob/master@%7B13-01-2021%7D/Dockerfile RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \ apt-get -qq update && apt-get install -y google-chrome-stable && \ mv /usr/bin/google-chrome-stable /usr/bin/google-chrome && \ sed -i --follow-symlinks -e 's/\"\$HERE\/chrome\"/\"\$HERE\/chrome\" --no-sandbox/g' /usr/bin/google-chrome -# Fail the build if the version doesn't match what we expected -RUN google-chrome --version | grep " $EXPECTED_CHROME_VERSION\." - WORKDIR /build/ ADD . /build/ diff --git a/lib/src/react_client/event_helpers.dart b/lib/src/react_client/event_helpers.dart index cee0ab5c..443c5425 100644 --- a/lib/src/react_client/event_helpers.dart +++ b/lib/src/react_client/event_helpers.dart @@ -783,7 +783,8 @@ extension SyntheticEventTypeHelpers on SyntheticEvent { (_hasProperty('relatedTarget') && !_hasProperty('button')) || _checkEventType(const ['focus', 'blur']); /// Uses Duck Typing to detect if the event instance is a [SyntheticMouseEvent]. - bool get isMouseEvent => _hasProperty('button') || _checkEventType(const ['mouse', 'click', 'drag', 'drop']); + bool get isMouseEvent => + _hasProperty('button') || _checkEventType(const ['mouse', 'click', 'drag', 'drop', 'contextmenu']); /// Uses Duck Typing to detect if the event instance is a [SyntheticPointerEvent]. bool get isPointerEvent => _hasProperty('pointerId') || _checkEventType(const ['pointer']); diff --git a/test/react_test_utils_test.dart b/test/react_test_utils_test.dart index fa8eb383..e0cf8336 100644 --- a/test/react_test_utils_test.dart +++ b/test/react_test_utils_test.dart @@ -158,6 +158,7 @@ testUtils({isComponent2: false, dynamic eventComponent, dynamic sampleComponent, group('compositionStart', () => testEvent(Simulate.compositionStart, 'compositionStart', expectCompositionEvent)); group('compositionUpdate', () => testEvent(Simulate.compositionUpdate, 'compositionUpdate', expectCompositionEvent)); + group('contextMenu', () => testEvent(Simulate.contextMenu, 'contextMenu', expectMouseEvent)); group('cut', () => testEvent(Simulate.cut, 'cut', expectClipboardEvent)); group('doubleClick', () => testEvent(Simulate.doubleClick, 'doubleClick', expectMouseEvent)); group('drag', () => testEvent(Simulate.drag, 'drag', expectMouseEvent)); diff --git a/test/test_components.dart b/test/test_components.dart index df9ea2e1..08b5656c 100644 --- a/test/test_components.dart +++ b/test/test_components.dart @@ -16,6 +16,7 @@ class EventComponent extends Component { 'onCompositionEnd': onEvent, 'onCompositionStart': onEvent, 'onCompositionUpdate': onEvent, + 'onContextMenu': onEvent, 'onCut': onEvent, 'onDoubleClick': onEvent, 'onDrag': onEvent, diff --git a/test/test_components2.dart b/test/test_components2.dart index e1f8a629..5ee47c72 100644 --- a/test/test_components2.dart +++ b/test/test_components2.dart @@ -16,6 +16,7 @@ class EventComponent2 extends Component2 { 'onCompositionEnd': onEvent, 'onCompositionStart': onEvent, 'onCompositionUpdate': onEvent, + 'onContextMenu': onEvent, 'onCut': onEvent, 'onDoubleClick': onEvent, 'onDrag': onEvent,