|
1 | 1 | import { fixtureSync, nextRender } from '@vaadin/testing-helpers'; |
2 | 2 | import { visualDiff } from '@web/test-runner-visual-regression'; |
3 | 3 | import '@vaadin/aura/aura.css'; |
| 4 | +import '@vaadin/form-layout/vaadin-form-layout.js'; |
| 5 | +import '@vaadin/text-field/vaadin-text-field.js'; |
4 | 6 | import '../../not-animated-styles.css'; |
5 | 7 | import '../../../vaadin-crud.js'; |
6 | 8 |
|
@@ -29,6 +31,29 @@ describe('crud', () => { |
29 | 31 | await visualDiff(element, 'no-row-borders'); |
30 | 32 | }); |
31 | 33 |
|
| 34 | + describe('custom form', () => { |
| 35 | + let form; |
| 36 | + |
| 37 | + beforeEach(async () => { |
| 38 | + form = document.createElement('vaadin-form-layout'); |
| 39 | + form.slot = 'form'; |
| 40 | + form.innerHTML = ` |
| 41 | + <vaadin-text-field path="name.first"></vaadin-text-field> |
| 42 | + <vaadin-text-field path="name.last"></vaadin-text-field> |
| 43 | + `; |
| 44 | + element.appendChild(form); |
| 45 | + await nextRender(); |
| 46 | + }); |
| 47 | + |
| 48 | + it('editor-first-field-focus', async () => { |
| 49 | + element.editedItem = element.items[0]; |
| 50 | + await nextRender(); |
| 51 | + form.querySelector('vaadin-text-field').focus(); |
| 52 | + const overlay = element.$.dialog.shadowRoot.querySelector('vaadin-crud-dialog-overlay'); |
| 53 | + await visualDiff(overlay.shadowRoot.querySelector('[part="overlay"]'), 'editor-first-field-focus'); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
32 | 57 | ['default', 'aside', 'bottom'].forEach((position) => { |
33 | 58 | describe(`editor-position-${position}`, () => { |
34 | 59 | beforeEach(async () => { |
|
0 commit comments