File tree 3 files changed +38
-20
lines changed 3 files changed +38
-20
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export default {
73
73
)
74
74
return h (
75
75
'div' ,
76
- { attrs : { id : t . safeId ( ) } , class : t . dropdownClasses , style : t . dropdownStyles } ,
76
+ { attrs : { id : t . safeId ( ) } , class : t . dropdownClasses } ,
77
77
[ split , toggle , menu ]
78
78
)
79
79
} ,
@@ -111,24 +111,21 @@ export default {
111
111
} ,
112
112
computed : {
113
113
dropdownClasses ( ) {
114
+ let position = ''
115
+ // Position `static` is needed to allow menu to "breakout" of the scrollParent boundaries
116
+ // See https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
117
+ if ( this . boundary === 'scrollParent' || ! this . boundary ) {
118
+ position = 'position-static'
119
+ }
114
120
return [
115
121
'btn-group' ,
116
122
'b-dropdown' ,
117
123
'dropdown' ,
118
124
this . dropup ? 'dropup' : '' ,
119
- this . visible ? 'show' : ''
125
+ this . visible ? 'show' : '' ,
126
+ position
120
127
]
121
128
} ,
122
- dropdownStyles ( ) {
123
- // Position `static` is needed to allow menu to "breakout" of the scrollParent boundaries
124
- // See https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
125
- if ( this . boundary === 'scrollParent' || ! this . boundary ) {
126
- return { }
127
- }
128
- // We enable this feature only when the user supplies a boundary other than `scrollParent`
129
- // to preserve default functionality
130
- return { position : 'static' }
131
- } ,
132
129
menuClasses ( ) {
133
130
return [
134
131
'dropdown-menu' ,
Original file line number Diff line number Diff line change @@ -58,7 +58,21 @@ describe('dropdown', async () => {
58
58
. find ( node => node . tagName === 'BUTTON' && node . id === `${ dd_8 . safeId ( '_BV_toggle_' ) } ` )
59
59
expect ( toggle ) . toHaveClass ( 'dropdown-toggle' )
60
60
} )
61
+ /*
62
+ it('boundary set to viewport should have class position-static', async () => {
63
+ const {app: {$refs}} = window
64
+ const {dd_9} = $refs
65
+
66
+ expect(dd_9).toHaveClass('position-static')
67
+ })
61
68
69
+ it('boundary not set should not have class position-static', async () => {
70
+ const {app: {$refs}} = window
71
+ const {dd_1} = $refs
72
+
73
+ expect(dd_1).not.toHaveClass('position-static')
74
+ })
75
+ */
62
76
it ( 'dd-item should render as link by default' , async ( ) => {
63
77
const { app : { $refs} } = window
64
78
const { dd_6} = $refs
Original file line number Diff line number Diff line change 9
9
< b-dropdown-item href ="# "> Something else here</ b-dropdown-item >
10
10
</ b-dropdown >
11
11
12
- < br >
13
- < br >
12
+ < br > < br >
14
13
15
14
< b-dropdown ref ="dd_2 "
16
15
text ="Split Dropdown Button "
22
21
< b-dropdown-item href ="# "> Something else here...</ b-dropdown-item >
23
22
</ b-dropdown >
24
23
25
- < br >
26
- < br >
24
+ < br > < br >
27
25
28
26
< b-dropdown ref ="dd_3 "
29
27
text ="Right align "
35
33
< b-dropdown-item href ="# "> Something else here</ b-dropdown-item >
36
34
</ b-dropdown >
37
35
38
- < br >
39
- < br >
36
+ < br > < br >
40
37
41
38
< b-dropdown ref ="dd_4 "
42
39
text ="Drop-Up "
48
45
< b-dropdown-item href ="# "> Something else here</ b-dropdown-item >
49
46
</ b-dropdown >
50
47
51
- < br >
52
- < br >
48
+ < br > < br >
53
49
54
50
< b-dd ref ="dd_5 "
55
51
text ="Link "
68
64
< b-dropdown-divider > </ b-dropdown-divider >
69
65
</ b-dropdown >
70
66
67
+ < br > < br >
68
+
71
69
< b-dropdown ref ="dd_7 " text ="Dropdown " variant ="link " no-caret >
72
70
< template slot ="button-content ">
73
71
< span > icon</ span >
78
76
< b-dropdown-item href ="# "> Something else here...</ b-dropdown-item >
79
77
</ b-dropdown >
80
78
79
+ < br > < br >
80
+
81
81
< b-dropdown ref ="dd_8 " text ="Dropdown " no-caret split >
82
82
< b-dropdown-item href ="# "> Action</ b-dropdown-item >
83
83
< b-dropdown-item href ="# "> Another action</ b-dropdown-item >
84
84
< b-dropdown-item href ="# "> Something else here...</ b-dropdown-item >
85
85
</ b-dropdown >
86
+
87
+ < br > < br >
88
+
89
+ < b-dropdown ref ="dd_9 " text ="Dropdown " boundary ="viewport ">
90
+ < b-dropdown-item href ="# "> Action</ b-dropdown-item >
91
+ < b-dropdown-item href ="# "> Another action</ b-dropdown-item >
92
+ </ b-dropdown >
86
93
</ div >
You can’t perform that action at this time.
0 commit comments