-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…7315) Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
- Loading branch information
1 parent
73b6ee3
commit f86e0ec
Showing
4 changed files
with
45 additions
and
6 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,40 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { fixtureSync, nextRender } from '@vaadin/testing-helpers'; | ||
import { ContextMenu } from '@vaadin/context-menu'; | ||
|
||
[{ tagName: ContextMenu.is }].forEach(({ tagName }) => { | ||
describe(`${tagName} re-layout`, () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = fixtureSync('<div></div>'); | ||
}); | ||
|
||
function renderChildren() { | ||
if (wrapper.children.length) { | ||
[...wrapper.children].forEach((child) => child.remove()); | ||
} | ||
|
||
wrapper.appendChild(document.createElement(tagName)); | ||
|
||
for (let i = 0; i < 100; i++) { | ||
const btn = document.createElement('button'); | ||
btn.textContent = `Button ${i}`; | ||
wrapper.appendChild(btn); | ||
wrapper.appendChild(document.createElement('br')); | ||
} | ||
} | ||
|
||
it(`should not reset scroll to top when creating a ${tagName}`, async () => { | ||
renderChildren(); | ||
await nextRender(); | ||
|
||
document.documentElement.scrollTop = 1000; | ||
|
||
renderChildren(); | ||
await nextRender(); | ||
|
||
expect(document.documentElement.scrollTop).to.equal(1000); | ||
}); | ||
}); | ||
}); |
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
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
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