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
13314608
Commit
13314608
authored
Nov 03, 2020
by
Dave Pisek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feedback: Improve specs
* Fix test descriptions * Move setting input value to helper
parent
ef02c5c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_profile_form_spec.js
...e_profiles_form/components/dast_site_profile_form_spec.js
+11
-15
spec/frontend/vue_shared/directives/validation_spec.js
spec/frontend/vue_shared/directives/validation_spec.js
+2
-2
No files found.
ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_profile_form_spec.js
View file @
13314608
...
...
@@ -62,6 +62,11 @@ describe('DastSiteProfileForm', () => {
const
findSiteValidationToggle
=
()
=>
findByTestId
(
'
dast-site-validation-toggle
'
);
const
findDastSiteValidation
=
()
=>
wrapper
.
find
(
DastSiteValidation
);
const
setFieldValue
=
async
(
field
,
value
)
=>
{
await
field
.
setValue
(
value
);
field
.
trigger
(
'
blur
'
);
};
const
mockClientFactory
=
handlers
=>
{
const
mockClient
=
createMockClient
();
...
...
@@ -132,16 +137,13 @@ describe('DastSiteProfileForm', () => {
});
it
.
each
([
'
asd
'
,
'
example.com
'
])(
'
is marked as invalid provided an invalid URL
'
,
async
value
=>
{
findTargetUrlInput
().
setValue
(
value
);
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
wrapper
.
vm
.
$nextTick
();
await
setFieldValue
(
findTargetUrlInput
(),
value
);
expect
(
wrapper
.
text
()).
toContain
(
errorMessage
);
});
it
(
'
is marked as valid provided a valid URL
'
,
async
()
=>
{
findTargetUrlInput
().
setValue
(
targetUrl
);
await
wrapper
.
vm
.
$nextTick
();
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
errorMessage
);
});
...
...
@@ -149,8 +151,7 @@ describe('DastSiteProfileForm', () => {
describe
(
'
validation
'
,
()
=>
{
const
enableValidationToggle
=
async
()
=>
{
await
findTargetUrlInput
().
setValue
(
targetUrl
);
await
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
await
findSiteValidationToggle
().
vm
.
$emit
(
'
change
'
,
true
);
};
...
...
@@ -197,9 +198,7 @@ describe('DastSiteProfileForm', () => {
it
(
'
toggle is disabled until target URL is valid
'
,
async
()
=>
{
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
true
);
await
findTargetUrlInput
().
setValue
(
targetUrl
);
await
findTargetUrlInput
().
trigger
(
'
input
'
);
await
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
false
);
});
...
...
@@ -308,11 +307,8 @@ describe('DastSiteProfileForm', () => {
describe
(
'
submission
'
,
()
=>
{
const
fillAndSubmitForm
=
async
()
=>
{
await
findProfileNameInput
().
setValue
(
profileName
);
findProfileNameInput
().
trigger
(
'
blur
'
);
await
findTargetUrlInput
().
setValue
(
targetUrl
);
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
setFieldValue
(
findProfileNameInput
(),
profileName
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
submitForm
();
};
...
...
spec/frontend/vue_shared/directives/validation_spec.js
View file @
13314608
...
...
@@ -93,14 +93,14 @@ describe('validation directive', () => {
setValueAndTriggerValidation
(
validValue
);
});
it
(
'
leave
s the field to be valid
'
,
()
=>
{
it
(
'
set
s the field to be valid
'
,
()
=>
{
expect
(
getFormData
().
fields
.
exampleField
).
toEqual
({
state
:
true
,
feedback
:
''
,
});
});
it
(
'
leave
s the form to be valid
'
,
()
=>
{
it
(
'
set
s the form to be valid
'
,
()
=>
{
expect
(
getFormData
().
state
).
toBe
(
true
);
});
});
...
...
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