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

setData in ckeditor5-engine dev-utils/model ignores batchType option #7947

Closed
bachbui opened this issue Aug 26, 2020 · 0 comments · Fixed by #8807
Closed

setData in ckeditor5-engine dev-utils/model ignores batchType option #7947

bachbui opened this issue Aug 26, 2020 · 0 comments · Fixed by #8807
Assignees
Labels
intro Good first ticket. package:engine type:bug This issue reports a buggy (incorrect) behavior.

Comments

@bachbui
Copy link

bachbui commented Aug 26, 2020

It seems that an old PR (ckeditor/ckeditor5-engine#1431) has removed the ability to use the batchType option in setData in https://github.com/ckeditor/ckeditor5/blob/v21.0.0/packages/ckeditor5-engine/src/dev-utils/model.js#L108. It seems that setData used to use model.enqueueChange which supports specifying the batch, but this was changed in the aforementioned PR.

It would be very useful for writing tests if we could use this option. But if this change was intentional, please update the documentation (https://ckeditor.com/docs/ckeditor5/latest/api/module_engine_dev-utils_model.html#function-setData) which still lists batchType as an option.

📝 Provide detailed reproduction steps (if any)

// in a plugin test
import { expect } from "chai";
import { setData as setModelData } from "@ckeditor/ckeditor5-engine/src/dev-utils/model";

let editor;
...

editor.model.document.registerPostFixer(writer => {
  expect(writer.batch.type).to.equal("transparent");
});
setModelData(editor.model, "<paragraph>Some data</paragraph>", { batchType: "transparent" });

✔️ Expected result

What is the expected result of the above steps?
The above assertion is true

❌ Actual result

What is the actual result of the above steps?
The above assertion is false

📃 Other details

  • Browser: …
  • OS: …
  • CKEditor version: …
  • Installed CKEditor plugins: …

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@bachbui bachbui added the type:bug This issue reports a buggy (incorrect) behavior. label Aug 26, 2020
@Reinmar Reinmar added squad:dx intro Good first ticket. labels Nov 2, 2020
@Reinmar Reinmar added this to the backlog milestone Nov 2, 2020
@oleq oleq modified the milestones: backlog, iteration 39 Jan 4, 2021
oleq added a commit that referenced this issue Jan 12, 2021
Fix (engine): The `setData()` helper in the model dev-utils should support the `batchType` option. Closes #7947.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intro Good first ticket. package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants