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
Boxiang Sun
gitlab-ce
Commits
b2434666
Commit
b2434666
authored
Nov 04, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FE review, replace timeout with nexttick and improve assertion helper. add changelog
parent
03445de8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
changelogs/unreleased/fix-md-form-tabs-double-click-toggle.yml
...elogs/unreleased/fix-md-form-tabs-double-click-toggle.yml
+6
-0
spec/javascripts/vue_shared/components/markdown/field_spec.js
.../javascripts/vue_shared/components/markdown/field_spec.js
+14
-16
No files found.
changelogs/unreleased/fix-md-form-tabs-double-click-toggle.yml
0 → 100644
View file @
b2434666
---
title
:
Fix markdown form tabs toggling preview mode from double clicking write mode
button
merge_request
:
15119
author
:
type
:
fixed
spec/javascripts/vue_shared/components/markdown/field_spec.js
View file @
b2434666
import
Vue
from
'
vue
'
;
import
fieldComponent
from
'
~/vue_shared/components/markdown/field.vue
'
;
import
setTimeoutPromise
from
'
../../../helpers/set_timeout_promise_helper
'
;
function
assertMarkdownTabs
(
isWrite
,
writeLink
,
previewLink
,
vm
)
{
expect
(
writeLink
.
parentNode
.
classList
.
contains
(
'
active
'
)).
toEqual
(
isWrite
);
expect
(
previewLink
.
parentNode
.
classList
.
contains
(
'
active
'
)).
toEqual
(
!
isWrite
);
expect
(
vm
.
$el
.
querySelector
(
'
.md-preview
'
).
style
.
display
).
toEqual
(
isWrite
?
'
none
'
:
''
);
}
describe
(
'
Markdown field component
'
,
()
=>
{
let
vm
;
...
...
@@ -107,26 +112,19 @@ describe('Markdown field component', () => {
},
0
);
});
function
assertLinks
(
isWrite
)
{
expect
(
writeLink
.
parentNode
.
classList
.
contains
(
'
active
'
)).
toEqual
(
isWrite
);
expect
(
previewLink
.
parentNode
.
classList
.
contains
(
'
active
'
)).
toEqual
(
!
isWrite
);
expect
(
vm
.
$el
.
querySelector
(
'
.md-preview
'
).
style
.
display
).
toEqual
(
isWrite
?
'
none
'
:
''
);
}
it
(
'
clicking already active write or preview link does nothing
'
,
(
done
)
=>
{
writeLink
.
click
();
setTimeoutPromise
()
.
then
(()
=>
assertLinks
(
true
))
Vue
.
nextTick
()
.
then
(()
=>
assertMarkdownTabs
(
true
,
writeLink
,
previewLink
,
vm
))
.
then
(()
=>
writeLink
.
click
())
.
then
(()
=>
setTimeoutPromise
())
.
then
(()
=>
assert
Links
(
true
))
.
then
(()
=>
Vue
.
nextTick
())
.
then
(()
=>
assert
MarkdownTabs
(
true
,
writeLink
,
previewLink
,
vm
))
.
then
(()
=>
previewLink
.
click
())
.
then
(()
=>
setTimeoutPromise
())
.
then
(()
=>
assert
Links
(
false
))
.
then
(()
=>
Vue
.
nextTick
())
.
then
(()
=>
assert
MarkdownTabs
(
false
,
writeLink
,
previewLink
,
vm
))
.
then
(()
=>
previewLink
.
click
())
.
then
(()
=>
setTimeoutPromise
())
.
then
(()
=>
assert
Links
(
false
))
.
then
(()
=>
Vue
.
nextTick
())
.
then
(()
=>
assert
MarkdownTabs
(
false
,
writeLink
,
previewLink
,
vm
))
.
then
(
done
)
.
catch
(
done
.
fail
);
});
...
...
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