Add link creation to rich text editor (#9775)

Add link creation to RTE
This commit is contained in:
Florian Duros 2022-12-23 12:34:15 +01:00 committed by GitHub
parent 88c3864682
commit fe0273b1a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 418 additions and 97 deletions

View file

@ -15,7 +15,7 @@ limitations under the License.
*/
import React from "react";
import { render, screen } from "@testing-library/react";
import { act, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { PlainTextComposer } from "../../../../../../src/components/views/rooms/wysiwyg_composer/components/PlainTextComposer";
@ -106,10 +106,7 @@ describe("PlainTextComposer", () => {
disconnect: jest.fn(),
};
});
jest.spyOn(global, "requestAnimationFrame").mockImplementation((cb) => {
cb(0);
return 0;
});
jest.useFakeTimers();
//When
render(<PlainTextComposer onChange={jest.fn()} onSend={jest.fn()} />);
@ -123,12 +120,15 @@ describe("PlainTextComposer", () => {
[{ contentBoxSize: [{ blockSize: 100 }] } as unknown as ResizeObserverEntry],
{} as ResizeObserver,
);
jest.runAllTimers();
act(() => {
jest.runAllTimers();
});
// Then
expect(screen.getByTestId("WysiwygComposerEditor").attributes["data-is-expanded"].value).toBe("true");
jest.useRealTimers();
(global.ResizeObserver as jest.Mock).mockRestore();
(global.requestAnimationFrame as jest.Mock).mockRestore();
});
});