Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
3a503e50
Commit
3a503e50
authored
Aug 11, 2023
by
Yisu Kim
Committed by
Robert Knight
Aug 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for scrolling when the target is within the details tag
parent
de196f60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
scroll-test.js
src/annotator/util/test/scroll-test.js
+32
-0
No files found.
src/annotator/util/test/scroll-test.js
View file @
3a503e50
...
@@ -128,5 +128,37 @@ describe('annotator/util/scroll', () => {
...
@@ -128,5 +128,37 @@ describe('annotator/util/scroll', () => {
delete
document
.
body
.
tagName
;
delete
document
.
body
.
tagName
;
}
}
});
});
// 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'
);
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'
;
details
.
style
.
top
=
'1000px'
;
container
.
append
(
details
);
const
summary
=
document
.
createElement
(
'summary'
);
summary
.
append
(
'Summary'
);
details
.
append
(
summary
);
const
target
=
document
.
createElement
(
'div'
);
target
.
style
.
height
=
'20px'
;
target
.
style
.
width
=
'100px'
;
details
.
append
(
target
);
await
scrollElementIntoView
(
target
,
{
maxDuration
:
1
});
const
containerRect
=
container
.
getBoundingClientRect
();
const
targetRect
=
target
.
getBoundingClientRect
();
assert
.
isTrue
(
containerRect
.
top
<=
targetRect
.
top
);
assert
.
isTrue
(
containerRect
.
bottom
>=
targetRect
.
bottom
);
});
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment