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/7379c6dd0bac76307720645080741b3b0ed7ed99 below:

add `content` prop (#4574) · bootstrap-vue/bootstrap-vue@7379c6d · GitHub

File tree Expand file treeCollapse file tree 6 files changed

+40

-8

lines changed

Filter options

Expand file treeCollapse file tree 6 files changed

+40

-8

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

@@ -7,6 +7,10 @@ import { hasNormalizedSlot, normalizeSlot } from '../../utils/normalize-slot'

7 7

const NAME = 'BButtonClose'

8 8 9 9

const props = {

10 +

content: {

11 +

type: String,

12 +

default: () => getComponentConfig(NAME, 'content')

13 +

},

10 14

disabled: {

11 15

type: Boolean,

12 16

default: false

@@ -53,7 +57,7 @@ export const BButtonClose = /*#__PURE__*/ Vue.extend({

53 57

}

54 58

// Careful not to override the default slot with innerHTML

55 59

if (!hasNormalizedSlot('default', $scopedSlots, $slots)) {

56 -

componentData.domProps = { innerHTML: '×' }

60 +

componentData.domProps = { innerHTML: props.content }

57 61

}

58 62

return h(

59 63

'button',

Original file line number Diff line number Diff line change

@@ -7,23 +7,23 @@ describe('button-close', () => {

7 7

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

8 8

})

9 9 10 -

it('has class close', async () => {

10 +

it('has class "close"', async () => {

11 11

const wrapper = mount(BButtonClose)

12 12

expect(wrapper.classes()).toContain('close')

13 13

expect(wrapper.classes().length).toBe(1)

14 14

})

15 15 16 -

it('has attribute type=button', async () => {

16 +

it('has attribute type="button"', async () => {

17 17

const wrapper = mount(BButtonClose)

18 18

expect(wrapper.attributes('type')).toBe('button')

19 19

})

20 20 21 -

it('does not have attribute disabled by default', async () => {

21 +

it('does not have attribute "disabled" by default', async () => {

22 22

const wrapper = mount(BButtonClose)

23 23

expect(wrapper.attributes('disabled')).not.toBeDefined()

24 24

})

25 25 26 -

it('has attribute disabled when prop disabled is set', async () => {

26 +

it('has attribute "disabled" when prop "disabled" is set', async () => {

27 27

const wrapper = mount(BButtonClose, {

28 28

context: {

29 29

props: { disabled: true }

@@ -32,12 +32,12 @@ describe('button-close', () => {

32 32

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

33 33

})

34 34 35 -

it('has attribute aria-label=Close by default', async () => {

35 +

it('has attribute aria-label="Close" by default', async () => {

36 36

const wrapper = mount(BButtonClose)

37 37

expect(wrapper.attributes('aria-label')).toBe('Close')

38 38

})

39 39 40 -

it('has custom attribute aria-label=Close when prop aria-label set', async () => {

40 +

it('has custom attribute "aria-label" when prop "aria-label" set', async () => {

41 41

const wrapper = mount(BButtonClose, {

42 42

context: {

43 43

props: { ariaLabel: 'foobar' }

@@ -46,7 +46,7 @@ describe('button-close', () => {

46 46

expect(wrapper.attributes('aria-label')).toBe('foobar')

47 47

})

48 48 49 -

it('has variant class when variant prop set', async () => {

49 +

it('has text variant class when "variant" prop set', async () => {

50 50

const wrapper = mount(BButtonClose, {

51 51

context: {

52 52

props: { textVariant: 'primary' }

@@ -63,6 +63,15 @@ describe('button-close', () => {

63 63

expect(wrapper.text()).toContain('×')

64 64

})

65 65 66 +

it('should have custom content from "content" prop', async () => {

67 +

const wrapper = mount(BButtonClose, {

68 +

context: {

69 +

props: { content: 'Close' }

70 +

}

71 +

})

72 +

expect(wrapper.text()).toContain('Close')

73 +

})

74 + 66 75

it('should have custom content from default slot', async () => {

67 76

const wrapper = mount(BButtonClose, {

68 77

slots: {

Original file line number Diff line number Diff line change

@@ -51,6 +51,13 @@

51 51

"aliases": [

52 52

"BBtnClose"

53 53

],

54 +

"props": [

55 +

{

56 +

"prop": "content",

57 +

"version": "2.3.0",

58 +

"description": "The content of the close button"

59 +

}

60 +

],

54 61

"events": [

55 62

{

56 63

"event": "click",

Original file line number Diff line number Diff line change

@@ -231,6 +231,10 @@ export const props = {

231 231

type: [HTMLElement, String, Object],

232 232

default: null

233 233

},

234 +

headerCloseContent: {

235 +

type: String,

236 +

default: () => getComponentConfig(NAME, 'headerCloseContent')

237 +

},

234 238

headerCloseLabel: {

235 239

type: String,

236 240

default: () => getComponentConfig(NAME, 'headerCloseLabel')

@@ -827,6 +831,7 @@ export const BModal = /*#__PURE__*/ Vue.extend({

827 831

{

828 832

ref: 'close-button',

829 833

props: {

834 +

content: this.headerCloseContent,

830 835

disabled: this.isTransitioning,

831 836

ariaLabel: this.headerCloseLabel,

832 837

textVariant: this.headerCloseVariant || this.headerTextVariant

Original file line number Diff line number Diff line change

@@ -129,6 +129,11 @@

129 129

"prop": "cancelDisabled",

130 130

"description": "Places the default footer Cancel button in the disabled state"

131 131

},

132 +

{

133 +

"prop": "headerCloseContent",

134 +

"version": "2.3.0",

135 +

"description": "Content of the header close button"

136 +

},

132 137

{

133 138

"prop": "headerCloseLabel",

134 139

"description": "Value of the 'aria-label' on the header close button"

Original file line number Diff line number Diff line change

@@ -59,6 +59,7 @@ export default deepFreeze({

59 59

variant: 'secondary'

60 60

},

61 61

BButtonClose: {

62 +

content: '×',

62 63

// `textVariant` is `null` to inherit the current text color

63 64

textVariant: null,

64 65

ariaLabel: 'Close'

@@ -134,6 +135,7 @@ export default deepFreeze({

134 135

cancelVariant: 'secondary',

135 136

okTitle: 'OK',

136 137

okVariant: 'primary',

138 +

headerCloseContent: '×',

137 139

headerCloseLabel: 'Close'

138 140

},

139 141

BNavbar: {

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