Merge branch 'master' of github.com:excalidraw/excalidraw into cleanipp

* 'master' of github.com:excalidraw/excalidraw: (37 commits)
  feat: Add toast (#2772)
  docs: Update readme with documentation (#2788)
  fix: allow text-selecting in dialogs & reset cursor (#2783)
  chore: Update translations from Crowdin (#2742)
  fix: broken Individuals link (#2782)
  refactor: Converting span to kbd tag (#2774)
  fix: don't render due to zoom after unmount (#2779)
  fix: Track the chart type correctly (#2773)
  chore(deps-dev): bump terser-webpack-plugin in /src/packages/excalidraw (#2750)
  chore(deps-dev): bump webpack in /src/packages/utils (#2768)
  fix: delay version logging & prevent duplicates (#2770)
  chore(deps-dev): bump webpack in /src/packages/excalidraw (#2769)
  chore(deps-dev): bump ts-loader in /src/packages/excalidraw (#2749)
  chore(deps-dev): bump ts-loader in /src/packages/utils (#2753)
  chore(deps): bump nanoid from 2.1.11 to 3.1.20 (#2581)
  feat: Track current version (#2731)
  chore(actions): Use cancel workflow action (#2763)
  chore(deps): bump @testing-library/react from 11.2.2 to 11.2.3 (#2755)
  chore(deps-dev): bump firebase-tools from 9.1.0 to 9.1.2 (#2761)
  chore(deps-dev): bump eslint-plugin-prettier from 3.3.0 to 3.3.1 (#2754)
  ...
This commit is contained in:
Panayiotis Lipiridis
2021-01-15 18:30:11 +02:00
115 changed files with 2445 additions and 4938 deletions
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,7 +2,7 @@ import React from "react";
import ReactDOM from "react-dom";
import { render } from "./test-utils";
import ExcalidrawApp from "../excalidraw-app";
import { setLanguage } from "../i18n";
import { defaultLang, setLanguage } from "../i18n";
import { UI, Pointer, Keyboard } from "./helpers/ui";
import { API } from "./helpers/api";
import { KEYS } from "../keys";
@@ -60,7 +60,7 @@ describe("aligning", () => {
ReactDOM.unmountComponentAtNode(document.getElementById("root")!);
mouse.reset();
await setLanguage("en.json");
await setLanguage(defaultLang);
await render(<ExcalidrawApp />);
});
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

+18 -14
View File
@@ -4,9 +4,8 @@ import ReactDOM from "react-dom";
import { copiedStyles } from "../actions/actionStyles";
import { ShortcutName } from "../actions/shortcuts";
import { ExcalidrawElement } from "../element/types";
import { setLanguage } from "../i18n";
import { CODES, KEYS } from "../keys";
import Excalidraw from "../packages/excalidraw/index";
import ExcalidrawApp from "../excalidraw-app";
import { reseed } from "../random";
import * as Renderer from "../renderer/renderScene";
import { setDateTimeForTests } from "../utils";
@@ -19,6 +18,7 @@ import {
screen,
waitFor,
} from "./test-utils";
import { defaultLang } from "../i18n";
const { h } = window;
@@ -75,8 +75,7 @@ beforeEach(async () => {
finger1.reset();
finger2.reset();
await setLanguage("en.json");
await render(<Excalidraw offsetLeft={0} offsetTop={0} />);
await render(<ExcalidrawApp />);
});
afterEach(() => {
@@ -151,22 +150,26 @@ describe("regression tests", () => {
expect(API.getSelectedElement().id).not.toEqual(prevSelectedId);
});
for (const [keys, shape] of [
[`2${KEYS.R}`, "rectangle"],
[`3${KEYS.D}`, "diamond"],
[`4${KEYS.E}`, "ellipse"],
[`5${KEYS.A}`, "arrow"],
[`6${KEYS.L}`, "line"],
[`7${KEYS.X}`, "draw"],
] as [string, ExcalidrawElement["type"]][]) {
for (const [keys, shape, shouldSelect] of [
[`2${KEYS.R}`, "rectangle", true],
[`3${KEYS.D}`, "diamond", true],
[`4${KEYS.E}`, "ellipse", true],
[`5${KEYS.A}`, "arrow", true],
[`6${KEYS.L}`, "line", true],
[`7${KEYS.X}`, "draw", false],
] as [string, ExcalidrawElement["type"], boolean][]) {
for (const key of keys) {
it(`key ${key} selects ${shape} tool`, () => {
Keyboard.keyPress(key);
expect(h.state.elementType).toBe(shape);
mouse.down(10, 10);
mouse.up(10, 10);
expect(API.getSelectedElement().type).toBe(shape);
if (shouldSelect) {
expect(API.getSelectedElement().type).toBe(shape);
}
});
}
}
@@ -439,7 +442,7 @@ describe("regression tests", () => {
await waitFor(() => expect(screen.queryByTitle(/thin/i)).toBeNull());
// reset language
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
target: { value: "en" },
target: { value: defaultLang.code },
});
// switching back to English
await waitFor(() => expect(screen.queryByTitle(/thin/i)).not.toBeNull());
@@ -618,6 +621,7 @@ describe("regression tests", () => {
const expectedShortcutNames: ShortcutName[] = [
"selectAll",
"gridMode",
"zenMode",
"stats",
];