Skip to content

Commit 365ac0a

Browse files
committed
refactor: rename negative props in components
1 parent 0f45839 commit 365ac0a

File tree

24 files changed

+137
-108
lines changed

24 files changed

+137
-108
lines changed

src/components/Dropdown/CDropdown.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export default {
4949
addMenuClasses: [String, Array, Object],
5050
addTogglerClasses: [String, Array, Object],
5151
inNav: Boolean,
52-
noCaret: Boolean,
52+
caret: {
53+
type: Boolean,
54+
default: true
55+
},
5356
color: String,
5457
size: {
5558
type: String,
@@ -69,7 +72,10 @@ export default {
6972
},
7073
default: 'bottom-start'
7174
},
72-
noFlip: Boolean,
75+
flip: {
76+
type: Boolean,
77+
default: true
78+
},
7379
popperConfig: Object
7480
},
7581
data () {
@@ -131,7 +137,7 @@ export default {
131137
placement: this.placement,
132138
modifiers: {
133139
offset: { offset: this.offset || 0 },
134-
flip: { enabled: !this.noFlip }
140+
flip: { enabled: this.flip }
135141
}
136142
}
137143
},
@@ -170,7 +176,7 @@ export default {
170176
this.addTogglerClasses,
171177
this.inNav ? 'nav-link' : 'btn',
172178
{
173-
'dropdown-toggle': !this.noCaret && !this.split,
179+
'dropdown-toggle': this.caret && !this.split,
174180
[`btn-${this.size}`]: this.size && !this.inNav,
175181
'disabled' : this.disabled,
176182
[`${ this.inNav ? 'bg' : 'btn'}-${ this.color }`]: this.color

src/components/Dropdown/tests/CDropdown.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ const customWrapper = mount(Component, {
3030
addMenuClasses: 'additional-menu-class',
3131
addTogglerClasses: 'additional-toggler-class',
3232
inNav: false,
33-
noCaret: true,
33+
caret: false,
3434
color: 'success',
3535
size: 'lg',
3636
split: true,
3737
offset: 20,
3838
placement: 'right-end',
39-
noFlip: true,
39+
flip: false,
4040
},
4141
slots: {
4242
default: 'CDropdown subcomponents'
@@ -49,11 +49,11 @@ const navWrapper = mount(Component, {
4949
addMenuClasses: 'additional-menu-class',
5050
addTogglerClasses: 'additional-toggler-class',
5151
inNav: true,
52-
noCaret: true,
52+
caret: false,
5353
color: 'success',
5454
offset: 20,
5555
placement: 'left',
56-
noFlip: true
56+
flip: false
5757
},
5858
slots: {
5959
default: 'CDropdown subcomponents'

src/components/Grid/CRow.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { mergeData } from 'vue-functional-data-merge'
33
44
const props = {
55
tag: String,
6-
noGutters: Boolean,
6+
gutters: {
7+
type: Boolean,
8+
default: true
9+
},
710
alignVertical: {
811
type: String,
912
validator: str => ['', 'start', 'end', 'center','baseline', 'stretch'].includes(str)
@@ -24,7 +27,7 @@ export default {
2427
mergeData(data, {
2528
staticClass: 'row',
2629
class: {
27-
'no-gutters': props.noGutters,
30+
'no-gutters': !props.gutters,
2831
[`align-items-${props.alignVertical}`]: props.alignVertical,
2932
[`justify-content-${props.alignHorizontal}`]: props.alignHorizontal,
3033
}

src/components/Grid/tests/CRow.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const defaultWrapper = mount(Component)
66
const customWrapper = mount(Component, {
77
propsData: {
88
tag: 'header',
9-
noGutters: true,
9+
gutters: false,
1010
alignVertical: 'center',
1111
alignHorizontal: 'start'
1212
},

src/components/Image/CImgLazy.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export default {
99
type: Number,
1010
default: 500
1111
},
12-
noFade: Boolean,
12+
fade: {
13+
type: Boolean,
14+
default: true
15+
},
1316
fadeOffset: {
1417
type: Number,
1518
default: -100
@@ -34,7 +37,7 @@ export default {
3437
},
3538
computed: {
3639
animationClasses () {
37-
return { 'opacity-0' : !this.noFade && !this.animated }
40+
return { 'opacity-0' : this.fade && !this.animated }
3841
},
3942
observerArgs () {
4043
if (this.active) {
@@ -53,7 +56,7 @@ export default {
5356
entries.forEach(entry => {
5457
if (entry.intersectionRatio > 0) {
5558
this.active = true
56-
if (!this.noFade) {
59+
if (this.fade) {
5760
this.$nextTick(() => {
5861
const animateInstantly = this.loadOffset <= this.fadeOffset
5962
animateInstantly ? this.queueAnimation() : this.defineObserver()

src/components/Image/tests/CImageLazy.spec.js renamed to src/components/Image/tests/CImgLazy.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ describe(ComponentName, () => {
5555
it('queueing animation observer on loading watcher properly', () => {
5656
const spy = jest.spyOn(customWrapper.vm, 'queueAnimation')
5757

58-
customWrapper.setProps({noFade: true})
58+
customWrapper.setProps({fade: false})
5959
customWrapper.vm.watchForLoading(triggeringEntry)
6060
expect(spy).not.toBeCalled()
6161

62-
customWrapper.setProps({noFade: false, fadeOffset: 600})
62+
customWrapper.setProps({fade: true, fadeOffset: 600})
6363
customWrapper.vm.watchForLoading(triggeringEntry)
6464
customWrapper.vm.$nextTick(() => expect(spy).toBeCalled())
6565
})

src/components/Modal/CModal.vue

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
>
99
<div :class="dialogClasses" role="document">
1010
<div :class="contentClasses">
11-
<slot v-if="!noHeader" name="header-wrapper"
12-
>
13-
<header class="modal-header">
11+
<slot name="header-wrapper">
12+
<header class="modal-header">
1413
<slot name="header">
1514
<h5 class="modal-title">
1615
{{title}}
@@ -26,12 +25,12 @@
2625
</slot>
2726
</header>
2827
</slot>
29-
<slot v-if="!noBody" name="body-wrapper">
28+
<slot name="body-wrapper">
3029
<div class="modal-body">
3130
<slot></slot>
3231
</div>
3332
</slot>
34-
<slot v-if="!noFooter" name="footer-wrapper">
33+
<slot name="footer-wrapper">
3534
<footer class="modal-footer">
3635
<slot name="footer">
3736
<button
@@ -55,7 +54,7 @@
5554
</div>
5655
</div>
5756
<div
58-
v-if="!noBackdrop && (visible || isTransitioning)"
57+
v-if="backdrop && (visible || isTransitioning)"
5958
:class="backdropClasses"
6059
>
6160
</div>
@@ -75,12 +74,18 @@ export default {
7574
},
7675
color: String,
7776
borderColor: String,
78-
noFade: Boolean,
79-
noBackdrop: Boolean,
80-
noCloseOnBackdrop: Boolean,
81-
noHeader: Boolean,
82-
noBody: Boolean,
83-
noFooter: Boolean,
77+
fade: {
78+
type: Boolean,
79+
default: true
80+
},
81+
backdrop: {
82+
type: Boolean,
83+
default: true
84+
},
85+
closeOnBackdrop: {
86+
type: Boolean,
87+
default: true
88+
},
8489
addModalClasses: [String, Array, Object],
8590
addDialogClasses: [String, Array, Object],
8691
addContentClasses: [String, Array, Object]
@@ -96,17 +101,16 @@ export default {
96101
backdropClasses () {
97102
return {
98103
'modal-backdrop': true,
99-
'fade': !this.noFade,
100-
'show': this.visible || this.noFade
104+
'fade': this.fade,
105+
'show': this.visible || !this.fade
101106
}
102107
},
103108
modalClasses () {
104109
return [
105110
'modal overflow-auto',
106111
this.addModalClasses,
107112
{
108-
// 'close-modal': !this.noCloseOnBackdrop,
109-
'fade': !this.noFade,
113+
'fade': this.fade,
110114
'show': this.visible,
111115
'd-block': this.visible || this.isTransitioning,
112116
[`modal-${this.color}`]: Boolean(this.color)
@@ -143,7 +147,7 @@ export default {
143147
},
144148
methods: {
145149
modalClick (e) {
146-
if (e.target === this.$el.firstElementChild && !this.noCloseOnBackdrop) {
150+
if (e.target === this.$el.firstElementChild && this.closeOnBackdrop) {
147151
this.hide(e)
148152
}
149153
},
@@ -153,7 +157,7 @@ export default {
153157
},
154158
toggle (newVal) {
155159
setTimeout(() => { this.visible = newVal }, 0)
156-
if (!this.noFade) {
160+
if (this.fade) {
157161
this.isTransitioning = true
158162
clearTimeout(this.timeout)
159163
this.timeout = setTimeout(() => {

0 commit comments

Comments
 (0)