fix fontFamily state updating (#1679)
This commit is contained in:
parent
44a88d2d58
commit
0db7ac78c4
@ -374,7 +374,7 @@ export const actionChangeFontFamily = register({
|
||||
}),
|
||||
appState: {
|
||||
...appState,
|
||||
currentItemFontFamily: appState.currentItemFontFamily,
|
||||
currentItemFontFamily: value,
|
||||
},
|
||||
commitToHistory: true,
|
||||
};
|
||||
|
@ -15677,6 +15677,75 @@ exports[`regression tests undo/redo drawing an element: [end of test] number of
|
||||
|
||||
exports[`regression tests undo/redo drawing an element: [end of test] number of renders 1`] = `24`;
|
||||
|
||||
exports[`regression tests updates fontSize & fontFamily appState: [end of test] appState 1`] = `
|
||||
Object {
|
||||
"collaborators": Map {},
|
||||
"currentItemBackgroundColor": "transparent",
|
||||
"currentItemFillStyle": "hachure",
|
||||
"currentItemFontFamily": 3,
|
||||
"currentItemFontSize": 20,
|
||||
"currentItemOpacity": 100,
|
||||
"currentItemRoughness": 1,
|
||||
"currentItemStrokeColor": "#000000",
|
||||
"currentItemStrokeStyle": "solid",
|
||||
"currentItemStrokeWidth": 1,
|
||||
"currentItemTextAlign": "left",
|
||||
"cursorButton": "up",
|
||||
"cursorX": 0,
|
||||
"cursorY": 0,
|
||||
"draggingElement": null,
|
||||
"editingElement": null,
|
||||
"editingGroupId": null,
|
||||
"elementLocked": false,
|
||||
"elementType": "text",
|
||||
"errorMessage": null,
|
||||
"exportBackground": true,
|
||||
"isCollaborating": false,
|
||||
"isLoading": false,
|
||||
"isResizing": false,
|
||||
"isRotating": false,
|
||||
"lastPointerDownWith": "mouse",
|
||||
"multiElement": null,
|
||||
"name": "Unbenannt-201933152653",
|
||||
"openMenu": null,
|
||||
"resizingElement": null,
|
||||
"scrollX": 0,
|
||||
"scrollY": 0,
|
||||
"scrolledOutside": false,
|
||||
"selectedElementIds": Object {},
|
||||
"selectedGroupIds": Object {},
|
||||
"selectionElement": null,
|
||||
"shouldAddWatermark": false,
|
||||
"shouldCacheIgnoreZoom": false,
|
||||
"showShortcutsDialog": false,
|
||||
"username": "",
|
||||
"viewBackgroundColor": "#ffffff",
|
||||
"zenModeEnabled": false,
|
||||
"zoom": 1,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`regression tests updates fontSize & fontFamily appState: [end of test] history 1`] = `
|
||||
Object {
|
||||
"recording": false,
|
||||
"redoStack": Array [],
|
||||
"stateHistory": Array [
|
||||
Object {
|
||||
"appState": Object {
|
||||
"name": "Unbenannt-201933152653",
|
||||
"selectedElementIds": Object {},
|
||||
"viewBackgroundColor": "#ffffff",
|
||||
},
|
||||
"elements": Array [],
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`regression tests updates fontSize & fontFamily appState: [end of test] number of elements 1`] = `0`;
|
||||
|
||||
exports[`regression tests updates fontSize & fontFamily appState: [end of test] number of renders 1`] = `4`;
|
||||
|
||||
exports[`regression tests zoom hotkeys: [end of test] appState 1`] = `
|
||||
Object {
|
||||
"collaborators": Map {},
|
||||
|
@ -8,6 +8,7 @@ const toolMap = {
|
||||
arrow: "arrow",
|
||||
line: "line",
|
||||
draw: "draw",
|
||||
text: "text",
|
||||
};
|
||||
|
||||
export type ToolName = keyof typeof toolMap;
|
||||
|
@ -840,4 +840,11 @@ describe("regression tests", () => {
|
||||
mouse.doubleClick();
|
||||
expect(getSelectedElements().length).toBe(1);
|
||||
});
|
||||
|
||||
it("updates fontSize & fontFamily appState", () => {
|
||||
clickTool("text");
|
||||
expect(h.state.currentItemFontFamily).toEqual(1); // Virgil
|
||||
fireEvent.click(screen.getByText(/code/i));
|
||||
expect(h.state.currentItemFontFamily).toEqual(3); // Cascadia
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user