A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/0b7de29 below:

don't show if no title/content provide… · bootstrap-vue/bootstrap-vue@0b7de29 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+93

-13

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+93

-13

lines changed Original file line number Diff line number Diff line change

@@ -35,10 +35,10 @@ export const BVPopoverTemplate = /*#__PURE__*/ Vue.extend({

35 35

},

36 36

[

37 37

h('div', { ref: 'arrow', staticClass: 'arrow' }),

38 -

isUndefinedOrNull($title)

38 +

isUndefinedOrNull($title) || $title === ''

39 39

? h()

40 40

: h('h3', { staticClass: 'popover-header', domProps: titleDomProps }, [$title]),

41 -

isUndefinedOrNull($content)

41 +

isUndefinedOrNull($content) || $content === ''

42 42

? h()

43 43

: h('div', { staticClass: 'popover-body', domProps: contentDomProps }, [$content])

44 44

]

Original file line number Diff line number Diff line change

@@ -23,7 +23,14 @@ import {

23 23

eventOn,

24 24

eventOff

25 25

} from '../../../utils/dom'

26 -

import { isFunction, isNumber, isPlainObject, isString, isUndefined } from '../../../utils/inspect'

26 +

import {

27 +

isFunction,

28 +

isNumber,

29 +

isPlainObject,

30 +

isString,

31 +

isUndefined,

32 +

isUndefinedOrNull

33 +

} from '../../../utils/inspect'

27 34

import { keys } from '../../../utils/object'

28 35

import { warn } from '../../../utils/warn'

29 36

import { BvEvent } from '../../../utils/bv-event.class'

@@ -358,9 +365,13 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

358 365

!target ||

359 366

!contains(document.body, target) ||

360 367

!isVisible(target) ||

361 -

this.dropdownOpen()

368 +

this.dropdownOpen() ||

369 +

((isUndefinedOrNull(this.title) || this.title === '') &&

370 +

(isUndefinedOrNull(this.content) || this.content === ''))

362 371

) {

363 -

// If trigger element isn't in the DOM or is not visible, or is on an open dropdown toggle

372 +

// If trigger element isn't in the DOM or is not visible, or

373 +

// is on an open dropdown toggle, or has no content, then

374 +

// we exit without showing

364 375

return

365 376

}

366 377 Original file line number Diff line number Diff line change

@@ -18,10 +18,11 @@ to appear.

18 18 19 19

## Overview

20 20 21 -

Things to know when using popovers:

21 +

Things to know when using the popover directive:

22 22 23 23

- Popovers rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning.

24 24

- Popovers require BootstrapVue's custom SCSS/CSS for transitions and color variants.

25 +

- If both title and content is not provided (or are an empty string), the popover will not show.

25 26

- Specify container: 'body' (default) to avoid rendering problems in more complex components (like

26 27

input groups, button groups, etc).

27 28

- Triggering popovers on hidden elements will not work.

Original file line number Diff line number Diff line change

@@ -3,7 +3,14 @@ import looseEqual from '../../utils/loose-equal'

3 3

import { concat } from '../../utils/array'

4 4

import { getComponentConfig } from '../../utils/config'

5 5

import { isBrowser } from '../../utils/env'

6 -

import { isFunction, isObject, isString, isUndefined } from '../../utils/inspect'

6 +

import {

7 +

isFunction,

8 +

isObject,

9 +

isNumber,

10 +

isString,

11 +

isUndefined,

12 +

isUndefinedOrNull

13 +

} from '../../utils/inspect'

7 14

import { keys } from '../../utils/object'

8 15

import { BVPopover } from '../../components/popover/helpers/bv-popover'

9 16

@@ -58,7 +65,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to

58 65

}

59 66 60 67

// Process `bindings.value`

61 -

if (isString(bindings.value)) {

68 +

if (isString(bindings.value) || isNumber(bindings.value)) {

62 69

// Value is popover content (html optionally supported)

63 70

config.content = bindings.value

64 71

} else if (isFunction(bindings.value)) {

@@ -80,7 +87,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to

80 87

if (isUndefined(config.title)) {

81 88

// Try attribute

82 89

const data = vnode.data || {}

83 -

config.title = data.attrs && data.attrs.title ? data.attrs.title : undefined

90 +

config.title = data.attrs && !isUndefinedOrNull(data.attrs.title) ? data.attrs.title : undefined

84 91

}

85 92 86 93

// Normalize delay

Original file line number Diff line number Diff line change

@@ -16,10 +16,11 @@ appear.

16 16 17 17

## Overview

18 18 19 -

Things to know when using tooltips:

19 +

Things to know when using the tooltip directive:

20 20 21 21

- Tooltips rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning.

22 22

- Tooltips require BootstrapVue's custom SCSS/CSS for transitions and color variants.

23 +

- If a title is not provided (or is an empty string), the tooltip will not show.

23 24

- Specify container: 'body' (the default) to avoid rendering problems in more complex components

24 25

(like input groups, button groups, etc).

25 26

- Triggering tooltips on hidden elements will not work.

Original file line number Diff line number Diff line change

@@ -3,7 +3,14 @@ import looseEqual from '../../utils/loose-equal'

3 3

import { concat } from '../../utils/array'

4 4

import { getComponentConfig } from '../../utils/config'

5 5

import { isBrowser } from '../../utils/env'

6 -

import { isFunction, isObject, isString, isUndefined } from '../../utils/inspect'

6 +

import {

7 +

isFunction,

8 +

isNumber,

9 +

isObject,

10 +

isString,

11 +

isUndefined,

12 +

isUndefinedOrNull

13 +

} from '../../utils/inspect'

7 14

import { keys } from '../../utils/object'

8 15

import { BVTooltip } from '../../components/tooltip/helpers/bv-tooltip'

9 16

@@ -58,7 +65,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to

58 65

}

59 66 60 67

// Process `bindings.value`

61 -

if (isString(bindings.value)) {

68 +

if (isString(bindings.value) || isNumber(bindings.value)) {

62 69

// Value is tooltip content (HTML optionally supported)

63 70

config.title = bindings.value

64 71

} else if (isFunction(bindings.value)) {

@@ -73,7 +80,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to

73 80

if (isUndefined(config.title)) {

74 81

// Try attribute

75 82

const data = vnode.data || {}

76 -

config.title = data.attrs && data.attrs.title ? data.attrs.title : ''

83 +

config.title = data.attrs && !isUndefinedOrNull(data.attrs.title) ? data.attrs.title : undefined

77 84

}

78 85 79 86

// Normalize delay

Original file line number Diff line number Diff line change

@@ -136,6 +136,59 @@ describe('v-b-tooltip directive', () => {

136 136

wrapper.destroy()

137 137

})

138 138 139 +

it('should nowshow tooltip when title is empty', async () => {

140 +

jest.useFakeTimers()

141 +

const localVue = new CreateLocalVue()

142 + 143 +

const App = localVue.extend({

144 +

directives: {

145 +

bTooltip: VBTooltip

146 +

},

147 +

template: '<button v-b-tooltip.click title="">button</button>'

148 +

})

149 + 150 +

const wrapper = mount(App, {

151 +

localVue: localVue,

152 +

attachToDocument: true

153 +

})

154 + 155 +

expect(wrapper.isVueInstance()).toBe(true)

156 +

await waitNT(wrapper.vm)

157 +

await waitRAF()

158 +

await waitNT(wrapper.vm)

159 +

await waitRAF()

160 +

await waitNT(wrapper.vm)

161 +

await waitRAF()

162 +

jest.runOnlyPendingTimers()

163 +

await waitNT(wrapper.vm)

164 +

await waitRAF()

165 + 166 +

expect(wrapper.is('button')).toBe(true)

167 +

const $button = wrapper.find('button')

168 + 169 +

// Should have instance of popover class on it

170 +

expect($button.element[BV_TOOLTIP]).toBeDefined()

171 +

expect($button.element[BV_TOOLTIP]).toBeInstanceOf(BVTooltip)

172 + 173 +

expect($button.attributes('aria-describedby')).not.toBeDefined()

174 + 175 +

// Trigger click

176 +

$button.trigger('click')

177 +

await waitNT(wrapper.vm)

178 +

await waitRAF()

179 +

await waitNT(wrapper.vm)

180 +

await waitRAF()

181 +

await waitNT(wrapper.vm)

182 +

await waitRAF()

183 +

jest.runOnlyPendingTimers()

184 +

await waitNT(wrapper.vm)

185 +

await waitRAF()

186 + 187 +

expect($button.attributes('aria-describedby')).not.toBeDefined()

188 + 189 +

wrapper.destroy()

190 +

})

191 + 139 192

it('variant and customClass should work', async () => {

140 193

jest.useFakeTimers()

141 194

const localVue = new CreateLocalVue()

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4