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
2e27873e
Commit
2e27873e
authored
Mar 27, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ee/ci_variable_list to Jest
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/194273
parent
1f6fe5a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
ee/spec/frontend/ci_variable_list/ci_variable_list_ee_spec.js
...pec/frontend/ci_variable_list/ci_variable_list_ee_spec.js
+85
-0
No files found.
ee/spec/
javascripts
/ci_variable_list/ci_variable_list_ee_spec.js
→
ee/spec/
frontend
/ci_variable_list/ci_variable_list_ee_spec.js
View file @
2e27873e
import
$
from
'
jquery
'
;
import
getSetTimeoutPromise
from
'
spec/helpers/set_timeout_promise_helper
'
;
import
VariableList
from
'
~/ci_variable_list/ci_variable_list
'
;
describe
(
'
VariableList (EE features)
'
,
()
=>
{
...
...
@@ -37,54 +36,49 @@ describe('VariableList (EE features)', () => {
$row
.
find
(
'
.js-variable-environment-dropdown-wrapper .js-dropdown-create-new-item
'
).
click
();
}
it
(
'
should add another row when editing the last rows environment dropdown
'
,
done
=>
{
it
(
'
should add another row when editing the last rows environment dropdown
'
,
()
=>
{
addRowByNewEnvironment
(
'
someenv
'
);
getSetTimeoutPromise
()
.
then
(()
=>
{
expect
(
$wrapper
.
find
(
'
.js-row
'
).
length
).
toBe
(
2
);
jest
.
runOnlyPendingTimers
();
// Check for the correct default in the new row
const
$environmentInput
=
$wrapper
.
find
(
'
.js-row:last-child
'
)
.
find
(
'
input[name="variables[variables_attributes][][environment_scope]"]
'
);
expect
(
$wrapper
.
find
(
'
.js-row
'
)).
toHaveLength
(
2
);
expect
(
$environmentInput
.
val
()).
toBe
(
'
*
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
// Check for the correct default in the new row
const
$environmentInput
=
$wrapper
.
find
(
'
.js-row:last-child
'
)
.
find
(
'
input[name="variables[variables_attributes][][environment_scope]"]
'
);
expect
(
$environmentInput
.
val
()).
toBe
(
'
*
'
);
});
it
(
'
should update dropdown with new environment values and remove values when row is removed
'
,
done
=>
{
it
(
'
should update dropdown with new environment values and remove values when row is removed
'
,
()
=>
{
addRowByNewEnvironment
(
'
someenv
'
);
const
$row
=
$wrapper
.
find
(
'
.js-row:last-child
'
);
$row
.
find
(
'
.js-variable-environment-toggle
'
).
click
();
getSetTimeoutPromise
()
.
then
(()
=>
{
const
$dropdownItemsBeforeRemove
=
$row
.
find
(
'
.js-variable-environment-dropdown-wrapper .dropdown-content a
'
,
);
expect
(
$dropdownItemsBeforeRemove
.
length
).
toBe
(
2
);
expect
(
$dropdownItemsBeforeRemove
[
0
].
textContent
.
trim
()).
toBe
(
'
someenv
'
);
expect
(
$dropdownItemsBeforeRemove
[
1
].
textContent
.
trim
()).
toBe
(
'
* (All environments)
'
);
$wrapper
.
find
(
'
.js-row-remove-button
'
).
trigger
(
'
click
'
);
expect
(
$wrapper
.
find
(
'
.js-row
'
).
length
).
toBe
(
0
);
})
.
then
(()
=>
{
const
$dropdownItemsAfterRemove
=
$row
.
find
(
'
.js-variable-environment-dropdown-wrapper .dropdown-content a
'
,
);
expect
(
$dropdownItemsAfterRemove
.
length
).
toBe
(
1
);
expect
(
$dropdownItemsAfterRemove
[
0
].
textContent
.
trim
()).
toBe
(
'
* (All environments)
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
jest
.
runOnlyPendingTimers
();
const
$dropdownItemsBeforeRemove
=
$row
.
find
(
'
.js-variable-environment-dropdown-wrapper .dropdown-content a
'
,
);
expect
(
$dropdownItemsBeforeRemove
).
toHaveLength
(
2
);
expect
(
$dropdownItemsBeforeRemove
[
0
].
textContent
.
trim
()).
toBe
(
'
someenv
'
);
expect
(
$dropdownItemsBeforeRemove
[
1
].
textContent
.
trim
()).
toBe
(
'
* (All environments)
'
);
$wrapper
.
find
(
'
.js-row-remove-button
'
).
trigger
(
'
click
'
);
expect
(
$wrapper
.
find
(
'
.js-row
'
)).
toHaveLength
(
0
);
jest
.
runOnlyPendingTimers
();
const
$dropdownItemsAfterRemove
=
$row
.
find
(
'
.js-variable-environment-dropdown-wrapper .dropdown-content a
'
,
);
expect
(
$dropdownItemsAfterRemove
).
toHaveLength
(
1
);
expect
(
$dropdownItemsAfterRemove
[
0
].
textContent
.
trim
()).
toBe
(
'
* (All environments)
'
);
});
});
});
...
...
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