Skip to content

Commit 654f0b6

Browse files
committed
refactor: small refactors:
- CToast: change reverse prop default value to true, - Add CButtonClose to CModal, - update snapshots
1 parent a80d619 commit 654f0b6

File tree

7 files changed

+20
-23
lines changed

7 files changed

+20
-23
lines changed

src/components/modal/CModal.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@
1414
<h5 class="modal-title">
1515
{{title}}
1616
</h5>
17-
<button
18-
type="button"
19-
class="close"
20-
aria-label="Close"
21-
@click="hide($event)"
22-
>
23-
<span>&times;</span>
24-
</button>
17+
<CButtonClose @click="hide($event)"/>
2518
</slot>
2619
</header>
2720
</slot>
@@ -62,8 +55,13 @@
6255
</template>
6356

6457
<script>
58+
import CButtonClose from '../button/CButtonClose'
59+
6560
export default {
6661
name: 'CModal',
62+
components: {
63+
CButtonClose
64+
},
6765
props: {
6866
show: Boolean,
6967
centered: Boolean,

src/components/modal/tests/CModal.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ describe(ComponentName, () => {
3636
it('hides on backdrop click when closeOnBackdrop prop is true', () => {
3737
const click = () => customWrapper.find('.modal').trigger('click')
3838
click()
39-
expect(customWrapper.emitted().hide).not.toBeTruthy()
39+
expect(customWrapper.emitted()['update:show']).not.toBeTruthy()
4040

4141
customWrapper.setProps({ closeOnBackdrop: true })
4242
click()
43-
expect(customWrapper.emitted().hide).toBeTruthy()
43+
expect(customWrapper.emitted()['update:show']).toBeTruthy()
4444
})
4545
it('doesnt animate when fade prop is set to false', () => {
4646
defaultWrapper.setProps({ fade: false })

src/components/modal/tests/__snapshots__/CModal.spec.js.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ exports[`CModal renders correctly 1`] = `
3030
class="close"
3131
type="button"
3232
>
33-
<span>
34-
×
35-
</span>
33+
×
3634
</button>
3735
</header>
3836
@@ -99,9 +97,7 @@ exports[`CModal renders correctly 2`] = `
9997
class="close"
10098
type="button"
10199
>
102-
<span>
103-
×
104-
</span>
100+
×
105101
</button>
106102
</header>
107103

src/components/pagination/tests/__snapshots__/CPagination.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`CPagination renders correctly 1`] = `
55
aria-label="pagination"
66
>
77
<ul
8-
class="pagination pagination-md justify-content-start"
8+
class="pagination justify-content-start"
99
>
1010
<li
1111
class="page-item disabled"

src/components/toast/CToast.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ import CButtonClose from '../button/CButtonClose'
3636
export default {
3737
name: 'CToast',
3838
mixins: [ toastMixin ],
39+
components: {
40+
CButtonClose
41+
},
3942
props: {
4043
show: Boolean,
4144
headerHtml: String,
4245
bodyHtml: String
4346
},
44-
components: {
45-
CButtonClose
46-
},
4747
inject: {
4848
toaster: {
4949
default: false

src/components/toast/CToaster.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export default {
2121
},
2222
mixins: [ toastMixin ],
2323
props: {
24-
reverse: Boolean
24+
reverse: {
25+
type: Boolean,
26+
default: true
27+
}
2528
},
2629
computed: {
2730
toasterClasses () {

src/components/toast/tests/__snapshots__/CToaster.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
exports[`CToaster renders correctly 1`] = `
44
<div
5-
class="toaster"
5+
class="toaster d-flex flex-column-reverse"
66
style="z-index: 1100; min-width: 350px; position: fixed; top: 0px; right: 0px;"
77
/>
88
`;
99

1010
exports[`CToaster renders correctly custom wrapper 1`] = `
1111
<div
12-
class="toaster"
12+
class="toaster d-flex flex-column-reverse"
1313
style="z-index: 1100; min-width: 350px; position: fixed; top: 0px; left: 0px;"
1414
>
1515
<div

0 commit comments

Comments
 (0)