Skip to content

Commit 9ccfe4c

Browse files
tmorehousejacobmllr95
authored andcommitted
fix(b-media): fix vertical align class when top or bottom selected (fixes #4052) (#4055)
* fix(b-media): fix vertical align class when top or bottom selected (fixes #4052) * Update media-aside.js * Update media.spec.js * Update media-aside.spec.js
1 parent c97e06f commit 9ccfe4c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/components/media/media-aside.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ export const BMediaAside = /*#__PURE__*/ Vue.extend({
1818
functional: true,
1919
props,
2020
render(h, { props, data, children }) {
21+
const align =
22+
props.verticalAlign === 'top'
23+
? 'start'
24+
: props.verticalAlign === 'bottom'
25+
? 'end'
26+
: props.verticalAlign
2127
return h(
2228
props.tag,
2329
mergeData(data, {
2430
staticClass: 'd-flex',
2531
class: {
26-
[`align-self-${props.verticalAlign}`]: props.verticalAlign
32+
[`align-self-${align}`]: align
2733
}
2834
}),
2935
children

src/components/media/media-aside.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('media-aside', () => {
77

88
expect(wrapper.is('div')).toBe(true)
99
expect(wrapper.classes()).toContain('d-flex')
10-
expect(wrapper.classes()).toContain('align-self-top')
10+
expect(wrapper.classes()).toContain('align-self-start')
1111
expect(wrapper.text()).toEqual('')
1212
})
1313

@@ -20,7 +20,7 @@ describe('media-aside', () => {
2020

2121
expect(wrapper.is('span')).toBe(true)
2222
expect(wrapper.classes()).toContain('d-flex')
23-
expect(wrapper.classes()).toContain('align-self-top')
23+
expect(wrapper.classes()).toContain('align-self-start')
2424
expect(wrapper.classes().length).toBe(2)
2525
expect(wrapper.text()).toEqual('')
2626
})
@@ -34,7 +34,7 @@ describe('media-aside', () => {
3434

3535
expect(wrapper.is('div')).toBe(true)
3636
expect(wrapper.classes()).toContain('d-flex')
37-
expect(wrapper.classes()).toContain('align-self-bottom')
37+
expect(wrapper.classes()).toContain('align-self-end')
3838
expect(wrapper.classes().length).toBe(2)
3939
})
4040

@@ -47,7 +47,7 @@ describe('media-aside', () => {
4747

4848
expect(wrapper.is('div')).toBe(true)
4949
expect(wrapper.classes()).toContain('d-flex')
50-
expect(wrapper.classes()).toContain('align-self-top')
50+
expect(wrapper.classes()).toContain('align-self-start')
5151
expect(wrapper.classes().length).toBe(2)
5252
expect(wrapper.findAll('b').length).toBe(1)
5353
expect(wrapper.find('b').text()).toBe('foobar')

src/components/media/media.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('media', () => {
139139
// Should have only two child elements
140140
expect(wrapper.findAll('.media > *').length).toBe(2)
141141
// Should have media aside with self align bottom
142-
expect(wrapper.find('.d-flex').classes()).toContain('align-self-bottom')
142+
expect(wrapper.find('.d-flex').classes()).toContain('align-self-end')
143143
// Should have content in aside
144144
expect(wrapper.find('.d-flex').text()).toEqual('foobar')
145145
})

0 commit comments

Comments
 (0)