Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
98b1bda5
Commit
98b1bda5
authored
Feb 25, 2020
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert branches-select component to jest
parent
a01fb250
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
ee/spec/frontend/approvals/components/branches_select_spec.js
...pec/frontend/approvals/components/branches_select_spec.js
+7
-7
No files found.
ee/spec/
javascripts
/approvals/components/branches_select_spec.js
→
ee/spec/
frontend
/approvals/components/branches_select_spec.js
View file @
98b1bda5
...
...
@@ -8,7 +8,6 @@ const TEST_DEFAULT_BRANCH = { name: 'Any branch' };
const
TEST_PROJECT_ID
=
'
1
'
;
const
TEST_PROTECTED_BRANCHES
=
[{
id
:
1
,
name
:
'
master
'
},
{
id
:
2
,
name
:
'
development
'
}];
const
TEST_BRANCHES_SELECTIONS
=
[
TEST_DEFAULT_BRANCH
,
...
TEST_PROTECTED_BRANCHES
];
const
DEBOUNCE_TIME
=
250
;
const
waitForEvent
=
(
$input
,
event
)
=>
new
Promise
(
resolve
=>
$input
.
one
(
event
,
resolve
));
const
select2Container
=
()
=>
document
.
querySelector
(
'
.select2-container
'
);
const
select2DropdownOptions
=
()
=>
document
.
querySelectorAll
(
'
.result-name
'
);
...
...
@@ -39,18 +38,18 @@ describe('Branches Select', () => {
const
search
=
(
term
=
''
)
=>
{
$input
.
select2
(
'
search
'
,
term
);
j
asmine
.
clock
().
tick
(
DEBOUNCE_TIME
);
j
est
.
runAllTimers
(
);
};
beforeEach
(()
=>
{
j
asmine
.
clock
().
install
();
spyOn
(
Api
,
'
projectProtectedBranches
'
).
and
.
returnValue
(
Promise
.
resolve
(
TEST_PROTECTED_BRANCHES
),
);
j
est
.
useFakeTimers
();
jest
.
spyOn
(
Api
,
'
projectProtectedBranches
'
)
.
mockReturnValue
(
Promise
.
resolve
(
TEST_PROTECTED_BRANCHES
)
);
});
afterEach
(()
=>
{
j
asmine
.
clock
().
uninstall
();
j
est
.
clearAllTimers
();
wrapper
.
destroy
();
});
...
...
@@ -84,6 +83,7 @@ describe('Branches Select', () => {
it
(
'
fetches protected branches with search term
'
,
done
=>
{
const
term
=
'
lorem
'
;
waitForEvent
(
$input
,
'
select2-loaded
'
)
.
then
(()
=>
{})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
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