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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
982ab870
Commit
982ab870
authored
May 18, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for testing when warning is visible
[ci skip]
parent
6a14a515
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
17 deletions
+77
-17
app/assets/javascripts/issue_show/components/form.vue
app/assets/javascripts/issue_show/components/form.vue
+1
-10
app/assets/javascripts/issue_show/components/locked_warning.vue
...sets/javascripts/issue_show/components/locked_warning.vue
+7
-7
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+32
-0
spec/javascripts/issue_show/components/form_spec.js
spec/javascripts/issue_show/components/form_spec.js
+37
-0
No files found.
app/assets/javascripts/issue_show/components/form.vue
View file @
982ab870
<
script
>
import
eventHub
from
'
../event_hub
'
;
import
lockedWarning
from
'
./locked_warning.vue
'
;
import
titleField
from
'
./fields/title.vue
'
;
import
descriptionField
from
'
./fields/description.vue
'
;
...
...
@@ -32,20 +31,12 @@
editActions
,
confidentialCheckbox
,
},
methods
:
{
closeForm
()
{
eventHub
.
$emit
(
'
close.form
'
);
this
.
formState
.
lockedWarningVisible
=
false
;
},
},
};
</
script
>
<
template
>
<form>
<locked-warning
v-if=
"formState.lockedWarningVisible"
@
closeForm=
"closeForm"
/>
<locked-warning
v-if=
"formState.lockedWarningVisible"
/>
<title-field
:form-state=
"formState"
/>
<confidential-checkbox
...
...
app/assets/javascripts/issue_show/components/locked_warning.vue
View file @
982ab870
<
script
>
export
default
{
methods
:
{
c
loseForm
()
{
this
.
$emit
(
'
closeForm
'
)
;
computed
:
{
c
urrentPath
()
{
return
location
.
pathname
;
},
},
};
...
...
@@ -10,11 +10,11 @@
<
template
>
<div
class=
"alert alert-danger"
>
Someone edited the issue the same time you did. Please check out
Someone edited the issue
at
the same time you did. Please check out
<a
href=
"#
"
role=
"button
"
@
click.prevent=
"closeForm
"
>
the issue
</a>
:href=
"currentPath
"
target=
"_blank
"
role=
"button
"
>
the issue
</a>
and make sure your changes will not unintentionally remove theirs.
</div>
</
template
>
spec/javascripts/issue_show/components/app_spec.js
View file @
982ab870
...
...
@@ -234,4 +234,36 @@ describe('Issuable output', () => {
});
});
});
describe
(
'
open form
'
,
()
=>
{
it
(
'
shows locked warning if form is open & data is different
'
,
(
done
)
=>
{
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
initialRequest
));
Vue
.
nextTick
()
.
then
(()
=>
new
Promise
((
resolve
)
=>
{
setTimeout
(
resolve
);
}))
.
then
(()
=>
{
vm
.
openForm
();
Vue
.
http
.
interceptors
.
push
(
issueShowInterceptor
(
issueShowData
.
secondRequest
));
return
new
Promise
((
resolve
)
=>
{
setTimeout
(
resolve
);
});
})
.
then
(()
=>
{
expect
(
vm
.
formState
.
lockedWarningVisible
,
).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
),
).
not
.
toBeNull
();
done
();
})
.
catch
(
done
.
fail
);
});
});
});
spec/javascripts/issue_show/components/form_spec.js
0 → 100644
View file @
982ab870
import
Vue
from
'
vue
'
;
import
formComponent
from
'
~/issue_show/components/form.vue
'
;
describe
(
'
Inline edit form component
'
,
()
=>
{
let
vm
;
beforeEach
((
done
)
=>
{
const
Component
=
Vue
.
extend
(
formComponent
);
vm
=
new
Component
({
propsData
:
{
canDestroy
:
true
,
formState
:
{
title
:
'
b
'
,
description
:
'
a
'
,
lockedWarningVisible
:
false
,
},
markdownPreviewUrl
:
'
/
'
,
markdownDocs
:
'
/
'
,
},
}).
$mount
();
Vue
.
nextTick
(
done
);
});
it
(
'
shows locked warning if formState is different
'
,
(
done
)
=>
{
vm
.
formState
.
lockedWarningVisible
=
true
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
),
).
not
.
toBeNull
();
done
();
});
});
});
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