@gitlab/ui 114.1.0 → 114.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/base/breadcrumb/breadcrumb.js +4 -16
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +7 -26
- package/src/components/base/breadcrumb/breadcrumb.scss +18 -2
- package/src/components/base/breadcrumb/breadcrumb.vue +4 -17
- package/CHANGELOG.md +0 -13139
- package/src/vendor/bootstrap/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/package.json +0 -144
- package/src/vendor/bootstrap-vue/src/components/button/MODIFICATIONS.md +0 -16
- package/src/vendor/bootstrap-vue/src/components/button/README.md +0 -240
- package/src/vendor/bootstrap-vue/src/components/button/button-close.spec.js +0 -210
- package/src/vendor/bootstrap-vue/src/components/button/button.spec.js +0 -349
- package/src/vendor/bootstrap-vue/src/components/button/package.json +0 -105
- package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +0 -730
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.spec.js +0 -58
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.spec.js +0 -110
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.spec.js +0 -73
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.spec.js +0 -147
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.spec.js +0 -59
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.spec.js +0 -1121
- package/src/vendor/bootstrap-vue/src/components/dropdown/package.json +0 -368
- package/src/vendor/bootstrap-vue/src/components/form/README.md +0 -365
- package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.spec.js +0 -170
- package/src/vendor/bootstrap-vue/src/components/form/form-text.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.spec.js +0 -157
- package/src/vendor/bootstrap-vue/src/components/form/form.spec.js +0 -97
- package/src/vendor/bootstrap-vue/src/components/form/package.json +0 -112
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/README.md +0 -691
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox-group.spec.js +0 -525
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox.spec.js +0 -922
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/package.json +0 -172
- package/src/vendor/bootstrap-vue/src/components/form-group/README.md +0 -339
- package/src/vendor/bootstrap-vue/src/components/form-group/form-group.spec.js +0 -477
- package/src/vendor/bootstrap-vue/src/components/form-group/package.json +0 -183
- package/src/vendor/bootstrap-vue/src/components/form-radio/README.md +0 -437
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.spec.js +0 -357
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.spec.js +0 -587
- package/src/vendor/bootstrap-vue/src/components/form-radio/package.json +0 -162
- package/src/vendor/bootstrap-vue/src/components/form-select/README.md +0 -504
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.spec.js +0 -138
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.spec.js +0 -75
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select.spec.js +0 -723
- package/src/vendor/bootstrap-vue/src/components/form-select/package.json +0 -132
- package/src/vendor/bootstrap-vue/src/components/form-textarea/README.md +0 -453
- package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.spec.js +0 -1000
- package/src/vendor/bootstrap-vue/src/components/form-textarea/package.json +0 -122
- package/src/vendor/bootstrap-vue/src/components/layout/README.md +0 -791
- package/src/vendor/bootstrap-vue/src/components/layout/col.spec.js +0 -192
- package/src/vendor/bootstrap-vue/src/components/layout/form-row.spec.js +0 -45
- package/src/vendor/bootstrap-vue/src/components/layout/package.json +0 -99
- package/src/vendor/bootstrap-vue/src/components/link/README.md +0 -76
- package/src/vendor/bootstrap-vue/src/components/link/link.spec.js +0 -434
- package/src/vendor/bootstrap-vue/src/components/link/package.json +0 -57
- package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +0 -30
- package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -1067
- package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/components/modal/modal.spec.js +0 -1418
- package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -544
- package/src/vendor/bootstrap-vue/src/components/nav/README.md +0 -362
- package/src/vendor/bootstrap-vue/src/components/nav/nav-item.spec.js +0 -127
- package/src/vendor/bootstrap-vue/src/components/nav/nav.spec.js +0 -177
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -73
- package/src/vendor/bootstrap-vue/src/components/popover/README.md +0 -919
- package/src/vendor/bootstrap-vue/src/components/popover/package.json +0 -261
- package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -198
- package/src/vendor/bootstrap-vue/src/components/table/README.md +0 -3157
- package/src/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -1763
- package/src/vendor/bootstrap-vue/src/components/table/table-busy.spec.js +0 -150
- package/src/vendor/bootstrap-vue/src/components/table/table-caption.spec.js +0 -176
- package/src/vendor/bootstrap-vue/src/components/table/table-colgroup.spec.js +0 -81
- package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +0 -409
- package/src/vendor/bootstrap-vue/src/components/table/table-item-formatter.spec.js +0 -56
- package/src/vendor/bootstrap-vue/src/components/table/table-lite.spec.js +0 -682
- package/src/vendor/bootstrap-vue/src/components/table/table-pagination.spec.js +0 -133
- package/src/vendor/bootstrap-vue/src/components/table/table-primarykey.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-provider.spec.js +0 -411
- package/src/vendor/bootstrap-vue/src/components/table/table-row-details.spec.js +0 -459
- package/src/vendor/bootstrap-vue/src/components/table/table-selectable.spec.js +0 -1182
- package/src/vendor/bootstrap-vue/src/components/table/table-simple.spec.js +0 -206
- package/src/vendor/bootstrap-vue/src/components/table/table-sorting.spec.js +0 -858
- package/src/vendor/bootstrap-vue/src/components/table/table-sticky-column.spec.js +0 -377
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-bottom-row.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-row-events.spec.js +0 -529
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-top-row.spec.js +0 -88
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-transition.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-custom.spec.js +0 -91
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-events.spec.js +0 -137
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-events.spec.js +0 -155
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-top.spec.js +0 -96
- package/src/vendor/bootstrap-vue/src/components/table/table.spec.js +0 -692
- package/src/vendor/bootstrap-vue/src/components/tabs/README.md +0 -433
- package/src/vendor/bootstrap-vue/src/components/tabs/package.json +0 -205
- package/src/vendor/bootstrap-vue/src/components/tabs/tab.spec.js +0 -330
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.spec.js +0 -778
- package/src/vendor/bootstrap-vue/src/components/toast/README.md +0 -655
- package/src/vendor/bootstrap-vue/src/components/toast/helpers/bv-toast.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/toast/package.json +0 -184
- package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +0 -294
- package/src/vendor/bootstrap-vue/src/components/toast/toaster.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/components/tooltip/README.md +0 -559
- package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -258
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +0 -1240
- package/src/vendor/bootstrap-vue/src/components/transition/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/transporter.spec.js +0 -85
- package/src/vendor/bootstrap-vue/src/directives/modal/modal.spec.js +0 -191
- package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -521
- package/src/vendor/bootstrap-vue/src/directives/tooltip/package.json +0 -131
- package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +0 -190
- package/src/vendor/bootstrap-vue/src/directives/visible/README.md +0 -244
- package/src/vendor/bootstrap-vue/src/directives/visible/package.json +0 -24
- package/src/vendor/bootstrap-vue/src/mixins/attrs.spec.js +0 -194
- package/src/vendor/bootstrap-vue/src/mixins/click-out.spec.js +0 -52
- package/src/vendor/bootstrap-vue/src/mixins/focus-in.spec.js +0 -53
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.spec.js +0 -115
- package/src/vendor/bootstrap-vue/src/mixins/listeners.spec.js +0 -245
- package/src/vendor/bootstrap-vue/src/utils/bv-event.class.spec.js +0 -66
- package/src/vendor/bootstrap-vue/src/utils/clone-deep.spec.js +0 -70
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +0 -169
- package/src/vendor/bootstrap-vue/src/utils/css-escape.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/utils/dom.spec.js +0 -291
- package/src/vendor/bootstrap-vue/src/utils/events.spec.js +0 -41
- package/src/vendor/bootstrap-vue/src/utils/get.spec.js +0 -109
- package/src/vendor/bootstrap-vue/src/utils/inspect.spec.js +0 -251
- package/src/vendor/bootstrap-vue/src/utils/loose-equal.spec.js +0 -203
- package/src/vendor/bootstrap-vue/src/utils/normalize-slot.spec.js +0 -63
- package/src/vendor/bootstrap-vue/src/utils/number.spec.js +0 -72
- package/src/vendor/bootstrap-vue/src/utils/object.spec.js +0 -61
- package/src/vendor/bootstrap-vue/src/utils/props.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/utils/router.spec.js +0 -248
- package/src/vendor/bootstrap-vue/src/utils/string.spec.js +0 -65
- package/src/vendor/bootstrap-vue/src/utils/stringify-object-values.spec.js +0 -47
- package/src/vendor/bootstrap-vue/src/utils/warn.spec.js +0 -54
|
@@ -1,1000 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { waitNT, waitRAF } from '../../../tests/utils'
|
|
3
|
-
import { BFormTextarea } from './form-textarea'
|
|
4
|
-
|
|
5
|
-
describe('form-textarea', () => {
|
|
6
|
-
it('root element is textarea', async () => {
|
|
7
|
-
const wrapper = mount(BFormTextarea)
|
|
8
|
-
expect(wrapper.element.type).toBe('textarea')
|
|
9
|
-
|
|
10
|
-
wrapper.destroy()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('does not have attribute disabled by default', async () => {
|
|
14
|
-
const wrapper = mount(BFormTextarea)
|
|
15
|
-
expect(wrapper.attributes('disabled')).toBeUndefined()
|
|
16
|
-
|
|
17
|
-
wrapper.destroy()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('has attribute disabled when disabled=true', async () => {
|
|
21
|
-
const wrapper = mount(BFormTextarea, {
|
|
22
|
-
propsData: {
|
|
23
|
-
disabled: true
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
expect(wrapper.attributes('disabled')).toBeDefined()
|
|
27
|
-
|
|
28
|
-
wrapper.destroy()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('does not have attribute readonly by default', async () => {
|
|
32
|
-
const wrapper = mount(BFormTextarea)
|
|
33
|
-
expect(wrapper.attributes('readonly')).toBeUndefined()
|
|
34
|
-
|
|
35
|
-
wrapper.destroy()
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('has attribute readonly when readonly=true', async () => {
|
|
39
|
-
const wrapper = mount(BFormTextarea, {
|
|
40
|
-
propsData: {
|
|
41
|
-
readonly: true
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
expect(wrapper.attributes('readonly')).toBeDefined()
|
|
45
|
-
|
|
46
|
-
wrapper.destroy()
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('inherits non-prop attributes', async () => {
|
|
50
|
-
const wrapper = mount(BFormTextarea, {
|
|
51
|
-
attrs: {
|
|
52
|
-
foo: 'bar'
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
expect(wrapper.attributes('foo')).toBeDefined()
|
|
56
|
-
expect(wrapper.attributes('foo')).toBe('bar')
|
|
57
|
-
|
|
58
|
-
wrapper.destroy()
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('has class form-control by default', async () => {
|
|
62
|
-
const wrapper = mount(BFormTextarea)
|
|
63
|
-
expect(wrapper.classes()).toContain('form-control')
|
|
64
|
-
|
|
65
|
-
wrapper.destroy()
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('does not have class form-control-plaintext by default', async () => {
|
|
69
|
-
const wrapper = mount(BFormTextarea)
|
|
70
|
-
expect(wrapper.classes()).not.toContain('form-control-plaintext')
|
|
71
|
-
|
|
72
|
-
wrapper.destroy()
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('does not have size classes by default', async () => {
|
|
76
|
-
const wrapper = mount(BFormTextarea)
|
|
77
|
-
expect(wrapper.classes()).not.toContain('form-control-sm')
|
|
78
|
-
expect(wrapper.classes()).not.toContain('form-control-lg')
|
|
79
|
-
|
|
80
|
-
wrapper.destroy()
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('has size class when size prop is set', async () => {
|
|
84
|
-
const wrapper = mount(BFormTextarea, {
|
|
85
|
-
propsData: {
|
|
86
|
-
size: 'sm'
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
expect(wrapper.classes()).toContain('form-control-sm')
|
|
90
|
-
await wrapper.setProps({ size: 'lg' })
|
|
91
|
-
expect(wrapper.classes()).toContain('form-control-lg')
|
|
92
|
-
await wrapper.setProps({ size: 'foobar' })
|
|
93
|
-
expect(wrapper.classes()).toContain('form-control-foobar')
|
|
94
|
-
await wrapper.setProps({ size: '' })
|
|
95
|
-
expect(wrapper.classes()).not.toContain('form-control-')
|
|
96
|
-
|
|
97
|
-
wrapper.destroy()
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('has class form-control-plaintext when plaintext=true', async () => {
|
|
101
|
-
const wrapper = mount(BFormTextarea, {
|
|
102
|
-
propsData: {
|
|
103
|
-
plaintext: true
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
expect(wrapper.classes()).toContain('form-control-plaintext')
|
|
107
|
-
|
|
108
|
-
wrapper.destroy()
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('does not have class form-control when plaintext=true', async () => {
|
|
112
|
-
const wrapper = mount(BFormTextarea, {
|
|
113
|
-
propsData: {
|
|
114
|
-
plaintext: true
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
expect(wrapper.classes()).not.toContain('form-control')
|
|
118
|
-
|
|
119
|
-
wrapper.destroy()
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it('has attribute readonly when plaintext=true', async () => {
|
|
123
|
-
const wrapper = mount(BFormTextarea, {
|
|
124
|
-
propsData: {
|
|
125
|
-
plaintext: true
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
expect(wrapper.attributes('readonly')).toBeDefined()
|
|
129
|
-
|
|
130
|
-
wrapper.destroy()
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
it('has user supplied id', async () => {
|
|
134
|
-
const wrapper = mount(BFormTextarea, {
|
|
135
|
-
propsData: {
|
|
136
|
-
id: 'foobar'
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
expect(wrapper.attributes('id')).toBe('foobar')
|
|
140
|
-
|
|
141
|
-
wrapper.destroy()
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
it('does not have is-valid or is-invalid classes by default', async () => {
|
|
145
|
-
const wrapper = mount(BFormTextarea)
|
|
146
|
-
expect(wrapper.classes()).not.toContain('is-valid')
|
|
147
|
-
expect(wrapper.classes()).not.toContain('is-invalid')
|
|
148
|
-
|
|
149
|
-
wrapper.destroy()
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
it('has class is-valid when state=true', async () => {
|
|
153
|
-
const wrapper = mount(BFormTextarea, {
|
|
154
|
-
propsData: {
|
|
155
|
-
state: true
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
expect(wrapper.classes()).toContain('is-valid')
|
|
159
|
-
expect(wrapper.classes()).not.toContain('is-invalid')
|
|
160
|
-
|
|
161
|
-
wrapper.destroy()
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
it('has class is-invalid when state=false', async () => {
|
|
165
|
-
const wrapper = mount(BFormTextarea, {
|
|
166
|
-
propsData: {
|
|
167
|
-
state: false
|
|
168
|
-
}
|
|
169
|
-
})
|
|
170
|
-
expect(wrapper.classes()).toContain('is-invalid')
|
|
171
|
-
expect(wrapper.classes()).not.toContain('is-valid')
|
|
172
|
-
|
|
173
|
-
wrapper.destroy()
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
it('does not have aria-invalid attribute by default', async () => {
|
|
177
|
-
const wrapper = mount(BFormTextarea)
|
|
178
|
-
expect(wrapper.attributes('aria-invalid')).toBeUndefined()
|
|
179
|
-
|
|
180
|
-
wrapper.destroy()
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
it('does not have aria-invalid attribute when state=true', async () => {
|
|
184
|
-
const wrapper = mount(BFormTextarea, {
|
|
185
|
-
propsData: {
|
|
186
|
-
state: true
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
expect(wrapper.attributes('aria-invalid')).toBeUndefined()
|
|
190
|
-
|
|
191
|
-
wrapper.destroy()
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
it('has aria-invalid attribute when state=false', async () => {
|
|
195
|
-
const wrapper = mount(BFormTextarea, {
|
|
196
|
-
propsData: {
|
|
197
|
-
state: false
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
expect(wrapper.attributes('aria-invalid')).toBe('true')
|
|
201
|
-
|
|
202
|
-
wrapper.destroy()
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
it('has aria-invalid attribute when aria-invalid=true', async () => {
|
|
206
|
-
const wrapper = mount(BFormTextarea, {
|
|
207
|
-
propsData: {
|
|
208
|
-
ariaInvalid: true
|
|
209
|
-
}
|
|
210
|
-
})
|
|
211
|
-
expect(wrapper.attributes('aria-invalid')).toBe('true')
|
|
212
|
-
await wrapper.setProps({ ariaInvalid: 'true' })
|
|
213
|
-
expect(wrapper.attributes('aria-invalid')).toBe('true')
|
|
214
|
-
|
|
215
|
-
wrapper.destroy()
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
it('has aria-invalid attribute when aria-invalid="spelling"', async () => {
|
|
219
|
-
const wrapper = mount(BFormTextarea, {
|
|
220
|
-
propsData: {
|
|
221
|
-
ariaInvalid: 'spelling'
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
expect(wrapper.attributes('aria-invalid')).toBe('spelling')
|
|
225
|
-
|
|
226
|
-
wrapper.destroy()
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it('does not emit an update event on mount when value not set', async () => {
|
|
230
|
-
const wrapper = mount(BFormTextarea)
|
|
231
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
232
|
-
|
|
233
|
-
wrapper.destroy()
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
it('does mot emit an update event on mount when value is set and no formatter', async () => {
|
|
237
|
-
const wrapper = mount(BFormTextarea, {
|
|
238
|
-
value: 'foobar'
|
|
239
|
-
})
|
|
240
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
241
|
-
|
|
242
|
-
wrapper.destroy()
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
it('emits an input event with single arg of value', async () => {
|
|
246
|
-
const wrapper = mount(BFormTextarea)
|
|
247
|
-
|
|
248
|
-
wrapper.element.value = 'test'
|
|
249
|
-
await wrapper.trigger('input')
|
|
250
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
251
|
-
expect(wrapper.emitted('input')[0].length).toEqual(1)
|
|
252
|
-
expect(wrapper.emitted('input')[0][0]).toEqual('test')
|
|
253
|
-
|
|
254
|
-
wrapper.destroy()
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
it('emits an change event with single arg of value', async () => {
|
|
258
|
-
const wrapper = mount(BFormTextarea)
|
|
259
|
-
|
|
260
|
-
wrapper.element.value = 'test'
|
|
261
|
-
await wrapper.trigger('change')
|
|
262
|
-
expect(wrapper.emitted('change')).toBeDefined()
|
|
263
|
-
expect(wrapper.emitted('change')[0].length).toEqual(1)
|
|
264
|
-
expect(wrapper.emitted('change')[0][0]).toEqual('test')
|
|
265
|
-
|
|
266
|
-
wrapper.destroy()
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
it('emits an update event with one arg on input', async () => {
|
|
270
|
-
const wrapper = mount(BFormTextarea)
|
|
271
|
-
|
|
272
|
-
wrapper.element.value = 'test'
|
|
273
|
-
await wrapper.trigger('input')
|
|
274
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
275
|
-
expect(wrapper.emitted('update')[0].length).toEqual(1)
|
|
276
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('test')
|
|
277
|
-
|
|
278
|
-
wrapper.destroy()
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
it('does not emit an update event on change when value not changed', async () => {
|
|
282
|
-
const wrapper = mount(BFormTextarea)
|
|
283
|
-
|
|
284
|
-
wrapper.element.value = 'test'
|
|
285
|
-
await wrapper.trigger('input')
|
|
286
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
287
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
288
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('test')
|
|
289
|
-
|
|
290
|
-
await wrapper.trigger('change')
|
|
291
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
292
|
-
|
|
293
|
-
wrapper.destroy()
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
it('emits an update event with one arg on change when input text changed', async () => {
|
|
297
|
-
const wrapper = mount(BFormTextarea)
|
|
298
|
-
|
|
299
|
-
wrapper.element.value = 'test'
|
|
300
|
-
await wrapper.trigger('input')
|
|
301
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
302
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
303
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('test')
|
|
304
|
-
|
|
305
|
-
wrapper.element.value = 'TEST'
|
|
306
|
-
await wrapper.trigger('change')
|
|
307
|
-
expect(wrapper.emitted('update').length).toEqual(2)
|
|
308
|
-
expect(wrapper.emitted('update')[1][0]).toEqual('TEST')
|
|
309
|
-
|
|
310
|
-
wrapper.destroy()
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
it('does not emit an update, input or change event when value prop changed', async () => {
|
|
314
|
-
const wrapper = mount(BFormTextarea, {
|
|
315
|
-
value: ''
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
319
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
320
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
321
|
-
|
|
322
|
-
await wrapper.setProps({ value: 'test' })
|
|
323
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
324
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
325
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
326
|
-
|
|
327
|
-
wrapper.destroy()
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
it('emits a native focus event', async () => {
|
|
331
|
-
const spy = jest.fn()
|
|
332
|
-
const wrapper = mount(BFormTextarea, {
|
|
333
|
-
attachTo: document.body,
|
|
334
|
-
listeners: {
|
|
335
|
-
focus: spy
|
|
336
|
-
}
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
await wrapper.trigger('focus')
|
|
340
|
-
expect(wrapper.emitted('focus')).toBeUndefined()
|
|
341
|
-
expect(spy).toHaveBeenCalled()
|
|
342
|
-
|
|
343
|
-
wrapper.destroy()
|
|
344
|
-
})
|
|
345
|
-
|
|
346
|
-
it('emits a blur event when blurred', async () => {
|
|
347
|
-
const wrapper = mount(BFormTextarea)
|
|
348
|
-
|
|
349
|
-
await wrapper.trigger('blur')
|
|
350
|
-
expect(wrapper.emitted('blur')).toBeDefined()
|
|
351
|
-
|
|
352
|
-
wrapper.destroy()
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
it('has attribute rows set to 2 by default', async () => {
|
|
356
|
-
const wrapper = mount(BFormTextarea)
|
|
357
|
-
|
|
358
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
359
|
-
expect(wrapper.attributes('rows')).toEqual('2')
|
|
360
|
-
|
|
361
|
-
wrapper.destroy()
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
it('has attribute rows when rows set and max-rows not set', async () => {
|
|
365
|
-
const wrapper = mount(BFormTextarea, {
|
|
366
|
-
propsData: {
|
|
367
|
-
rows: 10
|
|
368
|
-
}
|
|
369
|
-
})
|
|
370
|
-
|
|
371
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
372
|
-
expect(wrapper.attributes('rows')).toEqual('10')
|
|
373
|
-
|
|
374
|
-
// Should work with both text and number values
|
|
375
|
-
await wrapper.setProps({ rows: '20' })
|
|
376
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
377
|
-
expect(wrapper.attributes('rows')).toEqual('20')
|
|
378
|
-
|
|
379
|
-
// Should use minimum value of 2 when rows is set less than 2
|
|
380
|
-
await wrapper.setProps({ rows: '1' })
|
|
381
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
382
|
-
expect(wrapper.attributes('rows')).toEqual('2')
|
|
383
|
-
|
|
384
|
-
await wrapper.setProps({ rows: -10 })
|
|
385
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
386
|
-
expect(wrapper.attributes('rows')).toEqual('2')
|
|
387
|
-
|
|
388
|
-
wrapper.destroy()
|
|
389
|
-
})
|
|
390
|
-
|
|
391
|
-
it('has attribute rows set when rows and max-rows are equal', async () => {
|
|
392
|
-
const wrapper = mount(BFormTextarea, {
|
|
393
|
-
propsData: {
|
|
394
|
-
rows: 5,
|
|
395
|
-
maxRows: 5
|
|
396
|
-
}
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
400
|
-
expect(wrapper.attributes('rows')).toEqual('5')
|
|
401
|
-
|
|
402
|
-
// Should work with both text and number values
|
|
403
|
-
await wrapper.setProps({ rows: '10', maxRows: '10' })
|
|
404
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
405
|
-
expect(wrapper.attributes('rows')).toEqual('10')
|
|
406
|
-
|
|
407
|
-
wrapper.destroy()
|
|
408
|
-
})
|
|
409
|
-
|
|
410
|
-
it('does not have rows set when rows and max-rows set', async () => {
|
|
411
|
-
const wrapper = mount(BFormTextarea, {
|
|
412
|
-
propsData: {
|
|
413
|
-
rows: 2,
|
|
414
|
-
maxRows: 5
|
|
415
|
-
}
|
|
416
|
-
})
|
|
417
|
-
|
|
418
|
-
expect(wrapper.attributes('rows')).toBeUndefined()
|
|
419
|
-
|
|
420
|
-
wrapper.destroy()
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
it('has attribute rows set when max-rows less than rows', async () => {
|
|
424
|
-
const wrapper = mount(BFormTextarea, {
|
|
425
|
-
propsData: {
|
|
426
|
-
rows: 10,
|
|
427
|
-
maxRows: 5
|
|
428
|
-
}
|
|
429
|
-
})
|
|
430
|
-
|
|
431
|
-
expect(wrapper.attributes('rows')).toBeDefined()
|
|
432
|
-
expect(wrapper.attributes('rows')).toEqual('10')
|
|
433
|
-
|
|
434
|
-
wrapper.destroy()
|
|
435
|
-
})
|
|
436
|
-
|
|
437
|
-
it('does not have style resize by default', async () => {
|
|
438
|
-
const wrapper = mount(BFormTextarea, {
|
|
439
|
-
attachTo: document.body
|
|
440
|
-
})
|
|
441
|
-
|
|
442
|
-
expect(wrapper.element.style).toBeDefined()
|
|
443
|
-
expect(wrapper.element.style.resize).toEqual('')
|
|
444
|
-
|
|
445
|
-
wrapper.destroy()
|
|
446
|
-
})
|
|
447
|
-
|
|
448
|
-
it('does not have style resize when no-resize is set', async () => {
|
|
449
|
-
const wrapper = mount(BFormTextarea, {
|
|
450
|
-
attachTo: document.body,
|
|
451
|
-
propsData: {
|
|
452
|
-
noResize: true
|
|
453
|
-
}
|
|
454
|
-
})
|
|
455
|
-
|
|
456
|
-
expect(wrapper.element.style).toBeDefined()
|
|
457
|
-
expect(wrapper.element.style.resize).toEqual('none')
|
|
458
|
-
|
|
459
|
-
wrapper.destroy()
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
it('does not have style resize when max-rows not set', async () => {
|
|
463
|
-
const wrapper = mount(BFormTextarea, {
|
|
464
|
-
attachTo: document.body,
|
|
465
|
-
propsData: {
|
|
466
|
-
rows: 10
|
|
467
|
-
}
|
|
468
|
-
})
|
|
469
|
-
|
|
470
|
-
expect(wrapper.element.style).toBeDefined()
|
|
471
|
-
expect(wrapper.element.style.resize).toEqual('')
|
|
472
|
-
|
|
473
|
-
wrapper.destroy()
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
it('does not have style resize when max-rows less than rows', async () => {
|
|
477
|
-
const wrapper = mount(BFormTextarea, {
|
|
478
|
-
attachTo: document.body,
|
|
479
|
-
propsData: {
|
|
480
|
-
rows: 10,
|
|
481
|
-
maxRows: 5
|
|
482
|
-
}
|
|
483
|
-
})
|
|
484
|
-
|
|
485
|
-
expect(wrapper.element.style).toBeDefined()
|
|
486
|
-
expect(wrapper.element.style.resize).toEqual('')
|
|
487
|
-
|
|
488
|
-
wrapper.destroy()
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
it('has style resize:none when max-rows greater than rows', async () => {
|
|
492
|
-
const wrapper = mount(BFormTextarea, {
|
|
493
|
-
attachTo: document.body,
|
|
494
|
-
propsData: {
|
|
495
|
-
rows: 2,
|
|
496
|
-
maxRows: 5
|
|
497
|
-
}
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
expect(wrapper.element.style).toBeDefined()
|
|
501
|
-
expect(wrapper.element.style.resize).toBeDefined()
|
|
502
|
-
expect(wrapper.element.style.resize).toEqual('none')
|
|
503
|
-
|
|
504
|
-
wrapper.destroy()
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
it('does not have style height by default', async () => {
|
|
508
|
-
const wrapper = mount(BFormTextarea, {
|
|
509
|
-
attachTo: document.body
|
|
510
|
-
})
|
|
511
|
-
|
|
512
|
-
expect(wrapper.element.style).toBeDefined()
|
|
513
|
-
expect(wrapper.element.style.height).toBeDefined()
|
|
514
|
-
expect(wrapper.element.style.height).toEqual('')
|
|
515
|
-
|
|
516
|
-
wrapper.destroy()
|
|
517
|
-
})
|
|
518
|
-
|
|
519
|
-
it('does not have style height when rows and max-rows equal', async () => {
|
|
520
|
-
const wrapper = mount(BFormTextarea, {
|
|
521
|
-
attachTo: document.body,
|
|
522
|
-
propsData: {
|
|
523
|
-
rows: 2,
|
|
524
|
-
maxRows: 2
|
|
525
|
-
}
|
|
526
|
-
})
|
|
527
|
-
|
|
528
|
-
expect(wrapper.element.style).toBeDefined()
|
|
529
|
-
expect(wrapper.element.style.height).toBeDefined()
|
|
530
|
-
expect(wrapper.element.style.height).toEqual('')
|
|
531
|
-
|
|
532
|
-
wrapper.destroy()
|
|
533
|
-
})
|
|
534
|
-
|
|
535
|
-
it('does not have style height when max-rows not set', async () => {
|
|
536
|
-
const wrapper = mount(BFormTextarea, {
|
|
537
|
-
attachTo: document.body,
|
|
538
|
-
propsData: {
|
|
539
|
-
rows: 5
|
|
540
|
-
}
|
|
541
|
-
})
|
|
542
|
-
|
|
543
|
-
expect(wrapper.element.style).toBeDefined()
|
|
544
|
-
expect(wrapper.element.style.height).toBeDefined()
|
|
545
|
-
expect(wrapper.element.style.height).toEqual('')
|
|
546
|
-
|
|
547
|
-
wrapper.destroy()
|
|
548
|
-
})
|
|
549
|
-
|
|
550
|
-
// The height style calculations do not work in JSDOM environment
|
|
551
|
-
// But we do know auto height works in browser from manual testing
|
|
552
|
-
//
|
|
553
|
-
// it('has style height when max-rows greater than rows', async () => {
|
|
554
|
-
// const input = mount(BFormTextarea, {
|
|
555
|
-
// attachTo: document.body,
|
|
556
|
-
// propsData: {
|
|
557
|
-
// rows: 2,
|
|
558
|
-
// maxRows: 5
|
|
559
|
-
// }
|
|
560
|
-
// })
|
|
561
|
-
// await input.vm.$nextTick()
|
|
562
|
-
//
|
|
563
|
-
// expect(input.element.style).toBeDefined()
|
|
564
|
-
// expect(input.element.style.height).toBeDefined()
|
|
565
|
-
// expect(input.element.style.height).not.toEqual('')
|
|
566
|
-
//
|
|
567
|
-
// input.destroy()
|
|
568
|
-
// })
|
|
569
|
-
//
|
|
570
|
-
// it('auto height should work', async () => {
|
|
571
|
-
// const input = mount(BFormTextarea, {
|
|
572
|
-
// attachTo: document.body,
|
|
573
|
-
// propsData: {
|
|
574
|
-
// value: '',
|
|
575
|
-
// rows: 2,
|
|
576
|
-
// maxRows: 10
|
|
577
|
-
// }
|
|
578
|
-
// })
|
|
579
|
-
// expect(input.element.style).toBeDefined()
|
|
580
|
-
// expect(input.element.style.height).toBeDefined()
|
|
581
|
-
// expect(input.element.style.height).not.toEqual('')
|
|
582
|
-
// const firstHeight = parseFloat(input.element.style.height)
|
|
583
|
-
// // Set content to five lines heigh
|
|
584
|
-
// input.element.value = 'one\n two\n three\n four\n five'
|
|
585
|
-
// await input.trigger('input')
|
|
586
|
-
// expect(input.emitted('update')).toBeDefined()
|
|
587
|
-
// expect(input.element.style.height).not.toEqual('')
|
|
588
|
-
// const secondHeight = parseFloat(input.element.style.height)
|
|
589
|
-
// expect(secondHeight).toBeGreaterThan(firstHeight)
|
|
590
|
-
// // Set content to one lines heigh
|
|
591
|
-
// input.element.value = 'one'
|
|
592
|
-
// await input.trigger('input')
|
|
593
|
-
// expect(input.emitted('update').length).toEqual(2)
|
|
594
|
-
// expect(input.element.style.height).not.toEqual('')
|
|
595
|
-
// const thirdHeight = parseFloat(input.element.style.height)
|
|
596
|
-
// expect(thirdHeight).toBeLessThan(secondHeight)
|
|
597
|
-
//
|
|
598
|
-
// input.destroy()
|
|
599
|
-
// })
|
|
600
|
-
|
|
601
|
-
it('Formats on input when not lazy', async () => {
|
|
602
|
-
const wrapper = mount(BFormTextarea, {
|
|
603
|
-
attachTo: document.body,
|
|
604
|
-
propsData: {
|
|
605
|
-
value: '',
|
|
606
|
-
formatter(value) {
|
|
607
|
-
return value.toLowerCase()
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
})
|
|
611
|
-
|
|
612
|
-
wrapper.element.value = 'TEST'
|
|
613
|
-
await wrapper.trigger('input')
|
|
614
|
-
|
|
615
|
-
// Update event fires first with formatted value
|
|
616
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
617
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
618
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('test')
|
|
619
|
-
// Followed by an input event with formatted value
|
|
620
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
621
|
-
expect(wrapper.emitted('input').length).toEqual(1)
|
|
622
|
-
expect(wrapper.emitted('input')[0][0]).toEqual('test')
|
|
623
|
-
// And no change event
|
|
624
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
625
|
-
|
|
626
|
-
wrapper.destroy()
|
|
627
|
-
})
|
|
628
|
-
|
|
629
|
-
it('Formats on change when not lazy', async () => {
|
|
630
|
-
const wrapper = mount(BFormTextarea, {
|
|
631
|
-
attachTo: document.body,
|
|
632
|
-
propsData: {
|
|
633
|
-
value: '',
|
|
634
|
-
formatter(value) {
|
|
635
|
-
return value.toLowerCase()
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
})
|
|
639
|
-
|
|
640
|
-
wrapper.element.value = 'TEST'
|
|
641
|
-
await wrapper.trigger('change')
|
|
642
|
-
|
|
643
|
-
// Update event fires first with formatted value
|
|
644
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
645
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
646
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('test')
|
|
647
|
-
// Followed by a change event with formatted value
|
|
648
|
-
expect(wrapper.emitted('change')).toBeDefined()
|
|
649
|
-
expect(wrapper.emitted('change').length).toEqual(1)
|
|
650
|
-
expect(wrapper.emitted('change')[0][0]).toEqual('test')
|
|
651
|
-
// And no input event
|
|
652
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
653
|
-
|
|
654
|
-
wrapper.destroy()
|
|
655
|
-
})
|
|
656
|
-
|
|
657
|
-
it('Formats on blur when lazy', async () => {
|
|
658
|
-
const wrapper = mount(BFormTextarea, {
|
|
659
|
-
attachTo: document.body,
|
|
660
|
-
propsData: {
|
|
661
|
-
formatter(value) {
|
|
662
|
-
return value.toLowerCase()
|
|
663
|
-
},
|
|
664
|
-
lazyFormatter: true
|
|
665
|
-
}
|
|
666
|
-
})
|
|
667
|
-
|
|
668
|
-
wrapper.element.value = 'TEST'
|
|
669
|
-
await wrapper.trigger('input')
|
|
670
|
-
|
|
671
|
-
// Update event fires first
|
|
672
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
673
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
674
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('TEST')
|
|
675
|
-
// Followed by an input
|
|
676
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
677
|
-
expect(wrapper.emitted('input').length).toEqual(1)
|
|
678
|
-
expect(wrapper.emitted('input')[0][0]).toEqual('TEST')
|
|
679
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
680
|
-
|
|
681
|
-
await wrapper.trigger('change')
|
|
682
|
-
|
|
683
|
-
// Update does not fire again
|
|
684
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
685
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
686
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('TEST')
|
|
687
|
-
// Event change emitted
|
|
688
|
-
expect(wrapper.emitted('change')).toBeDefined()
|
|
689
|
-
expect(wrapper.emitted('change').length).toEqual(1)
|
|
690
|
-
expect(wrapper.emitted('change')[0][0]).toEqual('TEST')
|
|
691
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
692
|
-
|
|
693
|
-
await wrapper.trigger('blur')
|
|
694
|
-
|
|
695
|
-
// Update fires before change with formatted value
|
|
696
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
697
|
-
expect(wrapper.emitted('update').length).toEqual(2)
|
|
698
|
-
expect(wrapper.emitted('update')[1][0]).toEqual('test')
|
|
699
|
-
// Followed by blur event with native event
|
|
700
|
-
expect(wrapper.emitted('blur')).toBeDefined()
|
|
701
|
-
expect(wrapper.emitted('blur')[0][0] instanceof Event).toBe(true)
|
|
702
|
-
expect(wrapper.emitted('blur')[0][0].type).toEqual('blur')
|
|
703
|
-
|
|
704
|
-
// Expected number of events from above sequence
|
|
705
|
-
expect(wrapper.emitted('input').length).toEqual(1)
|
|
706
|
-
expect(wrapper.emitted('change').length).toEqual(1)
|
|
707
|
-
expect(wrapper.emitted('blur').length).toEqual(1)
|
|
708
|
-
expect(wrapper.emitted('update').length).toEqual(2)
|
|
709
|
-
|
|
710
|
-
wrapper.destroy()
|
|
711
|
-
})
|
|
712
|
-
|
|
713
|
-
it('Does not format value on mount when not lazy', async () => {
|
|
714
|
-
const wrapper = mount(BFormTextarea, {
|
|
715
|
-
attachTo: document.body,
|
|
716
|
-
propsData: {
|
|
717
|
-
value: 'TEST',
|
|
718
|
-
formatter(value) {
|
|
719
|
-
return value.toLowerCase()
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
})
|
|
723
|
-
|
|
724
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
725
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
726
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
727
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
728
|
-
|
|
729
|
-
wrapper.destroy()
|
|
730
|
-
})
|
|
731
|
-
|
|
732
|
-
it('Does not format value on mount when lazy', async () => {
|
|
733
|
-
const wrapper = mount(BFormTextarea, {
|
|
734
|
-
attachTo: document.body,
|
|
735
|
-
propsData: {
|
|
736
|
-
value: 'TEST',
|
|
737
|
-
formatter(value) {
|
|
738
|
-
return value.toLowerCase()
|
|
739
|
-
},
|
|
740
|
-
lazyFormatter: true
|
|
741
|
-
}
|
|
742
|
-
})
|
|
743
|
-
|
|
744
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
745
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
746
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
747
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
748
|
-
|
|
749
|
-
wrapper.destroy()
|
|
750
|
-
})
|
|
751
|
-
|
|
752
|
-
it('Does not format on prop "value" change when not lazy', async () => {
|
|
753
|
-
const wrapper = mount(BFormTextarea, {
|
|
754
|
-
attachTo: document.body,
|
|
755
|
-
propsData: {
|
|
756
|
-
value: '',
|
|
757
|
-
formatter(value) {
|
|
758
|
-
return value.toLowerCase()
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
})
|
|
762
|
-
|
|
763
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
764
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
765
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
766
|
-
expect(wrapper.vm.localValue).toEqual('')
|
|
767
|
-
|
|
768
|
-
await wrapper.setProps({ value: 'TEST' })
|
|
769
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
770
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
771
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
772
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
773
|
-
|
|
774
|
-
wrapper.destroy()
|
|
775
|
-
})
|
|
776
|
-
|
|
777
|
-
it('does not format on value prop change when lazy', async () => {
|
|
778
|
-
const wrapper = mount(BFormTextarea, {
|
|
779
|
-
attachTo: document.body,
|
|
780
|
-
propsData: {
|
|
781
|
-
value: '',
|
|
782
|
-
formatter(value) {
|
|
783
|
-
return value.toLowerCase()
|
|
784
|
-
},
|
|
785
|
-
lazyFormatter: true
|
|
786
|
-
}
|
|
787
|
-
})
|
|
788
|
-
|
|
789
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
790
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
791
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
792
|
-
expect(wrapper.vm.localValue).toEqual('')
|
|
793
|
-
|
|
794
|
-
// Does not emit any events
|
|
795
|
-
await wrapper.setProps({ value: 'TEST' })
|
|
796
|
-
expect(wrapper.emitted('update')).toBeUndefined()
|
|
797
|
-
expect(wrapper.emitted('input')).toBeUndefined()
|
|
798
|
-
expect(wrapper.emitted('change')).toBeUndefined()
|
|
799
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
800
|
-
|
|
801
|
-
wrapper.destroy()
|
|
802
|
-
})
|
|
803
|
-
|
|
804
|
-
it('trim modifier prop works', async () => {
|
|
805
|
-
const wrapper = mount(BFormTextarea, {
|
|
806
|
-
attachTo: document.body,
|
|
807
|
-
propsData: {
|
|
808
|
-
value: '',
|
|
809
|
-
trim: true
|
|
810
|
-
}
|
|
811
|
-
})
|
|
812
|
-
|
|
813
|
-
expect(wrapper.vm.localValue).toEqual('')
|
|
814
|
-
|
|
815
|
-
wrapper.element.value = 'TEST'
|
|
816
|
-
await wrapper.trigger('input')
|
|
817
|
-
|
|
818
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
819
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
820
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
821
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('TEST')
|
|
822
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
823
|
-
expect(wrapper.emitted('input').length).toEqual(1)
|
|
824
|
-
expect(wrapper.emitted('input')[0][0]).toEqual('TEST')
|
|
825
|
-
|
|
826
|
-
wrapper.element.value = 'TEST '
|
|
827
|
-
await wrapper.trigger('input')
|
|
828
|
-
|
|
829
|
-
expect(wrapper.vm.localValue).toEqual('TEST ')
|
|
830
|
-
// `v-model` value stays the same and update event shouldn't be emitted again
|
|
831
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
832
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
833
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
834
|
-
expect(wrapper.emitted('input').length).toEqual(2)
|
|
835
|
-
expect(wrapper.emitted('input')[1][0]).toEqual('TEST ')
|
|
836
|
-
|
|
837
|
-
wrapper.element.value = ' TEST '
|
|
838
|
-
await wrapper.trigger('input')
|
|
839
|
-
|
|
840
|
-
expect(wrapper.vm.localValue).toEqual(' TEST ')
|
|
841
|
-
// `v-model` value stays the same and update event shouldn't be emitted again
|
|
842
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
843
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
844
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
845
|
-
expect(wrapper.emitted('input').length).toEqual(3)
|
|
846
|
-
expect(wrapper.emitted('input')[2][0]).toEqual(' TEST ')
|
|
847
|
-
|
|
848
|
-
await wrapper.trigger('input')
|
|
849
|
-
|
|
850
|
-
expect(wrapper.vm.localValue).toEqual(' TEST ')
|
|
851
|
-
// `v-model` value stays the same and update event shouldn't be emitted again
|
|
852
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
853
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
854
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
855
|
-
expect(wrapper.emitted('input').length).toEqual(4)
|
|
856
|
-
expect(wrapper.emitted('input')[3][0]).toEqual(' TEST ')
|
|
857
|
-
|
|
858
|
-
await wrapper.trigger('change')
|
|
859
|
-
|
|
860
|
-
expect(wrapper.vm.localValue).toEqual(' TEST ')
|
|
861
|
-
// `v-model` value stays the same and update event shouldn't be emitted again
|
|
862
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
863
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
864
|
-
expect(wrapper.emitted('change')).toBeDefined()
|
|
865
|
-
expect(wrapper.emitted('change').length).toEqual(1)
|
|
866
|
-
expect(wrapper.emitted('change')[0][0]).toEqual(' TEST ')
|
|
867
|
-
|
|
868
|
-
wrapper.destroy()
|
|
869
|
-
})
|
|
870
|
-
|
|
871
|
-
it('number modifier prop works', async () => {
|
|
872
|
-
const wrapper = mount(BFormTextarea, {
|
|
873
|
-
attachTo: document.body,
|
|
874
|
-
propsData: {
|
|
875
|
-
value: '',
|
|
876
|
-
number: true
|
|
877
|
-
}
|
|
878
|
-
})
|
|
879
|
-
|
|
880
|
-
expect(wrapper.vm.localValue).toEqual('')
|
|
881
|
-
|
|
882
|
-
wrapper.element.value = 'TEST'
|
|
883
|
-
await wrapper.trigger('input')
|
|
884
|
-
|
|
885
|
-
expect(wrapper.vm.localValue).toEqual('TEST')
|
|
886
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
887
|
-
expect(wrapper.emitted('update').length).toEqual(1)
|
|
888
|
-
expect(wrapper.emitted('update')[0][0]).toEqual('TEST')
|
|
889
|
-
expect(typeof wrapper.emitted('update')[0][0]).toEqual('string')
|
|
890
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
891
|
-
expect(wrapper.emitted('input').length).toEqual(1)
|
|
892
|
-
expect(wrapper.emitted('input')[0][0]).toEqual('TEST')
|
|
893
|
-
expect(typeof wrapper.emitted('input')[0][0]).toEqual('string')
|
|
894
|
-
|
|
895
|
-
wrapper.element.value = '123.45'
|
|
896
|
-
await wrapper.trigger('input')
|
|
897
|
-
|
|
898
|
-
expect(wrapper.vm.localValue).toEqual('123.45')
|
|
899
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
900
|
-
expect(wrapper.emitted('update').length).toEqual(2)
|
|
901
|
-
expect(wrapper.emitted('update')[1][0]).toEqual(123.45)
|
|
902
|
-
expect(typeof wrapper.emitted('update')[1][0]).toEqual('number')
|
|
903
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
904
|
-
expect(wrapper.emitted('input').length).toEqual(2)
|
|
905
|
-
expect(wrapper.emitted('input')[1][0]).toEqual('123.45')
|
|
906
|
-
expect(typeof wrapper.emitted('input')[1][0]).toEqual('string')
|
|
907
|
-
|
|
908
|
-
wrapper.element.value = '0123.450'
|
|
909
|
-
await wrapper.trigger('input')
|
|
910
|
-
|
|
911
|
-
expect(wrapper.vm.localValue).toEqual('0123.450')
|
|
912
|
-
// `v-model` value stays the same and update event shouldn't be emitted again
|
|
913
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
914
|
-
expect(wrapper.emitted('update').length).toEqual(2)
|
|
915
|
-
expect(wrapper.emitted('update')[1][0]).toEqual(123.45)
|
|
916
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
917
|
-
expect(wrapper.emitted('input').length).toEqual(3)
|
|
918
|
-
expect(wrapper.emitted('input')[2][0]).toEqual('0123.450')
|
|
919
|
-
expect(typeof wrapper.emitted('input')[2][0]).toEqual('string')
|
|
920
|
-
|
|
921
|
-
wrapper.element.value = '0123 450'
|
|
922
|
-
await wrapper.trigger('input')
|
|
923
|
-
|
|
924
|
-
expect(wrapper.vm.localValue).toEqual('0123 450')
|
|
925
|
-
expect(wrapper.emitted('update')).toBeDefined()
|
|
926
|
-
expect(wrapper.emitted('update').length).toEqual(3)
|
|
927
|
-
expect(wrapper.emitted('update')[2][0]).toEqual(123)
|
|
928
|
-
expect(typeof wrapper.emitted('update')[2][0]).toEqual('number')
|
|
929
|
-
expect(wrapper.emitted('input')).toBeDefined()
|
|
930
|
-
expect(wrapper.emitted('input').length).toEqual(4)
|
|
931
|
-
expect(wrapper.emitted('input')[3][0]).toEqual('0123 450')
|
|
932
|
-
expect(typeof wrapper.emitted('input')[3][0]).toEqual('string')
|
|
933
|
-
|
|
934
|
-
wrapper.destroy()
|
|
935
|
-
})
|
|
936
|
-
|
|
937
|
-
// These tests are wrapped in a new describe to limit
|
|
938
|
-
// the scope of the `getBoundingClientRect` mock
|
|
939
|
-
describe('prop `autofocus`', () => {
|
|
940
|
-
const origGetBCR = Element.prototype.getBoundingClientRect
|
|
941
|
-
|
|
942
|
-
beforeEach(() => {
|
|
943
|
-
// Mock `getBoundingClientRect` so that the `isVisible(el)` test returns `true`
|
|
944
|
-
// In our test below, all pagination buttons would normally be visible
|
|
945
|
-
Element.prototype.getBoundingClientRect = jest.fn(() => ({
|
|
946
|
-
width: 24,
|
|
947
|
-
height: 24,
|
|
948
|
-
top: 0,
|
|
949
|
-
left: 0,
|
|
950
|
-
bottom: 0,
|
|
951
|
-
right: 0
|
|
952
|
-
}))
|
|
953
|
-
})
|
|
954
|
-
|
|
955
|
-
afterEach(() => {
|
|
956
|
-
// Restore prototype
|
|
957
|
-
Element.prototype.getBoundingClientRect = origGetBCR
|
|
958
|
-
})
|
|
959
|
-
|
|
960
|
-
it('works when true', async () => {
|
|
961
|
-
const wrapper = mount(BFormTextarea, {
|
|
962
|
-
attachTo: document.body,
|
|
963
|
-
propsData: {
|
|
964
|
-
autofocus: true
|
|
965
|
-
}
|
|
966
|
-
})
|
|
967
|
-
|
|
968
|
-
expect(wrapper.vm).toBeDefined()
|
|
969
|
-
await waitNT(wrapper.vm)
|
|
970
|
-
await waitRAF()
|
|
971
|
-
|
|
972
|
-
const input = wrapper.find('textarea')
|
|
973
|
-
expect(input.exists()).toBe(true)
|
|
974
|
-
expect(document).toBeDefined()
|
|
975
|
-
expect(document.activeElement).toBe(input.element)
|
|
976
|
-
|
|
977
|
-
wrapper.destroy()
|
|
978
|
-
})
|
|
979
|
-
|
|
980
|
-
it('does not autofocus when false', async () => {
|
|
981
|
-
const wrapper = mount(BFormTextarea, {
|
|
982
|
-
attachTo: document.body,
|
|
983
|
-
propsData: {
|
|
984
|
-
autofocus: false
|
|
985
|
-
}
|
|
986
|
-
})
|
|
987
|
-
|
|
988
|
-
expect(wrapper.vm).toBeDefined()
|
|
989
|
-
await waitNT(wrapper.vm)
|
|
990
|
-
await waitRAF()
|
|
991
|
-
|
|
992
|
-
const input = wrapper.find('textarea')
|
|
993
|
-
expect(input.exists()).toBe(true)
|
|
994
|
-
expect(document).toBeDefined()
|
|
995
|
-
expect(document.activeElement).not.toBe(input.element)
|
|
996
|
-
|
|
997
|
-
wrapper.destroy()
|
|
998
|
-
})
|
|
999
|
-
})
|
|
1000
|
-
})
|