Skip to content

Commit 8565976

Browse files
authored
fix: enforce zero padding on popover no-padding theme variant (#9845)
1 parent 1f39766 commit 8565976

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

packages/popover/src/styles/vaadin-popover-overlay-base-styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const popoverOverlay = css`
5050
}
5151
5252
:host([theme~='no-padding']) [part='content'] {
53-
padding: 0;
53+
padding: 0 !important;
5454
}
5555
5656
/* Increase the area of the popover so the pointer can go from the target directly to it. */

packages/popover/test/visual/base/popover.test.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,22 @@ describe('popover', () => {
8686
});
8787
});
8888

89-
it('no-padding', async () => {
90-
element.setAttribute('theme', 'no-padding');
91-
target.click();
92-
await nextRender();
93-
await visualDiff(div, 'no-padding');
89+
describe('no-padding', () => {
90+
before(() => {
91+
const contentStyles = new CSSStyleSheet();
92+
contentStyles.insertRule('vaadin-popover::part(content) { padding: 20px; }');
93+
document.adoptedStyleSheets = [contentStyles];
94+
});
95+
96+
after(() => {
97+
document.adoptedStyleSheets = [];
98+
});
99+
100+
it('no-padding', async () => {
101+
element.setAttribute('theme', 'no-padding');
102+
target.click();
103+
await nextRender();
104+
await visualDiff(div, 'no-padding');
105+
});
94106
});
95107
});

packages/popover/test/visual/lumo/popover.test.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,23 @@ describe('popover', () => {
5656
});
5757
});
5858

59-
it('no-padding', async () => {
60-
element.setAttribute('theme', 'no-padding');
61-
target.click();
62-
await nextRender();
63-
await visualDiff(div, 'no-padding');
59+
describe('no-padding', () => {
60+
before(() => {
61+
const contentStyles = new CSSStyleSheet();
62+
contentStyles.insertRule('vaadin-popover::part(content) { padding: 20px; }');
63+
document.adoptedStyleSheets = [contentStyles];
64+
});
65+
66+
after(() => {
67+
document.adoptedStyleSheets = [];
68+
});
69+
70+
it('no-padding', async () => {
71+
element.setAttribute('theme', 'no-padding');
72+
target.click();
73+
await nextRender();
74+
await visualDiff(div, 'no-padding');
75+
});
6476
});
6577

6678
it('custom offset', async () => {

packages/popover/theme/lumo/vaadin-popover-styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const popoverOverlay = css`
2020
}
2121
2222
:host([theme~='no-padding']) [part='content'] {
23-
padding: 0;
23+
padding: 0 !important;
2424
}
2525
2626
:host([theme~='arrow']) {

packages/vaadin-lumo-styles/src/components/popover-overlay.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737

3838
:host([theme~='no-padding']) [part='content'] {
39-
padding: 0;
39+
padding: 0 !important;
4040
}
4141

4242
[part='arrow'] {

0 commit comments

Comments
 (0)