-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add popover Lumo and Material theme and visual tests (#7411)
- Loading branch information
1 parent
fe73eed
commit c8f5dde
Showing
28 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { fixtureSync, nextRender, nextUpdate } from '@vaadin/testing-helpers'; | ||
import { visualDiff } from '@web/test-runner-visual-regression'; | ||
import '@vaadin/vaadin-lumo-styles/test/autoload.js'; | ||
import '../../not-animated-styles.js'; | ||
import '../../../theme/lumo/vaadin-popover.js'; | ||
|
||
describe('popover', () => { | ||
let div, target, element; | ||
|
||
beforeEach(async () => { | ||
element = fixtureSync('<vaadin-popover></vaadin-popover>'); | ||
element.renderer = (root) => { | ||
root.textContent = 'Content'; | ||
}; | ||
div = fixtureSync(` | ||
<div style="display: flex; width: 300px; height: 300px; justify-content: center; align-items: center"> | ||
<div style="width: 100px; height: 100px; outline: 1px solid red;"></div> | ||
</div> | ||
`); | ||
target = div.firstElementChild; | ||
element.target = target; | ||
await nextRender(); | ||
}); | ||
|
||
[ | ||
'top-start', | ||
'top', | ||
'top-end', | ||
'bottom-start', | ||
'bottom', | ||
'bottom-end', | ||
'start-top', | ||
'start', | ||
'start-bottom', | ||
'end-top', | ||
'end', | ||
'end-bottom', | ||
].forEach((position) => { | ||
it(position, async () => { | ||
element.position = position; | ||
await nextUpdate(element); | ||
target.click(); | ||
await nextRender(); | ||
await visualDiff(div, position); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+5.38 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/bottom-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.29 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/bottom-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.31 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.34 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/end-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.48 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/end-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.53 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.46 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/start-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.56 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/start-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.63 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.57 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/top-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.47 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/top-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.49 KB
packages/popover/test/visual/lumo/screenshots/popover/baseline/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { fixtureSync, nextRender, nextUpdate } from '@vaadin/testing-helpers'; | ||
import { visualDiff } from '@web/test-runner-visual-regression'; | ||
import '@vaadin/vaadin-lumo-styles/test/autoload.js'; | ||
import '../../not-animated-styles.js'; | ||
import '../../../theme/material/vaadin-popover.js'; | ||
|
||
describe('popover', () => { | ||
let div, target, element; | ||
|
||
beforeEach(async () => { | ||
element = fixtureSync('<vaadin-popover></vaadin-popover>'); | ||
element.renderer = (root) => { | ||
root.textContent = 'Content'; | ||
}; | ||
div = fixtureSync(` | ||
<div style="display: flex; width: 300px; height: 300px; justify-content: center; align-items: center"> | ||
<div style="width: 100px; height: 100px; outline: 1px solid red;"></div> | ||
</div> | ||
`); | ||
target = div.firstElementChild; | ||
element.target = target; | ||
await nextRender(); | ||
}); | ||
|
||
[ | ||
'top-start', | ||
'top', | ||
'top-end', | ||
'bottom-start', | ||
'bottom', | ||
'bottom-end', | ||
'start-top', | ||
'start', | ||
'start-bottom', | ||
'end-top', | ||
'end', | ||
'end-bottom', | ||
].forEach((position) => { | ||
it(position, async () => { | ||
element.position = position; | ||
await nextUpdate(element); | ||
target.click(); | ||
await nextRender(); | ||
await visualDiff(div, position); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+3.26 KB
packages/popover/test/visual/material/screenshots/popover/baseline/bottom-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.22 KB
...ages/popover/test/visual/material/screenshots/popover/baseline/bottom-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.22 KB
packages/popover/test/visual/material/screenshots/popover/baseline/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.27 KB
packages/popover/test/visual/material/screenshots/popover/baseline/end-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.28 KB
packages/popover/test/visual/material/screenshots/popover/baseline/end-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.29 KB
packages/popover/test/visual/material/screenshots/popover/baseline/end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.31 KB
...ages/popover/test/visual/material/screenshots/popover/baseline/start-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.33 KB
packages/popover/test/visual/material/screenshots/popover/baseline/start-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.33 KB
packages/popover/test/visual/material/screenshots/popover/baseline/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.29 KB
packages/popover/test/visual/material/screenshots/popover/baseline/top-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.25 KB
packages/popover/test/visual/material/screenshots/popover/baseline/top-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.27 KB
packages/popover/test/visual/material/screenshots/popover/baseline/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import '@vaadin/vaadin-lumo-styles/color.js'; | ||
import '@vaadin/vaadin-lumo-styles/style.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
const popoverOverlay = css` | ||
:host { | ||
--vaadin-popover-offset-top: var(--lumo-space-xs); | ||
--vaadin-popover-offset-bottom: var(--lumo-space-xs); | ||
--vaadin-popover-offset-start: var(--lumo-space-xs); | ||
--vaadin-popover-offset-end: var(--lumo-space-xs); | ||
} | ||
[part='content'] { | ||
padding: var(--lumo-space-xs) var(--lumo-space-s); | ||
} | ||
`; | ||
|
||
registerStyles('vaadin-popover-overlay', [overlay, popoverOverlay], { moduleId: 'lumo-popover-overlay' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
const popoverOverlay = css` | ||
:host { | ||
--vaadin-popover-offset-top: 0.25rem; | ||
--vaadin-popover-offset-bottom: 0.25rem; | ||
--vaadin-popover-offset-start: 0.25rem; | ||
--vaadin-popover-offset-end: 0.25rem; | ||
} | ||
[part='content'] { | ||
padding: 0.25rem 0.5rem; | ||
} | ||
`; | ||
|
||
registerStyles('vaadin-popover-overlay', [overlay, popoverOverlay], { moduleId: 'material-popover-overlay' }); |