Skip to content

Commit bfc6736

Browse files
committed
test: RT-264 reference asset width gets converted to % unit
1 parent a1ea2f2 commit bfc6736

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/toRedactor.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,13 @@ describe("Testing json to html conversion", () => {
228228
test("RT-253 - should convert to proper HTML image code", () => {
229229
const json = {"type":"doc","attrs":{},"children":[{"type":"img","attrs":{"url":"***REMOVED***200","width":100},"children":[{"text":""}]}],"_version":3 }
230230
const html = toRedactor(json);
231-
console.log(html)
232231
expect(html).toBe('<img width="100" src="***REMOVED***200"/>');
233232
});
234233

234+
test("RT-264 - reference asset should have proper unit in the converted image", () => {
235+
const json = {"type":"doc","attrs":{},"uid":"6a547ebccbd74c0c9a521ee95acfb223","children":[{"uid":"942be31c040145b6a7541ec4f73754c5","type":"reference","attrs":{"display-type":"display","asset-uid":"bltcbce74d3891aaa9d","content-type-uid":"sys_assets","asset-link":"***REMOVED***200","asset-name":"MATHERAN.jpg","asset-type":"image/jpeg","type":"asset","class-name":"embedded-asset","width":"192","style":{"max-height":"144px","height":"144px","text-align":"right","max-width":"192px","width":"auto"},"redactor-attributes":{"height":"144","position":"right"},"max-height":"144","height":"144","position":"right","max-width":"192"},"children":[{"text":""}]}],"_version":1 }
236+
const html = toRedactor(json);
237+
expect(html).toBe(`<figure style="margin: 0; text-align: right"><img src="***REMOVED***200" height="144" class="embedded-asset" content-type-uid="sys_assets" type="asset" width="192" max-height="144" max-width="192" style="max-height: 144px; height: 144px; text-align: right; max-width: 192px; width: auto" data-sys-asset-filelink="***REMOVED***200" data-sys-asset-uid="bltcbce74d3891aaa9d" data-sys-asset-filename="MATHERAN.jpg" data-sys-asset-contenttype="image/jpeg" data-sys-asset-position="right" sys-style-type="display"/></figure>`);
238+
})
235239
})
236240

0 commit comments

Comments
 (0)