You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Apply prettier formatting
This commit is contained in:
@ -14,18 +14,17 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
|
||||
import { tooltipifyLinks } from '../../src/utils/tooltipify';
|
||||
import PlatformPeg from '../../src/PlatformPeg';
|
||||
import BasePlatform from '../../src/BasePlatform';
|
||||
import { tooltipifyLinks } from "../../src/utils/tooltipify";
|
||||
import PlatformPeg from "../../src/PlatformPeg";
|
||||
import BasePlatform from "../../src/BasePlatform";
|
||||
|
||||
describe('tooltipify', () => {
|
||||
jest.spyOn(PlatformPeg, 'get')
|
||||
.mockReturnValue({ needsUrlTooltips: () => true } as unknown as BasePlatform);
|
||||
describe("tooltipify", () => {
|
||||
jest.spyOn(PlatformPeg, "get").mockReturnValue({ needsUrlTooltips: () => true } as unknown as BasePlatform);
|
||||
|
||||
it('does nothing for empty element', () => {
|
||||
it("does nothing for empty element", () => {
|
||||
const { container: root } = render(<div />);
|
||||
const originalHtml = root.outerHTML;
|
||||
const containers: Element[] = [];
|
||||
@ -34,8 +33,12 @@ describe('tooltipify', () => {
|
||||
expect(root.outerHTML).toEqual(originalHtml);
|
||||
});
|
||||
|
||||
it('wraps single anchor', () => {
|
||||
const { container: root } = render(<div><a href="/foo">click</a></div>);
|
||||
it("wraps single anchor", () => {
|
||||
const { container: root } = render(
|
||||
<div>
|
||||
<a href="/foo">click</a>
|
||||
</div>,
|
||||
);
|
||||
const containers: Element[] = [];
|
||||
tooltipifyLinks([root], [], containers);
|
||||
expect(containers).toHaveLength(1);
|
||||
@ -45,8 +48,12 @@ describe('tooltipify', () => {
|
||||
expect(tooltip).toBeDefined();
|
||||
});
|
||||
|
||||
it('ignores node', () => {
|
||||
const { container: root } = render(<div><a href="/foo">click</a></div>);
|
||||
it("ignores node", () => {
|
||||
const { container: root } = render(
|
||||
<div>
|
||||
<a href="/foo">click</a>
|
||||
</div>,
|
||||
);
|
||||
const originalHtml = root.outerHTML;
|
||||
const containers: Element[] = [];
|
||||
tooltipifyLinks([root], [root.children[0]], containers);
|
||||
@ -55,7 +62,11 @@ describe('tooltipify', () => {
|
||||
});
|
||||
|
||||
it("does not re-wrap if called multiple times", () => {
|
||||
const { container: root } = render(<div><a href="/foo">click</a></div>);
|
||||
const { container: root } = render(
|
||||
<div>
|
||||
<a href="/foo">click</a>
|
||||
</div>,
|
||||
);
|
||||
const containers: Element[] = [];
|
||||
tooltipifyLinks([root], [], containers);
|
||||
tooltipifyLinks([root], [], containers);
|
||||
|
Reference in New Issue
Block a user