Commit 5aaaf4e8 authored by Yisu Kim's avatar Yisu Kim Committed by Robert Knight

Add assert to check if details tag is open

parent e05a04ec
......@@ -129,14 +129,12 @@ describe('annotator/util/scroll', () => {
}
});
// A test for scrolling when there is a target within the 'details' tag.
it('scrolls element into view when the target is within the details tag',async () => {
const container = document.createElement('div');
it('scrolls element into view when the target is within the details tag', async () => {
const container = createContainer();
container.style.height = '500px';
container.style.overflow = 'auto';
container.style.position = 'relative';
document.body.append(container);
const details = document.createElement('details');
details.style.position = 'absolute';
......@@ -157,6 +155,7 @@ describe('annotator/util/scroll', () => {
const containerRect = container.getBoundingClientRect();
const targetRect = target.getBoundingClientRect();
assert.isTrue(details.open);
assert.isTrue(containerRect.top <= targetRect.top);
assert.isTrue(containerRect.bottom >= targetRect.bottom);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment