File tree Expand file tree Collapse file tree 13 files changed +56
-38
lines changed
javascripts/vue_shared/components/markdown
javascripts/vue_shared/components/markdown Expand file tree Collapse file tree 13 files changed +56
-38
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
2
import $ from ' jquery' ;
3
- import tooltip from ' ../../directives/tooltip' ;
4
- import toolbarButton from ' ./toolbar_button.vue' ;
5
- import icon from ' ../icon.vue' ;
3
+ import Tooltip from ' ../../directives/tooltip' ;
4
+ import ToolbarButton from ' ./toolbar_button.vue' ;
5
+ import Icon from ' ../icon.vue' ;
6
6
7
7
export default {
8
8
directives: {
9
- tooltip ,
9
+ Tooltip ,
10
10
},
11
11
components: {
12
- toolbarButton ,
13
- icon ,
12
+ ToolbarButton ,
13
+ Icon ,
14
14
},
15
15
props: {
16
16
previewMarkdown: {
@@ -68,27 +68,27 @@ export default {
68
68
:class =" { active: !previewMarkdown }"
69
69
class =" md-header-tab"
70
70
>
71
- <a
71
+ <button
72
72
class =" js-write-link"
73
- href =" #md-write-holder"
74
73
tabindex =" -1"
75
- @click.prevent =" writeMarkdownTab($event)"
74
+ type =" button"
75
+ @click =" writeMarkdownTab($event)"
76
76
>
77
77
Write
78
- </a >
78
+ </button >
79
79
</li >
80
80
<li
81
81
:class =" { active: previewMarkdown }"
82
82
class =" md-header-tab"
83
83
>
84
- <a
84
+ <button
85
85
class =" js-preview-link js-md-preview-button"
86
- href =" #md-preview-holder"
87
86
tabindex =" -1"
88
- @click.prevent =" previewMarkdownTab($event)"
87
+ type =" button"
88
+ @click =" previewMarkdownTab($event)"
89
89
>
90
90
Preview
91
- </a >
91
+ </button >
92
92
</li >
93
93
<li
94
94
:class =" { active: !previewMarkdown }"
Original file line number Diff line number Diff line change 161
161
162
162
.nav-links li {
163
163
& .active a ,
164
+ & .md-header-tab.active button ,
164
165
a .active {
165
166
border-bottom : 2px solid $active-tab-border ;
166
167
Original file line number Diff line number Diff line change 72
72
.md-header-tab {
73
73
@include media-breakpoint-down (xs) {
74
74
flex : 1 ;
75
+ flex-direction : column ;
75
76
width : 100% ;
76
77
border-bottom : 1px solid $border-color ;
77
78
text-align : center ;
Original file line number Diff line number Diff line change 8
8
height : auto ;
9
9
border-bottom : 1px solid $border-color ;
10
10
11
- li {
11
+ li :not ( .md-header-toolbar ) {
12
12
display : flex ;
13
13
14
- a {
14
+ a ,
15
+ button {
15
16
padding : $gl-btn-padding ;
16
17
padding-bottom : 11px ;
17
18
font-size : 14px ;
18
19
line-height : 28px ;
19
20
color : $gl-text-color-secondary ;
21
+ border : 0 ;
20
22
border-bottom : 2px solid transparent ;
21
23
white-space : nowrap ;
22
24
33
35
}
34
36
}
35
37
38
+ button {
39
+ padding-top : 0 ;
40
+ }
41
+
36
42
& .active a ,
43
+ & .active button ,
37
44
a .active {
38
45
color : $black ;
39
46
font-weight : $gl-font-weight-bold ;
42
49
color : $black ;
43
50
}
44
51
}
52
+
53
+ & .md-header-tab button {
54
+ line-height : 19px ;
55
+ }
45
56
}
46
57
}
47
58
Original file line number Diff line number Diff line change 11
11
.md-header
12
12
%ul .nav.nav-tabs.nav-links.clearfix
13
13
%li .md-header-tab.active
14
- %a .js-md-write-button { href: "#md- write-holder " , tabindex: -1 }
14
+ %button .js-md-write-button { tabindex: -1 }
15
15
Write
16
16
%li.md-header-tab
17
- %a .js-md-preview-button{ href: " #md-preview-holder", tabindex: -1 }
17
+ %button .js-md-preview-button{ tabindex: -1 }
18
18
Preview
19
19
20
20
%li.md-header-toolbar.active
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Change markdown header tab anchor links to buttons
3
+ merge_request : 21988
4
+ author : George Tsiolis
5
+ type : other
Original file line number Diff line number Diff line change 23
23
24
24
description . native . send_keys ( '' )
25
25
26
- click_link ( 'Preview' )
26
+ click_button ( 'Preview' )
27
27
28
28
preview = find ( '.js-md-preview' )
29
29
30
30
expect ( preview ) . to have_content ( 'Nothing to preview.' )
31
31
32
- click_link ( 'Write' )
32
+ click_button ( 'Write' )
33
33
34
34
description . native . send_keys ( ':+1: Nice' )
35
35
36
- click_link ( 'Preview' )
36
+ click_button ( 'Preview' )
37
37
38
38
expect ( preview ) . to have_css ( 'gl-emoji' )
39
39
expect ( find ( '#milestone_description' , visible : false ) ) . not_to be_visible
Original file line number Diff line number Diff line change 47
47
textarea = first ( ".gfm-form textarea" )
48
48
49
49
page . within ( form ) do
50
- click_link ( "Preview" )
50
+ click_button ( "Preview" )
51
51
52
52
preview = find ( ".js-md-preview" ) # this element is findable only when the "Preview" link is clicked.
53
53
54
54
expect ( preview ) . to have_content ( "Nothing to preview." )
55
55
56
- click_link ( "Write" )
56
+ click_button ( "Write" )
57
57
fill_in ( "Description" , with : "Bug fixed :smile:" )
58
- click_link ( "Preview" )
58
+ click_button ( "Preview" )
59
59
60
60
expect ( preview ) . to have_css ( "gl-emoji" )
61
61
expect ( textarea ) . not_to be_visible
Original file line number Diff line number Diff line change 17
17
18
18
page . within ( form ) do
19
19
fill_in ( "Description" , with : "Bug fixed :smile:" )
20
- click_link ( "Preview" )
20
+ click_button ( "Preview" )
21
21
end
22
22
23
- expect ( form ) . to have_link ( "Write" )
23
+ expect ( form ) . to have_button ( "Write" )
24
24
end
25
25
end
Original file line number Diff line number Diff line change 41
41
find ( '.gfm-form' ) . fill_in ( :merge_request_description , with : '' )
42
42
43
43
page . within ( '.gfm-form' ) do
44
- click_link ( 'Preview' )
44
+ click_button ( 'Preview' )
45
45
46
46
expect ( find ( '.js-md-preview' ) ) . to have_content ( 'Nothing to preview.' )
47
47
end
51
51
find ( '.gfm-form' ) . fill_in ( :merge_request_description , with : ':+1: Nice' )
52
52
53
53
page . within ( '.gfm-form' ) do
54
- click_link ( 'Preview' )
54
+ click_button ( 'Preview' )
55
55
56
56
expect ( find ( '.js-md-preview' ) ) . to have_css ( 'gl-emoji' )
57
57
end
58
58
59
- expect ( find ( '.gfm-form' ) ) . to have_css ( '.js-md-preview' ) . and have_link ( 'Write' )
59
+ expect ( find ( '.gfm-form' ) ) . to have_css ( '.js-md-preview' ) . and have_button ( 'Write' )
60
60
expect ( find ( '#merge_request_description' , visible : false ) ) . not_to be_visible
61
61
end
62
62
end
You can’t perform that action at this time.
0 commit comments