Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dropdown): Use custom CSS for no-caret option #1473 #2136

Merged
merged 2 commits into from Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/dropdown/dropdown.css
@@ -0,0 +1,5 @@
/* See: https://github.com/bootstrap-vue/bootstrap-vue/issues/1473 */
/* See: https://github.com/twbs/bootstrap/issues/23724 */
.dropdown-toggle.dropdown-toggle-no-caret:after {
display: none !important;
}
6 changes: 4 additions & 2 deletions src/components/dropdown/dropdown.js
Expand Up @@ -3,6 +3,7 @@ import dropdownMixin from '../../mixins/dropdown'
import stripScripts from '../../utils/strip-scripts'
import bButton from '../button/button'

import './dropdown.css'
// Needed when dropdowns are inside an input group
import '../input-group/input-group.css'

Expand Down Expand Up @@ -163,9 +164,10 @@ export default {
},
toggleClasses () {
return [
'dropdown-toggle',
{
'dropdown-toggle': !this.noCaret || this.split,
'dropdown-toggle-split': this.split
'dropdown-toggle-split': this.split,
'dropdown-toggle-no-caret': this.noCaret && !this.split
},
this.toggleClass
]
Expand Down
8 changes: 4 additions & 4 deletions src/components/dropdown/dropdown.spec.js
Expand Up @@ -41,22 +41,22 @@ describe('dropdown', async () => {
});
*/

it('should not have a toggle caret when no-caret is true', async () => {
it('should have "dropdown-toggle-no-caret" class when no-caret is true', async () => {
const { app: { $refs } } = window
const { dd_7 } = $refs // eslint-disable-line camelcase

const toggle = Array.from(dd_7.$el.children)
.find(node => node.tagName === 'BUTTON' && node.id === `${dd_7.safeId('_BV_toggle_')}`)
expect(toggle).not.toHaveClass('dropdown-toggle')
expect(toggle).toHaveClass('dropdown-toggle-no-caret')
})

it('should have a toggle caret when no-caret and split are true', async () => {
it('should not have "dropdown-toggle-no-caret" class when no-caret and split are true', async () => {
const { app: { $refs } } = window
const { dd_8 } = $refs // eslint-disable-line camelcase

const toggle = Array.from(dd_8.$el.children)
.find(node => node.tagName === 'BUTTON' && node.id === `${dd_8.safeId('_BV_toggle_')}`)
expect(toggle).toHaveClass('dropdown-toggle')
expect(toggle).not.toHaveClass('dropdown-toggle-no-caret')
})
/*
it('boundary set to viewport should have class position-static', async () => {
Expand Down