fix: paste styles shortcut (#4886)

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
David Luzar 2022-03-09 10:59:44 +01:00 committed by GitHub
parent 1849ff6ee2
commit 20de06ef50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 31 deletions

View file

@ -26,14 +26,6 @@ const mouse = new Pointer("mouse");
const finger1 = new Pointer("touch", 1);
const finger2 = new Pointer("touch", 2);
const clickLabeledElement = (label: string) => {
const element = document.querySelector(`[aria-label='${label}']`);
if (!element) {
throw new Error(`No labeled element found: ${label}`);
}
fireEvent.click(element);
};
/**
* This is always called at the end of your test, so usually you don't need to call it.
* However, if you have a long test, you might want to call it during the test so it's easier
@ -168,10 +160,10 @@ describe("regression tests", () => {
mouse.down(10, 10);
mouse.up(10, 10);
clickLabeledElement("Background");
clickLabeledElement(t("colors.fa5252"));
clickLabeledElement("Stroke");
clickLabeledElement(t("colors.5f3dc4"));
UI.clickLabeledElement("Background");
UI.clickLabeledElement(t("colors.fa5252"));
UI.clickLabeledElement("Stroke");
UI.clickLabeledElement(t("colors.5f3dc4"));
expect(API.getSelectedElement().backgroundColor).toBe("#fa5252");
expect(API.getSelectedElement().strokeColor).toBe("#5f3dc4");
});
@ -952,8 +944,8 @@ describe("regression tests", () => {
UI.clickTool("rectangle");
// change background color since default is transparent
// and transparent elements can't be selected by clicking inside of them
clickLabeledElement("Background");
clickLabeledElement(t("colors.fa5252"));
UI.clickLabeledElement("Background");
UI.clickLabeledElement(t("colors.fa5252"));
mouse.down();
mouse.up(1000, 1000);
@ -1059,8 +1051,8 @@ describe("regression tests", () => {
mouse.up(10, 10);
expect(screen.queryByText(/fill/i)).toBeNull();
clickLabeledElement("Background");
clickLabeledElement(t("colors.fa5252"));
UI.clickLabeledElement("Background");
UI.clickLabeledElement(t("colors.fa5252"));
// select rectangle
mouse.reset();
mouse.click();