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/4b5d9162b8a6531c0ada66f646498b0ba40a0e9b below:

don't display warning messages when in production (closes #5598)… · bootstrap-vue/bootstrap-vue@4b5d916 · GitHub

File tree Expand file treeCollapse file tree 5 files changed

+86

-16

lines changed

Filter options

Expand file treeCollapse file tree 5 files changed

+86

-16

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

@@ -168,12 +168,13 @@ the config object to the Nuxt.js plugin module.

168 168 169 169

## Disabling BootstrapVue console warnings

170 170 171 -

BootstrapVue will warn (via `console.warn`) when you try and use a deprecated prop, or pass an

171 +

BootstrapVue will warn (via `console.warn()`) when you try and use a deprecated prop, or pass an

172 172

invalid value to certain props. These warnings are provided to help you ensure that your application

173 173

is using the correct props and values.

174 174 175 -

In some cases, you may want to disable these warnings (not recommended). You can do so by setting

176 -

the following process environment variable:

175 +

BootstrapVue automatically disables warnings in production mode (`NODE_ENV=production`). If you want

176 +

to disable the warnings in other scenarios (not recommended), you can do so by setting the following

177 +

process environment variable:

177 178 178 179

<!-- eslint-disable no-unused-vars -->

179 180 Original file line number Diff line number Diff line change

@@ -119,8 +119,6 @@ export const BPagination = /*#__PURE__*/ Vue.extend({

119 119

return

120 120

}

121 121 122 -

console.log(evt, pageNumber)

123 - 124 122

// Update the `v-model`

125 123

this.currentPage = pageNumber

126 124

// Emit event triggered by user interaction

Original file line number Diff line number Diff line change

@@ -248,7 +248,12 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

248 248

this.listen()

249 249

} else {

250 250

/* istanbul ignore next */

251 -

warn('Unable to find target element in document.', this.templateType)

251 +

warn(

252 +

isString(this.target)

253 +

? `Unable to find target element by ID "#${this.target}" in document.`

254 +

: 'The provided target is no valid HTML element.',

255 +

this.templateType

256 +

)

252 257

}

253 258

})

254 259

},

@@ -513,13 +518,14 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

513 518

},

514 519

// --- Utility methods ---

515 520

getTarget() {

516 -

// Handle case where target may be a component ref

517 -

let target = this.target ? this.target.$el || this.target : null

518 -

// If an ID

519 -

target = isString(target) ? getById(target.replace(/^#/, '')) : target

520 -

// If a function

521 -

target = isFunction(target) ? target() : target

522 -

// If an element ref

521 +

let { target } = this

522 +

if (isString(target)) {

523 +

target = getById(target.replace(/^#/, ''))

524 +

} else if (isFunction(target)) {

525 +

target = target()

526 +

} else if (target) {

527 +

target = target.$el || target

528 +

}

523 529

return isElement(target) ? target : null

524 530

},

525 531

getPlacementTarget() {

Original file line number Diff line number Diff line change

@@ -7,6 +7,7 @@ const MODAL_CLOSE_EVENT = 'bv::modal::hidden'

7 7

// Our test application

8 8

const App = {

9 9

props: [

10 +

'target',

10 11

'triggers',

11 12

'show',

12 13

'noninteractive',

@@ -22,7 +23,7 @@ const App = {

22 23

],

23 24

render(h) {

24 25

const tipProps = {

25 -

target: 'foo',

26 +

target: this.target || 'foo',

26 27

triggers: this.triggers,

27 28

show: this.show,

28 29

noninteractive: this.noninteractive || false,

@@ -47,7 +48,8 @@ const App = {

47 48

type: 'button',

48 49

disabled: this.btnDisabled || null,

49 50

title: this.titleAttr || null

50 -

}

51 +

},

52 +

ref: 'target'

51 53

},

52 54

'text'

53 55

),

@@ -283,6 +285,68 @@ describe('b-tooltip', () => {

283 285

wrapper.destroy()

284 286

})

285 287 288 +

it('providing the trigger element by function works', async () => {

289 +

jest.useFakeTimers()

290 +

const container = createContainer()

291 +

const wrapper = mount(App, {

292 +

attachTo: container,

293 +

propsData: {

294 +

target: () => wrapper.vm.$refs.target,

295 +

triggers: 'click',

296 +

show: false

297 +

},

298 +

slots: {

299 +

default: 'title'

300 +

}

301 +

})

302 + 303 +

expect(wrapper.vm).toBeDefined()

304 +

await waitNT(wrapper.vm)

305 +

await waitRAF()

306 +

await waitNT(wrapper.vm)

307 +

await waitRAF()

308 +

jest.runOnlyPendingTimers()

309 + 310 +

expect(wrapper.element.tagName).toBe('ARTICLE')

311 +

expect(wrapper.attributes('id')).toBeDefined()

312 +

expect(wrapper.attributes('id')).toEqual('wrapper')

313 + 314 +

// The trigger button

315 +

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

316 +

expect($button.exists()).toBe(true)

317 +

expect($button.attributes('id')).toBeDefined()

318 +

expect($button.attributes('id')).toEqual('foo')

319 +

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

320 + 321 +

// <b-tooltip> wrapper

322 +

const $tipHolder = wrapper.findComponent(BTooltip)

323 +

expect($tipHolder.exists()).toBe(true)

324 + 325 +

// Activate tooltip by trigger

326 +

await $button.trigger('click')

327 +

await waitRAF()

328 +

await waitRAF()

329 +

jest.runOnlyPendingTimers()

330 +

await waitNT(wrapper.vm)

331 +

await waitRAF()

332 + 333 +

expect($button.attributes('id')).toBeDefined()

334 +

expect($button.attributes('id')).toEqual('foo')

335 +

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

336 +

// ID of the tooltip that will be in the body

337 +

const adb = $button.attributes('aria-describedby')

338 + 339 +

// Find the tooltip element in the document

340 +

const tip = document.getElementById(adb)

341 +

expect(tip).not.toBe(null)

342 +

expect(tip).toBeInstanceOf(HTMLElement)

343 +

expect(tip.tagName).toEqual('DIV')

344 +

expect(tip.classList.contains('tooltip')).toBe(true)

345 +

expect(tip.classList.contains('b-tooltip')).toBe(true)

346 + 347 +

wrapper.destroy()

348 +

})

349 + 286 350

it('activating trigger element (click) opens tooltip', async () => {

287 351

jest.useFakeTimers()

288 352

const wrapper = mount(App, {

Original file line number Diff line number Diff line change

@@ -72,4 +72,5 @@ export const getEnv = (key, fallback = null) => {

72 72

return env[key] || fallback

73 73

}

74 74 75 -

export const getNoWarn = () => getEnv('BOOTSTRAP_VUE_NO_WARN')

75 +

export const getNoWarn = () =>

76 +

getEnv('BOOTSTRAP_VUE_NO_WARN') || getEnv('NODE_ENV') === 'production'

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