Port location unit tests from enzyme to react-testing-library (#10181)

* SmartMarker test to rtl

* LocationPicker to rtl

* LocationViewDialog to rtl

* LocationShareMenu to rtl

* use toBeDisabled assertion
This commit is contained in:
Kerry 2023-02-21 07:35:39 +13:00 committed by GitHub
parent a06163ee98
commit 3fafa4b58d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 290 additions and 613 deletions

View file

@ -2,116 +2,53 @@
exports[`<LocationShareMenu /> with live location disabled goes to labs flag screen after live options is clicked 1`] = `
<div
className="mx_EnableLiveShare"
data-test-id="location-picker-enable-live-share"
class="mx_EnableLiveShare"
data-testid="location-picker-enable-live-share"
>
<StyledLiveBeaconIcon
className="mx_EnableLiveShare_icon"
<div
class="mx_StyledLiveBeaconIcon mx_EnableLiveShare_icon"
/>
<h3
class="mx_Heading_h3 mx_EnableLiveShare_heading"
>
<div
className="mx_StyledLiveBeaconIcon mx_EnableLiveShare_icon"
/>
</StyledLiveBeaconIcon>
<Heading
className="mx_EnableLiveShare_heading"
size="h3"
>
<h3
className="mx_Heading_h3 mx_EnableLiveShare_heading"
>
Live location sharing
</h3>
</Heading>
Live location sharing
</h3>
<p
className="mx_EnableLiveShare_description"
class="mx_EnableLiveShare_description"
>
Please note: this is a labs feature using a temporary implementation. This means you will not be able to delete your location history, and advanced users will be able to see your location history even after you stop sharing your live location with this room.
</p>
<LabelledToggleSwitch
data-test-id="enable-live-share-toggle"
label="Enable live location sharing"
onChange={[Function]}
value={false}
<div
class="mx_SettingsFlag"
data-testid="enable-live-share-toggle"
>
<span
class="mx_SettingsFlag_label"
>
Enable live location sharing
</span>
<div
className="mx_SettingsFlag"
aria-checked="false"
aria-disabled="false"
aria-label="Enable live location sharing"
class="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
role="switch"
tabindex="0"
>
<span
className="mx_SettingsFlag_label"
>
Enable live location sharing
</span>
<_default
checked={false}
onChange={[Function]}
title="Enable live location sharing"
>
<AccessibleTooltipButton
aria-checked={false}
aria-disabled={false}
className="mx_ToggleSwitch mx_ToggleSwitch_enabled"
onClick={[Function]}
role="switch"
title="Enable live location sharing"
>
<AccessibleButton
aria-checked={false}
aria-disabled={false}
aria-label="Enable live location sharing"
className="mx_ToggleSwitch mx_ToggleSwitch_enabled"
element="div"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseLeave={[Function]}
onMouseOver={[Function]}
role="switch"
tabIndex={0}
>
<div
aria-checked={false}
aria-disabled={false}
aria-label="Enable live location sharing"
className="mx_AccessibleButton mx_ToggleSwitch mx_ToggleSwitch_enabled"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseLeave={[Function]}
onMouseOver={[Function]}
role="switch"
tabIndex={0}
>
<div
className="mx_ToggleSwitch_ball"
/>
</div>
</AccessibleButton>
</AccessibleTooltipButton>
</_default>
<div
class="mx_ToggleSwitch_ball"
/>
</div>
</LabelledToggleSwitch>
<AccessibleButton
className="mx_EnableLiveShare_button"
data-test-id="enable-live-share-submit"
disabled={true}
element="button"
kind="primary"
onClick={[Function]}
</div>
<button
aria-disabled="true"
class="mx_AccessibleButton mx_EnableLiveShare_button mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary mx_AccessibleButton_disabled"
data-testid="enable-live-share-submit"
disabled=""
role="button"
tabIndex={0}
tabindex="0"
>
<button
aria-disabled={true}
className="mx_AccessibleButton mx_EnableLiveShare_button mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary mx_AccessibleButton_disabled"
data-test-id="enable-live-share-submit"
disabled={true}
role="button"
tabIndex={0}
>
OK
</button>
</AccessibleButton>
OK
</button>
</div>
`;