Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] Composer: pressing enter in the link editor #4034

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/link/link_editor/link_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export class LinkEditor extends Component<LinkEditorProps, SpreadsheetChildEnv>
this.save();
}
ev.stopPropagation();
ev.preventDefault();
break;
case "Escape":
this.cancel();
Expand Down
15 changes: 15 additions & 0 deletions tests/composer/composer_component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
import {
ComposerWrapper,
mountComposerWrapper,
mountSpreadsheet,
nextTick,
typeInComposerHelper,
} from "../test_helpers/helpers";
Expand Down Expand Up @@ -517,6 +518,20 @@ describe("composer", () => {
expect(link?.url).toBe("http://odoo.com");
});

test("Pressing Enter while editing a label does not open grid composer", async () => {
({ model, fixture } = await mountSpreadsheet());
setCellContent(model, "A1", "[label](http://odoo.com)");
await simulateClick(".o-topbar-menu[data-id='insert']");
await simulateClick(".o-menu-item[data-name='insert_link']");
const editor = fixture.querySelector(".o-link-editor");
expect(editor).toBeTruthy();

editor!.querySelectorAll("input")[0].focus();
await keyDown({ key: "Enter" });
expect(fixture.querySelector(".o-link-editor")).toBeFalsy();
expect(composerStore.editionMode).toBe("inactive");
});

describe("change selecting mode when typing specific token value", () => {
const matchingValues = [",", "+", "*", "="];
const mismatchingValues = ["1", '"coucou"', "TRUE", "SUM", "A2"];
Expand Down