Skip to content

Commit c9a4c10

Browse files
authored
Merge pull request #2980 from mjmlio/fix-2979
fix(mjml-wrapper/section) border-radius bug #2979
2 parents ed6afa5 + 9224d69 commit c9a4c10

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/mjml-section/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ export default class MjSection extends BodyComponent {
100100
...(fullWidth ? {} : background),
101101
margin: '0px auto',
102102
'max-width': containerWidth,
103+
'border-radius': this.getAttribute('border-radius'),
104+
...(hasBorderRadius && { overflow: 'hidden' }),
103105
},
104106
innerDiv: {
105107
'line-height': '0',

packages/mjml/test/wrapper-border-radius.test.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const $ = load(html)
2323
// border radius values should be correct
2424
chai
2525
.expect(
26-
$('body > div > div > table:first-child > tbody > tr > td')
26+
$(
27+
'body > div > div > table:first-child > tbody > tr > td, body > div > div',
28+
)
2729
.map(function getAttr() {
2830
const start = $(this).attr('style').indexOf('border-radius:') + 14
2931
const end = $(this).attr('style').indexOf(';', start)
@@ -32,7 +34,21 @@ chai
3234
.get(),
3335
'Border-radius in CSS style values on mj-wrapper',
3436
)
35-
.to.eql(['10px'])
37+
.to.eql(['10px', '10px'])
38+
39+
// overflow value should be correct
40+
chai
41+
.expect(
42+
$('body > div > div')
43+
.map(function getAttr() {
44+
const start = $(this).attr('style').indexOf('overflow:') + 9
45+
const end = $(this).attr('style').indexOf(';', start)
46+
return $(this).attr('style').substring(start, end)
47+
})
48+
.get(),
49+
'Overflow in CSS style values on mj-wrapper',
50+
)
51+
.to.eql(['hidden'])
3652

3753
// border collapse values should be correct
3854
chai

0 commit comments

Comments
 (0)