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
128e0417
Commit
128e0417
authored
May 12, 2020
by
Scott Stern
Committed by
Paul Slaughter
May 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use replace mount with shallowMount in edit form specs
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31506
parent
8f803264
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
71 deletions
+92
-71
app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
...pts/sidebar/components/confidential/edit_form_buttons.vue
+6
-1
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
+41
-0
spec/frontend/sidebar/confidential/edit_form_spec.js
spec/frontend/sidebar/confidential/edit_form_spec.js
+45
-0
spec/frontend/sidebar/confidential_edit_buttons_spec.js
spec/frontend/sidebar/confidential_edit_buttons_spec.js
+0
-35
spec/frontend/sidebar/confidential_edit_form_buttons_spec.js
spec/frontend/sidebar/confidential_edit_form_buttons_spec.js
+0
-35
No files found.
app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
View file @
128e0417
...
@@ -40,7 +40,12 @@ export default {
...
@@ -40,7 +40,12 @@ export default {
<button
type=
"button"
class=
"btn btn-default append-right-10"
@
click=
"closeForm"
>
<button
type=
"button"
class=
"btn btn-default append-right-10"
@
click=
"closeForm"
>
{{
__
(
'
Cancel
'
)
}}
{{
__
(
'
Cancel
'
)
}}
</button>
</button>
<button
type=
"button"
class=
"btn btn-close"
@
click.prevent=
"submitForm"
>
<button
type=
"button"
class=
"btn btn-close"
data-testid=
"confidential-toggle"
@
click.prevent=
"submitForm"
>
{{
toggleButtonText
}}
{{
toggleButtonText
}}
</button>
</button>
</div>
</div>
...
...
spec/frontend/sidebar/confidential/edit_form_buttons_spec.js
0 → 100644
View file @
128e0417
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
EditFormButtons
from
'
~/sidebar/components/confidential/edit_form_buttons.vue
'
;
describe
(
'
Edit Form Buttons
'
,
()
=>
{
let
wrapper
;
const
findConfidentialToggle
=
()
=>
wrapper
.
find
(
'
[data-testid="confidential-toggle"]
'
);
const
createComponent
=
props
=>
{
wrapper
=
shallowMount
(
EditFormButtons
,
{
propsData
:
{
updateConfidentialAttribute
:
()
=>
{},
...
props
,
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
when not confidential
'
,
()
=>
{
it
(
'
renders Turn On in the
'
,
()
=>
{
createComponent
({
isConfidential
:
false
,
});
expect
(
findConfidentialToggle
().
text
()).
toBe
(
'
Turn On
'
);
});
});
describe
(
'
when confidential
'
,
()
=>
{
it
(
'
renders on or off text based on confidentiality
'
,
()
=>
{
createComponent
({
isConfidential
:
true
,
});
expect
(
findConfidentialToggle
().
text
()).
toBe
(
'
Turn Off
'
);
});
});
});
spec/frontend/sidebar/confidential/edit_form_spec.js
0 → 100644
View file @
128e0417
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
EditForm
from
'
~/sidebar/components/confidential/edit_form.vue
'
;
describe
(
'
Edit Form Dropdown
'
,
()
=>
{
let
wrapper
;
const
toggleForm
=
()
=>
{};
const
updateConfidentialAttribute
=
()
=>
{};
const
createComponent
=
props
=>
{
wrapper
=
shallowMount
(
EditForm
,
{
propsData
:
{
...
props
,
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
describe
(
'
when not confidential
'
,
()
=>
{
it
(
'
renders "You are going to turn off the confidentiality." in the
'
,
()
=>
{
createComponent
({
isConfidential
:
false
,
toggleForm
,
updateConfidentialAttribute
,
});
expect
(
wrapper
.
find
(
'
p
'
).
text
()).
toContain
(
'
You are going to turn on the confidentiality.
'
);
});
});
describe
(
'
when confidential
'
,
()
=>
{
it
(
'
renders on or off text based on confidentiality
'
,
()
=>
{
createComponent
({
isConfidential
:
true
,
toggleForm
,
updateConfidentialAttribute
,
});
expect
(
wrapper
.
find
(
'
p
'
).
text
()).
toContain
(
'
You are going to turn off the confidentiality.
'
);
});
});
});
spec/frontend/sidebar/confidential_edit_buttons_spec.js
deleted
100644 → 0
View file @
8f803264
import
Vue
from
'
vue
'
;
import
editFormButtons
from
'
~/sidebar/components/confidential/edit_form_buttons.vue
'
;
describe
(
'
Edit Form Buttons
'
,
()
=>
{
let
vm1
;
let
vm2
;
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
editFormButtons
);
const
toggleForm
=
()
=>
{};
const
updateConfidentialAttribute
=
()
=>
{};
vm1
=
new
Component
({
propsData
:
{
isConfidential
:
true
,
toggleForm
,
updateConfidentialAttribute
,
},
}).
$mount
();
vm2
=
new
Component
({
propsData
:
{
isConfidential
:
false
,
toggleForm
,
updateConfidentialAttribute
,
},
}).
$mount
();
});
it
(
'
renders on or off text based on confidentiality
'
,
()
=>
{
expect
(
vm1
.
$el
.
innerHTML
.
includes
(
'
Turn Off
'
)).
toBe
(
true
);
expect
(
vm2
.
$el
.
innerHTML
.
includes
(
'
Turn On
'
)).
toBe
(
true
);
});
});
spec/frontend/sidebar/confidential_edit_form_buttons_spec.js
deleted
100644 → 0
View file @
8f803264
import
Vue
from
'
vue
'
;
import
editForm
from
'
~/sidebar/components/confidential/edit_form.vue
'
;
describe
(
'
Edit Form Dropdown
'
,
()
=>
{
let
vm1
;
let
vm2
;
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
editForm
);
const
toggleForm
=
()
=>
{};
const
updateConfidentialAttribute
=
()
=>
{};
vm1
=
new
Component
({
propsData
:
{
isConfidential
:
true
,
toggleForm
,
updateConfidentialAttribute
,
},
}).
$mount
();
vm2
=
new
Component
({
propsData
:
{
isConfidential
:
false
,
toggleForm
,
updateConfidentialAttribute
,
},
}).
$mount
();
});
it
(
'
renders on the appropriate warning text
'
,
()
=>
{
expect
(
vm1
.
$el
.
innerHTML
.
includes
(
'
You are going to turn off the confidentiality.
'
)).
toBe
(
true
);
expect
(
vm2
.
$el
.
innerHTML
.
includes
(
'
You are going to turn on the confidentiality.
'
)).
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