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
7c2ddbb7
Commit
7c2ddbb7
authored
Nov 10, 2021
by
Eduardo Sanz García
Committed by
Eduardo
Nov 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore `sinon.useFakeTimers()`
parent
d70da1e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
22 deletions
+28
-22
Menu-test.js
src/sidebar/components/test/Menu-test.js
+13
-9
MenuKeyboardNavigation-test.js
src/sidebar/components/test/MenuKeyboardNavigation-test.js
+0
-1
postmessage-json-rpc-test.js
src/sidebar/util/test/postmessage-json-rpc-test.js
+15
-12
No files found.
src/sidebar/components/test/Menu-test.js
View file @
7c2ddbb7
...
...
@@ -183,15 +183,19 @@ describe('Menu', () => {
shouldClose
?
'closes'
:
"doesn't close"
}
when user performs a "
${
eventType
}
" (key: "
${
key
}
") on menu content`
,
()
=>
{
clock
=
sinon
.
useFakeTimers
();
const
wrapper
=
createMenu
({
defaultOpen
:
true
});
wrapper
.
find
(
'.Menu__content'
).
simulate
(
eventType
,
{
key
});
// The close event is delayed by a minimal amount of time in
// order to allow links to say in the DOM long enough to be
// followed on a click. Therefore, this test must simulate
// time passing in order for the menu to close.
clock
.
tick
(
1
);
wrapper
.
update
();
assert
.
equal
(
isOpen
(
wrapper
),
!
shouldClose
);
try
{
const
wrapper
=
createMenu
({
defaultOpen
:
true
});
wrapper
.
find
(
'.Menu__content'
).
simulate
(
eventType
,
{
key
});
// The close event is delayed by a minimal amount of time in
// order to allow links to say in the DOM long enough to be
// followed on a click. Therefore, this test must simulate
// time passing in order for the menu to close.
clock
.
tick
(
1
);
wrapper
.
update
();
assert
.
equal
(
isOpen
(
wrapper
),
!
shouldClose
);
}
finally
{
clock
.
restore
();
}
});
});
...
...
src/sidebar/components/test/MenuKeyboardNavigation-test.js
View file @
7c2ddbb7
...
...
@@ -70,7 +70,6 @@ describe('MenuKeyboardNavigation', () => {
});
it
(
'sets focus to the first `menuitem` child when `visible` is true'
,
()
=>
{
const
clock
=
sinon
.
useFakeTimers
();
createMenuItem
({
visible
:
true
});
clock
.
tick
(
1
);
assert
.
equal
(
document
.
activeElement
.
innerText
,
'Item 1'
);
...
...
src/sidebar/util/test/postmessage-json-rpc-test.js
View file @
7c2ddbb7
...
...
@@ -148,18 +148,21 @@ describe('sidebar/util/postmessage-json-rpc', () => {
it
(
'if timeout is null, then it does not timeout'
,
async
()
=>
{
const
clock
=
sinon
.
useFakeTimers
();
const
result
=
doCall
(
null
);
clock
.
tick
(
100000
);
// wait a long time
fakeWindow
.
emitter
.
emit
(
'message'
,
{
origin
,
data
:
{
jsonrpc
:
'2.0'
,
id
:
messageId
,
result
:
{},
},
});
await
result
;
clock
.
restore
();
try
{
const
result
=
doCall
(
null
);
clock
.
tick
(
100000
);
// wait a long time
fakeWindow
.
emitter
.
emit
(
'message'
,
{
origin
,
data
:
{
jsonrpc
:
'2.0'
,
id
:
messageId
,
result
:
{},
},
});
await
result
;
}
finally
{
clock
.
restore
();
}
});
});
});
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