DEV: Make image resize controls more resilient (#8867)

Commit aa24be1 made it possible to build data attributes from image's
Markdown and this changes ensure that the resize controls still work
when data attributes are present.
This commit is contained in:
Dan Ungureanu
2020-02-06 17:19:24 +02:00
committed by GitHub
parent 1183f8df52
commit 2a884e25be
3 changed files with 26 additions and 13 deletions

View File

@ -766,13 +766,15 @@ QUnit.test("Image resizing buttons", async assert => {
// 10 Image with markdown title - should work
`![image|690x220](upload://test.png "image title")`,
// 11 bbcode - should not work
"[img]http://example.com/image.jpg[/img]"
"[img]http://example.com/image.jpg[/img]",
// 12 Image with data attributes
"![test|foo=bar|690x313,50%|bar=baz](upload://test.png)"
];
await fillIn(".d-editor-input", uploads.join("\n"));
assert.ok(
find(".button-wrapper").length === 9,
find(".button-wrapper").length === 10,
"it adds correct amount of scaling button groups"
);
@ -820,6 +822,13 @@ QUnit.test("Image resizing buttons", async assert => {
);
assertImageResized(assert, uploads);
// Keep data attributes
uploads[12] = `![test|foo=bar|690x313, 75%|bar=baz](upload://test.png)`;
await click(
find(".button-wrapper[data-image-index='9'] .scale-btn[data-scale='75']")
);
assertImageResized(assert, uploads);
await fillIn(
".d-editor-input",
`