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
0330166c
Commit
0330166c
authored
Nov 03, 2021
by
Eduardo Sanz García
Committed by
Eduardo
Nov 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove elements created during test
parent
63545fd3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
9 deletions
+28
-9
html-test.js
src/annotator/integrations/test/html-test.js
+9
-5
pdf-test.js
src/annotator/integrations/test/pdf-test.js
+10
-4
sidebar-trigger-test.js
src/annotator/test/sidebar-trigger-test.js
+5
-0
dom-test.js
src/sidebar/util/test/dom-test.js
+4
-0
No files found.
src/annotator/integrations/test/html-test.js
View file @
0330166c
...
@@ -77,13 +77,17 @@ describe('HTMLIntegration', () => {
...
@@ -77,13 +77,17 @@ describe('HTMLIntegration', () => {
const
highlight
=
document
.
createElement
(
'div'
);
const
highlight
=
document
.
createElement
(
'div'
);
document
.
body
.
appendChild
(
highlight
);
document
.
body
.
appendChild
(
highlight
);
const
anchor
=
{
highlights
:
[
highlight
]
};
try
{
const
anchor
=
{
highlights
:
[
highlight
]
};
const
integration
=
new
HTMLIntegration
();
const
integration
=
new
HTMLIntegration
();
await
integration
.
scrollToAnchor
(
anchor
);
await
integration
.
scrollToAnchor
(
anchor
);
assert
.
calledOnce
(
fakeScrollIntoView
);
assert
.
calledOnce
(
fakeScrollIntoView
);
assert
.
calledWith
(
fakeScrollIntoView
,
highlight
,
sinon
.
match
.
func
);
assert
.
calledWith
(
fakeScrollIntoView
,
highlight
,
sinon
.
match
.
func
);
}
finally
{
highlight
.
remove
();
}
});
});
});
});
...
...
src/annotator/integrations/test/pdf-test.js
View file @
0330166c
...
@@ -104,6 +104,7 @@ describe('annotator/integrations/pdf', () => {
...
@@ -104,6 +104,7 @@ describe('annotator/integrations/pdf', () => {
pdfIntegration
?.
destroy
();
pdfIntegration
?.
destroy
();
delete
window
.
PDFViewerApplication
;
delete
window
.
PDFViewerApplication
;
outerContainer
.
remove
();
outerContainer
.
remove
();
document
.
querySelector
(
'hypothesis-banner'
)?.
remove
();
// <hypothesis-banner> elements are created outside the outerContainer
$imports
.
$restore
();
$imports
.
$restore
();
});
});
...
@@ -288,11 +289,16 @@ describe('annotator/integrations/pdf', () => {
...
@@ -288,11 +289,16 @@ describe('annotator/integrations/pdf', () => {
pdfIntegration
=
createPDFIntegration
();
pdfIntegration
=
createPDFIntegration
();
document
.
body
.
appendChild
(
anchor
.
highlights
[
0
]);
document
.
body
.
appendChild
(
anchor
.
highlights
[
0
]);
await
triggerUpdate
();
assert
.
equal
(
anchor
.
highlights
.
length
,
1
);
try
{
assert
.
ok
(
anchor
.
range
);
await
triggerUpdate
();
assert
.
notCalled
(
fakeAnnotator
.
anchor
);
assert
.
equal
(
anchor
.
highlights
.
length
,
1
);
assert
.
ok
(
anchor
.
range
);
assert
.
notCalled
(
fakeAnnotator
.
anchor
);
}
finally
{
anchor
.
highlights
[
0
].
remove
();
}
});
});
});
});
...
...
src/annotator/test/sidebar-trigger-test.js
View file @
0330166c
...
@@ -14,6 +14,11 @@ describe('sidebarTrigger', () => {
...
@@ -14,6 +14,11 @@ describe('sidebarTrigger', () => {
document
.
body
.
appendChild
(
triggerEl2
);
document
.
body
.
appendChild
(
triggerEl2
);
});
});
afterEach
(()
=>
{
triggerEl1
.
remove
();
triggerEl2
.
remove
();
});
it
(
'calls the show callback which a trigger button is clicked'
,
()
=>
{
it
(
'calls the show callback which a trigger button is clicked'
,
()
=>
{
const
fakeShowFn
=
sinon
.
stub
();
const
fakeShowFn
=
sinon
.
stub
();
sidebarTrigger
(
document
,
fakeShowFn
);
sidebarTrigger
(
document
,
fakeShowFn
);
...
...
src/sidebar/util/test/dom-test.js
View file @
0330166c
...
@@ -11,6 +11,10 @@ describe('sidebar/util/dom', () => {
...
@@ -11,6 +11,10 @@ describe('sidebar/util/dom', () => {
document
.
body
.
appendChild
(
theElement
);
document
.
body
.
appendChild
(
theElement
);
});
});
afterEach
(()
=>
{
theElement
.
remove
();
});
it
(
"should return an element's height"
,
()
=>
{
it
(
"should return an element's height"
,
()
=>
{
const
testElement
=
document
.
getElementById
(
'testElement'
);
const
testElement
=
document
.
getElementById
(
'testElement'
);
assert
.
equal
(
getElementHeightWithMargins
(
testElement
),
450
);
assert
.
equal
(
getElementHeightWithMargins
(
testElement
),
450
);
...
...
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