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', () => {
...
@@ -62,6 +62,11 @@ describe('DastSiteProfileForm', () => {
const
findSiteValidationToggle
=
()
=>
findByTestId
(
'
dast-site-validation-toggle
'
);
const
findSiteValidationToggle
=
()
=>
findByTestId
(
'
dast-site-validation-toggle
'
);
const
findDastSiteValidation
=
()
=>
wrapper
.
find
(
DastSiteValidation
);
const
findDastSiteValidation
=
()
=>
wrapper
.
find
(
DastSiteValidation
);
const
setFieldValue
=
async
(
field
,
value
)
=>
{
await
field
.
setValue
(
value
);
field
.
trigger
(
'
blur
'
);
};
const
mockClientFactory
=
handlers
=>
{
const
mockClientFactory
=
handlers
=>
{
const
mockClient
=
createMockClient
();
const
mockClient
=
createMockClient
();
...
@@ -132,16 +137,13 @@ describe('DastSiteProfileForm', () => {
...
@@ -132,16 +137,13 @@ describe('DastSiteProfileForm', () => {
});
});
it
.
each
([
'
asd
'
,
'
example.com
'
])(
'
is marked as invalid provided an invalid URL
'
,
async
value
=>
{
it
.
each
([
'
asd
'
,
'
example.com
'
])(
'
is marked as invalid provided an invalid URL
'
,
async
value
=>
{
findTargetUrlInput
().
setValue
(
value
);
await
setFieldValue
(
findTargetUrlInput
(),
value
);
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
text
()).
toContain
(
errorMessage
);
expect
(
wrapper
.
text
()).
toContain
(
errorMessage
);
});
});
it
(
'
is marked as valid provided a valid URL
'
,
async
()
=>
{
it
(
'
is marked as valid provided a valid URL
'
,
async
()
=>
{
findTargetUrlInput
().
setValue
(
targetUrl
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
text
()).
not
.
toContain
(
errorMessage
);
expect
(
wrapper
.
text
()).
not
.
toContain
(
errorMessage
);
});
});
...
@@ -149,8 +151,7 @@ describe('DastSiteProfileForm', () => {
...
@@ -149,8 +151,7 @@ describe('DastSiteProfileForm', () => {
describe
(
'
validation
'
,
()
=>
{
describe
(
'
validation
'
,
()
=>
{
const
enableValidationToggle
=
async
()
=>
{
const
enableValidationToggle
=
async
()
=>
{
await
findTargetUrlInput
().
setValue
(
targetUrl
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
await
findTargetUrlInput
().
trigger
(
'
blur
'
);
await
findSiteValidationToggle
().
vm
.
$emit
(
'
change
'
,
true
);
await
findSiteValidationToggle
().
vm
.
$emit
(
'
change
'
,
true
);
};
};
...
@@ -197,9 +198,7 @@ describe('DastSiteProfileForm', () => {
...
@@ -197,9 +198,7 @@ describe('DastSiteProfileForm', () => {
it
(
'
toggle is disabled until target URL is valid
'
,
async
()
=>
{
it
(
'
toggle is disabled until target URL is valid
'
,
async
()
=>
{
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
true
);
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
true
);
await
findTargetUrlInput
().
setValue
(
targetUrl
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
await
findTargetUrlInput
().
trigger
(
'
input
'
);
await
findTargetUrlInput
().
trigger
(
'
blur
'
);
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
false
);
expect
(
findSiteValidationToggle
().
props
(
'
disabled
'
)).
toBe
(
false
);
});
});
...
@@ -308,11 +307,8 @@ describe('DastSiteProfileForm', () => {
...
@@ -308,11 +307,8 @@ describe('DastSiteProfileForm', () => {
describe
(
'
submission
'
,
()
=>
{
describe
(
'
submission
'
,
()
=>
{
const
fillAndSubmitForm
=
async
()
=>
{
const
fillAndSubmitForm
=
async
()
=>
{
await
findProfileNameInput
().
setValue
(
profileName
);
await
setFieldValue
(
findProfileNameInput
(),
profileName
);
findProfileNameInput
().
trigger
(
'
blur
'
);
await
setFieldValue
(
findTargetUrlInput
(),
targetUrl
);
await
findTargetUrlInput
().
setValue
(
targetUrl
);
findTargetUrlInput
().
trigger
(
'
blur
'
);
submitForm
();
submitForm
();
};
};
...
...
spec/frontend/vue_shared/directives/validation_spec.js
View file @
13314608
...
@@ -93,14 +93,14 @@ describe('validation directive', () => {
...
@@ -93,14 +93,14 @@ describe('validation directive', () => {
setValueAndTriggerValidation
(
validValue
);
setValueAndTriggerValidation
(
validValue
);
});
});
it
(
'
leave
s the field to be valid
'
,
()
=>
{
it
(
'
set
s the field to be valid
'
,
()
=>
{
expect
(
getFormData
().
fields
.
exampleField
).
toEqual
({
expect
(
getFormData
().
fields
.
exampleField
).
toEqual
({
state
:
true
,
state
:
true
,
feedback
:
''
,
feedback
:
''
,
});
});
});
});
it
(
'
leave
s the form to be valid
'
,
()
=>
{
it
(
'
set
s the form to be valid
'
,
()
=>
{
expect
(
getFormData
().
state
).
toBe
(
true
);
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