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
45064348
Commit
45064348
authored
Aug 05, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflict warning being incorrectly displayed
Hide warning when update request is in progress
parent
d70529df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
48 deletions
+73
-48
app/assets/javascripts/issue_show/components/form.vue
app/assets/javascripts/issue_show/components/form.vue
+4
-1
changelogs/unreleased/44036-someone-edited-the-issue-at-the-same-time-is-regularly-seen-despite-that-being-a-filthy-lie.yml
...ime-is-regularly-seen-despite-that-being-a-filthy-lie.yml
+5
-0
spec/javascripts/issue_show/components/form_spec.js
spec/javascripts/issue_show/components/form_spec.js
+64
-47
No files found.
app/assets/javascripts/issue_show/components/form.vue
View file @
45064348
...
...
@@ -70,6 +70,9 @@ export default {
hasIssuableTemplates
()
{
return
this
.
issuableTemplates
.
length
;
},
showLockedWarning
()
{
return
this
.
formState
.
lockedWarningVisible
&&
!
this
.
formState
.
updateLoading
;
},
},
created
()
{
eventHub
.
$on
(
'
delete.issuable
'
,
this
.
resetAutosave
);
...
...
@@ -117,7 +120,7 @@ export default {
<
template
>
<form>
<locked-warning
v-if=
"
formState.lockedWarningVisible
"
/>
<locked-warning
v-if=
"
showLockedWarning
"
/>
<div
class=
"row"
>
<div
v-if=
"hasIssuableTemplates"
class=
"col-sm-4 col-lg-3"
>
<description-template
...
...
changelogs/unreleased/44036-someone-edited-the-issue-at-the-same-time-is-regularly-seen-despite-that-being-a-filthy-lie.yml
0 → 100644
View file @
45064348
---
title
:
Fix flashing conflict warning when editing issues
merge_request
:
31469
author
:
type
:
fixed
spec/javascripts/issue_show/components/form_spec.js
View file @
45064348
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
formComponent
from
'
~/issue_show/components/form.vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
describe
(
'
Inline edit form component
'
,
()
=>
{
let
vm
;
let
autosave
;
let
autosaveObj
;
beforeEach
(
done
=>
{
autosaveObj
=
{
reset
:
jasmine
.
createSpy
()
};
autosave
=
spyOnDependency
(
formComponent
,
'
Autosave
'
).
and
.
returnValue
(
autosaveObj
);
const
defaultProps
=
{
canDestroy
:
true
,
formState
:
{
title
:
'
b
'
,
description
:
'
a
'
,
lockedWarningVisible
:
false
,
},
issuableType
:
'
issue
'
,
markdownPreviewPath
:
'
/
'
,
markdownDocsPath
:
'
/
'
,
projectPath
:
'
/
'
,
projectNamespace
:
'
/
'
,
};
afterEach
(()
=>
{
vm
.
$destroy
();
});
const
createComponent
=
props
=>
{
const
Component
=
Vue
.
extend
(
formComponent
);
vm
=
new
Component
({
propsData
:
{
canDestroy
:
true
,
formState
:
{
title
:
'
b
'
,
description
:
'
a
'
,
lockedWarningVisible
:
false
,
},
issuableType
:
'
issue
'
,
markdownPreviewPath
:
'
/
'
,
markdownDocsPath
:
'
/
'
,
projectPath
:
'
/
'
,
projectNamespace
:
'
/
'
,
},
}).
$mount
();
Vue
.
nextTick
(
done
);
});
vm
=
mountComponent
(
Component
,
{
...
defaultProps
,
...
props
,
});
};
it
(
'
does not render template selector if no templates exist
'
,
()
=>
{
createComponent
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-issuable-selector-wrap
'
)).
toBeNull
();
});
it
(
'
renders template selector when templates exists
'
,
done
=>
{
vm
.
issuableTemplates
=
[
'
test
'
];
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-issuable-selector-wrap
'
)).
not
.
toBeNull
();
it
(
'
renders template selector when templates exists
'
,
()
=>
{
createComponent
({
issuableTemplates
:
[
'
test
'
]
});
done
();
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-issuable-selector-wrap
'
)).
not
.
toBeNull
();
});
it
(
'
hides locked warning by default
'
,
()
=>
{
createComponent
();
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
)).
toBeNull
();
});
it
(
'
shows locked warning if formState is different
'
,
done
=>
{
vm
.
formState
.
lockedWarningVisible
=
true
;
it
(
'
shows locked warning if formState is different
'
,
()
=>
{
createComponent
({
formState
:
{
...
defaultProps
.
formState
,
lockedWarningVisible
:
true
}
})
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
)).
not
.
toBeNull
(
);
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
)).
not
.
toBeNull
();
}
);
done
();
it
(
'
hides locked warning when currently saving
'
,
()
=>
{
createComponent
({
formState
:
{
...
defaultProps
.
formState
,
updateLoading
:
true
,
lockedWarningVisible
:
true
},
});
});
it
(
'
initialized Autosave on mount
'
,
()
=>
{
expect
(
autosave
).
toHaveBeenCalledTimes
(
2
);
expect
(
vm
.
$el
.
querySelector
(
'
.alert
'
)).
toBeNull
();
});
it
(
'
calls reset on autosave when eventHub emits appropriate events
'
,
()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
describe
(
'
autosave
'
,
()
=>
{
let
autosaveObj
;
let
autosave
;
beforeEach
(()
=>
{
autosaveObj
=
{
reset
:
jasmine
.
createSpy
()
};
autosave
=
spyOnDependency
(
formComponent
,
'
Autosave
'
).
and
.
returnValue
(
autosaveObj
);
});
it
(
'
initialized Autosave on mount
'
,
()
=>
{
createComponent
();
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
2
);
expect
(
autosave
).
toHaveBeenCalledTimes
(
2
);
});
it
(
'
calls reset on autosave when eventHub emits appropriate events
'
,
()
=>
{
createComponent
();
eventHub
.
$emit
(
'
close.form
'
);
eventHub
.
$emit
(
'
delete.issuable
'
);
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
2
);
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
4
);
eventHub
.
$emit
(
'
delete.issuable
'
);
eventHub
.
$emit
(
'
update.issuable
'
);
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
4
);
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
6
);
eventHub
.
$emit
(
'
update.issuable
'
);
expect
(
autosaveObj
.
reset
).
toHaveBeenCalledTimes
(
6
);
});
});
});
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