+196
-288
lines changedFilter options
+196
-288
lines changed Original file line number Diff line number Diff line change
@@ -54,11 +54,14 @@ export const BTab = /*#__PURE__*/ Vue.extend({
54
54
props,
55
55
data() {
56
56
return {
57
-
localActive: this[MODEL_PROP_NAME_ACTIVE] && !this.disabled,
58
-
show: false
57
+
localActive: this[MODEL_PROP_NAME_ACTIVE] && !this.disabled
59
58
}
60
59
},
61
60
computed: {
61
+
// For parent sniffing of child
62
+
_isTab() {
63
+
return true
64
+
},
62
65
tabClasses() {
63
66
const { localActive: active, disabled } = this
64
67
@@ -80,17 +83,9 @@ export const BTab = /*#__PURE__*/ Vue.extend({
80
83
},
81
84
computedLazy() {
82
85
return this.bvTabs.lazy || this.lazy
83
-
},
84
-
// For parent sniffing of child
85
-
_isTab() {
86
-
return true
87
86
}
88
87
},
89
88
watch: {
90
-
localActive(newValue) {
91
-
// Make `active` prop work with `.sync` modifier
92
-
this.$emit(MODEL_EVENT_NAME_ACTIVE, newValue)
93
-
},
94
89
[MODEL_PROP_NAME_ACTIVE](newValue, oldValue) {
95
90
if (newValue !== oldValue) {
96
91
if (newValue) {
@@ -114,13 +109,15 @@ export const BTab = /*#__PURE__*/ Vue.extend({
114
109
firstTab()
115
110
}
116
111
}
112
+
},
113
+
localActive(newValue) {
114
+
// Make `active` prop work with `.sync` modifier
115
+
this.$emit(MODEL_EVENT_NAME_ACTIVE, newValue)
117
116
}
118
117
},
119
118
mounted() {
120
-
// Inform b-tabs of our presence
119
+
// Inform `<b-tabs>` of our presence
121
120
this.registerTab()
122
-
// Initially show on mount if active and not disabled
123
-
this.show = this.localActive
124
121
},
125
122
updated() {
126
123
// Force the tab button content to update (since slots are not reactive)
@@ -130,8 +127,8 @@ export const BTab = /*#__PURE__*/ Vue.extend({
130
127
updateButton(this)
131
128
}
132
129
},
133
-
destroyed() {
134
-
// inform b-tabs of our departure
130
+
beforeDestroy() {
131
+
// Inform `<b-tabs>` of our departure
135
132
this.unregisterTab()
136
133
},
137
134
methods: {
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1
1
import { mount } from '@vue/test-utils'
2
-
import { waitNT, waitRAF } from '../../../tests/utils'
2
+
import { waitNT } from '../../../tests/utils'
3
3
import { BTab } from './tab'
4
4
5
5
describe('tab', () => {
@@ -31,7 +31,6 @@ describe('tab', () => {
31
31
32
32
expect(wrapper.vm._isTab).toBe(true)
33
33
expect(wrapper.vm.localActive).toBe(false)
34
-
expect(wrapper.vm.show).toBe(false)
35
34
36
35
wrapper.destroy()
37
36
})
@@ -86,15 +85,13 @@ describe('tab', () => {
86
85
87
86
await wrapper.setData({ localActive: true })
88
87
await waitNT(wrapper.vm)
89
-
await waitRAF()
90
88
91
89
expect(wrapper.classes()).toContain('active')
92
90
expect(wrapper.classes()).not.toContain('disabled')
93
91
expect(wrapper.classes()).not.toContain('card-body')
94
92
95
93
await wrapper.setData({ localActive: false })
96
94
await waitNT(wrapper.vm)
97
-
await waitRAF()
98
95
99
96
expect(wrapper.classes()).not.toContain('active')
100
97
expect(wrapper.classes()).not.toContain('disabled')
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