Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/tough-toes-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@guardian/cql": patch
---

Remove magic number causing succeeding text to be removedwhen chips are deleted with a click
2 changes: 1 addition & 1 deletion lib/cql/src/cqlInput/editor/nodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const chipNodeView: NodeViewConstructor = (

const { node, pos } = result;

removeChipCoveringRange(pos, pos + node.nodeSize + 1)(view.state, view.dispatch);
removeChipCoveringRange(pos, pos + node.nodeSize)(view.state, view.dispatch);
};

const handlePolarityClickEvent = () => {
Expand Down
4 changes: 2 additions & 2 deletions lib/cql/src/cqlInput/editor/plugins/cql.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,12 +1014,12 @@ describe("cql plugin", () => {
});

it("removes the chip via click", async () => {
const { editor, waitFor } = createCqlEditor("+tag:a");
const { editor, waitFor } = createCqlEditor("before +tag:a after");

const deleteBtn = await findByText(editor.view.dom, "×");
await fireEvent.click(deleteBtn);

await waitFor("");
await waitFor("before after");
});
});

Expand Down
Loading