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/90c299c below:

remove BvModalEvent deprecations (#3864) · bootstrap-vue/bootstrap-vue@90c299c · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+6

-83

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+6

-83

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

@@ -1,5 +1,4 @@

1 1

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

2 -

import warn from '../../../utils/warn'

3 2

import { defineProperties, readonlyDescriptor } from '../../../utils/object'

4 3 5 4

class BvModalEvent extends BvEvent {

@@ -11,18 +10,6 @@ class BvModalEvent extends BvEvent {

11 10

})

12 11

}

13 12 14 -

get modalId() /* istanbul ignore next */ {

15 -

// Backwards compatability <= 2.0.0-rc.19

16 -

warn('b-modal: evt.modalId is deprecated. Please use evt.componentId.')

17 -

return this.componentId

18 -

}

19 - 20 -

cancel() /* istanbul ignore next */ {

21 -

// Backwards compatibility for BootstrapVue 1.x

22 -

warn('b-modal: evt.cancel() is deprecated. Please use evt.preventDefault().')

23 -

this.preventDefault()

24 -

}

25 - 26 13

static get Defaults() {

27 14

return {

28 15

...super.Defaults,

Original file line number Diff line number Diff line change

@@ -68,15 +68,6 @@ describe('modal > BvModalEvent', () => {

68 68

}

69 69

expect(failed).toBe(true)

70 70

expect(evt.trigger).toBe('ok')

71 - 72 -

failed = false

73 -

try {

74 -

evt.modalId = 'fail'

75 -

} catch (e) {

76 -

failed = true

77 -

}

78 -

expect(failed).toBe(true)

79 -

expect(evt.componentId).toBe('foo')

80 71

})

81 72 82 73

it('supports custom properties', async () => {

@@ -88,48 +79,4 @@ describe('modal > BvModalEvent', () => {

88 79

expect(evt.cancelable).toBe(true)

89 80

expect(evt.custom).toBe(123)

90 81

})

91 - 92 -

describe('Deprecated features', () => {

93 -

it('supports cancelable events via deprecated evt.cancel()', async () => {

94 -

// Mock `console.warn()` to prevent a console warning and

95 -

// check wether a warning about the `evt.cancel()` call

96 -

// was made

97 -

const warn = console.warn

98 -

console.warn = jest.fn()

99 - 100 -

const evt = new BvModalEvent('foobar', {

101 -

cancelable: true

102 -

})

103 - 104 -

expect(evt).toBeInstanceOf(BvModalEvent)

105 -

expect(evt.type).toBe('foobar')

106 -

expect(evt.cancelable).toBe(true)

107 -

expect(evt.defaultPrevented).toBe(false)

108 -

evt.cancel()

109 -

expect(evt.defaultPrevented).toBe(true)

110 - 111 -

expect(console.warn).toHaveBeenCalled()

112 -

console.warn = warn

113 -

})

114 - 115 -

it('supports deprecated evt.modalId', async () => {

116 -

// Mock `console.warn()` to prevent a console warning and

117 -

// check wether a warning about the `evt.cancel()` call

118 -

// was made

119 -

const warn = console.warn

120 -

console.warn = jest.fn()

121 - 122 -

const evt = new BvModalEvent('foobar', {

123 -

componentId: 'foo'

124 -

})

125 - 126 -

expect(evt).toBeInstanceOf(BvModalEvent)

127 -

expect(evt.type).toBe('foobar')

128 -

expect(evt.componentId).toBe('foo')

129 -

expect(evt.modalId).toBe('foo')

130 - 131 -

expect(console.warn).toHaveBeenCalled()

132 -

console.warn = warn

133 -

})

134 -

})

135 82

})

Original file line number Diff line number Diff line change

@@ -1,34 +1,25 @@

1 -

//

2 -

// Modals

3 -

//

1 +

// --- Modals ---

4 2

import Vue, { VNode } from 'vue'

5 3

import { BvPlugin, BvComponent, BvEvent } from '../../'

6 4 7 -

// Modal Plugin

5 +

// Modal plugin

8 6

export declare const ModalPlugin: BvPlugin

9 7 10 -

// Component: b-modal

8 +

// Component: <b-modal>

11 9

export declare class BModal extends BvComponent {

12 10

// Public methods

13 11

show: () => void

14 12

hide: (trigger?: string) => void

15 13

}

16 14 17 -

//

18 -

// Types

19 -

//

15 +

// --- Types ---

20 16

export type BvMsgBoxData = boolean | null | BvModalEvent | any

21 17 22 -

//

23 -

// Interfaces

24 -

//

18 +

// --- Interfaces ---

25 19

export interface BvModalEvent extends BvEvent {

26 20

readonly trigger: string | null

27 21

// Future

28 22

// details: any | null

29 -

// Deprecated

30 -

readonly modalId: string | null

31 -

cancel: () => void

32 23

}

33 24 34 25

export interface BvMsgBoxOptions {

@@ -95,9 +86,7 @@ export interface BvModal {

95 86

hide: (id: string) => void

96 87

}

97 88 98 -

//

99 -

// Vue Prototype Injections

100 -

//

89 +

// --- Vue prototype injections ---

101 90

declare module 'vue/types/vue' {

102 91

interface Vue {

103 92

// Modal injection

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