1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
1576 changed files with 65385 additions and 62478 deletions

View File

@@ -15,29 +15,26 @@ limitations under the License.
*/
import React from "react";
import {
renderIntoDocument,
Simulate,
} from 'react-dom/test-utils';
import { renderIntoDocument, Simulate } from "react-dom/test-utils";
import { act } from "react-dom/test-utils";
import { Alignment } from '../../../../src/components/views/elements/Tooltip';
import { Alignment } from "../../../../src/components/views/elements/Tooltip";
import TooltipTarget from "../../../../src/components/views/elements/TooltipTarget";
describe('<TooltipTarget />', () => {
describe("<TooltipTarget />", () => {
const defaultProps = {
"tooltipTargetClassName": 'test tooltipTargetClassName',
"className": 'test className',
"tooltipClassName": 'test tooltipClassName',
"label": 'test label',
"tooltipTargetClassName": "test tooltipTargetClassName",
"className": "test className",
"tooltipClassName": "test tooltipClassName",
"label": "test label",
"alignment": Alignment.Left,
"id": 'test id',
'data-test-id': 'test',
"id": "test id",
"data-test-id": "test",
};
afterEach(() => {
// clean up renderer tooltips
const wrapper = document.querySelector('.mx_Tooltip_wrapper');
const wrapper = document.querySelector(".mx_Tooltip_wrapper");
while (wrapper?.firstChild) {
wrapper.removeChild(wrapper.lastChild);
}
@@ -45,19 +42,19 @@ describe('<TooltipTarget />', () => {
const getComponent = (props = {}) => {
const wrapper = renderIntoDocument<HTMLSpanElement>(
// wrap in element so renderIntoDocument can render functional component
// wrap in element so renderIntoDocument can render functional component
<span>
<TooltipTarget {...defaultProps} {...props}>
<span>child</span>
</TooltipTarget>
</span>,
) as HTMLSpanElement;
return wrapper.querySelector('[data-test-id=test]');
return wrapper.querySelector("[data-test-id=test]");
};
const getVisibleTooltip = () => document.querySelector('.mx_Tooltip.mx_Tooltip_visible');
const getVisibleTooltip = () => document.querySelector(".mx_Tooltip.mx_Tooltip_visible");
it('renders container', () => {
it("renders container", () => {
const component = getComponent();
expect(component).toMatchSnapshot();
expect(getVisibleTooltip()).toBeFalsy();
@@ -72,7 +69,7 @@ describe('<TooltipTarget />', () => {
expect(getVisibleTooltip()).toMatchSnapshot();
});
it('hides tooltip on mouseleave', () => {
it("hides tooltip on mouseleave", () => {
const wrapper = getComponent();
act(() => {
Simulate.mouseOver(wrapper);
@@ -84,7 +81,7 @@ describe('<TooltipTarget />', () => {
expect(getVisibleTooltip()).toBeFalsy();
});
it('displays tooltip on focus', () => {
it("displays tooltip on focus", () => {
const wrapper = getComponent();
act(() => {
Simulate.focus(wrapper);
@@ -92,7 +89,7 @@ describe('<TooltipTarget />', () => {
expect(getVisibleTooltip()).toBeTruthy();
});
it('hides tooltip on blur', async () => {
it("hides tooltip on blur", async () => {
const wrapper = getComponent();
act(() => {
Simulate.focus(wrapper);