@gitlab/ui 94.6.0 → 94.7.0
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/CHANGELOG.md +19 -0
- package/dist/components/base/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/base/dropdown/dropdown.js +1 -1
- package/dist/components/base/dropdown/dropdown_item.js +1 -1
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +3 -3
- package/dist/components/base/new_dropdowns/listbox/listbox.js +4 -4
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +20 -1
- package/dist/tokens/build/js/tokens.js +20 -1
- package/dist/tokens/css/tokens.css +19 -0
- package/dist/tokens/css/tokens.dark.css +19 -0
- package/dist/tokens/js/tokens.dark.js +19 -0
- package/dist/tokens/js/tokens.js +19 -0
- package/dist/tokens/json/tokens.dark.json +457 -0
- package/dist/tokens/json/tokens.json +457 -0
- package/dist/tokens/scss/_tokens.dark.scss +19 -0
- package/dist/tokens/scss/_tokens.scss +19 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +19 -0
- package/dist/tokens/tailwind/tokens.cjs +2 -0
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -4
- package/dist/vendor/bootstrap-vue/src/constants/regex.js +1 -6
- package/dist/vendor/bootstrap-vue/src/index.js +0 -4
- package/dist/vendor/bootstrap-vue/src/utils/string.js +2 -8
- package/package.json +1 -1
- package/src/components/base/breadcrumb/breadcrumb.vue +2 -1
- package/src/components/base/dropdown/dropdown.scss +6 -9
- package/src/components/base/dropdown/dropdown.vue +1 -1
- package/src/components/base/dropdown/dropdown_divider.scss +1 -1
- package/src/components/base/dropdown/dropdown_item.scss +8 -12
- package/src/components/base/dropdown/dropdown_item.vue +1 -1
- package/src/components/base/dropdown/dropdown_section_header.scss +1 -1
- package/src/components/base/filtered_search/filtered_search_suggestion.scss +2 -2
- package/src/components/base/filtered_search/filtered_search_suggestion_list.scss +2 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.scss +1 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.vue +3 -3
- package/src/components/base/new_dropdowns/dropdown.scss +5 -5
- package/src/components/base/new_dropdowns/dropdown_item.scss +29 -12
- package/src/components/base/new_dropdowns/listbox/listbox.scss +2 -2
- package/src/components/base/new_dropdowns/listbox/listbox.vue +5 -5
- package/src/components/base/new_dropdowns/listbox/listbox_group.vue +1 -1
- package/src/tokens/build/css/tokens.css +19 -0
- package/src/tokens/build/css/tokens.dark.css +19 -0
- package/src/tokens/build/js/tokens.dark.js +19 -0
- package/src/tokens/build/js/tokens.js +19 -0
- package/src/tokens/build/json/tokens.dark.json +457 -0
- package/src/tokens/build/json/tokens.json +457 -0
- package/src/tokens/build/scss/_tokens.dark.scss +19 -0
- package/src/tokens/build/scss/_tokens.scss +19 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +19 -0
- package/src/tokens/build/tailwind/tokens.cjs +2 -0
- package/src/tokens/contextual/dropdown.tokens.json +148 -0
- package/src/vendor/bootstrap-vue/nuxt/index.js +1 -13
- package/src/vendor/bootstrap-vue/nuxt/plugin.template.js +0 -6
- package/src/vendor/bootstrap-vue/package.json +1 -4
- package/src/vendor/bootstrap-vue/src/_variables.scss +0 -14
- package/src/vendor/bootstrap-vue/src/components/breadcrumb/README.md +0 -1
- package/src/vendor/bootstrap-vue/src/components/input-group/README.md +1 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/README.md +1 -2
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -3
- package/src/vendor/bootstrap-vue/src/constants/regex.js +0 -5
- package/src/vendor/bootstrap-vue/src/index.d.ts +0 -3
- package/src/vendor/bootstrap-vue/src/index.js +0 -9
- package/src/vendor/bootstrap-vue/src/index.scss +0 -3
- package/src/vendor/bootstrap-vue/src/utils/string.js +1 -8
- package/src/vendor/bootstrap-vue/src/utils/string.spec.js +1 -11
- package/dist/vendor/bootstrap-vue/src/browser-icons.js +0 -8
- package/dist/vendor/bootstrap-vue/src/icons/helpers/icon-base.js +0 -139
- package/dist/vendor/bootstrap-vue/src/icons/helpers/make-icon.js +0 -56
- package/dist/vendor/bootstrap-vue/src/icons/icon.js +0 -56
- package/dist/vendor/bootstrap-vue/src/icons/icons.js +0 -1377
- package/dist/vendor/bootstrap-vue/src/icons/iconstack.js +0 -31
- package/dist/vendor/bootstrap-vue/src/icons/index.js +0 -4
- package/dist/vendor/bootstrap-vue/src/icons/plugin.js +0 -1410
- package/dist/vendor/bootstrap-vue/src/icons-only.js +0 -10
- package/src/vendor/bootstrap-vue/src/browser-icons.js +0 -9
- package/src/vendor/bootstrap-vue/src/icons/README.md +0 -874
- package/src/vendor/bootstrap-vue/src/icons/_icons.scss +0 -156
- package/src/vendor/bootstrap-vue/src/icons/helpers/icon-base.js +0 -134
- package/src/vendor/bootstrap-vue/src/icons/helpers/make-icon.js +0 -48
- package/src/vendor/bootstrap-vue/src/icons/icon.js +0 -54
- package/src/vendor/bootstrap-vue/src/icons/icons.d.ts +0 -2757
- package/src/vendor/bootstrap-vue/src/icons/icons.js +0 -8241
- package/src/vendor/bootstrap-vue/src/icons/icons.spec.js +0 -522
- package/src/vendor/bootstrap-vue/src/icons/iconstack.js +0 -31
- package/src/vendor/bootstrap-vue/src/icons/iconstack.spec.js +0 -161
- package/src/vendor/bootstrap-vue/src/icons/index.d.ts +0 -18
- package/src/vendor/bootstrap-vue/src/icons/index.js +0 -16
- package/src/vendor/bootstrap-vue/src/icons/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/icons/package.json +0 -72782
- package/src/vendor/bootstrap-vue/src/icons/plugin.js +0 -4159
- package/src/vendor/bootstrap-vue/src/icons-only.js +0 -33
- package/src/vendor/bootstrap-vue/src/icons.scss +0 -8
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { IconsPlugin } from './index'
|
|
3
|
-
import { BIcon } from './icon'
|
|
4
|
-
import { makeIcon } from './helpers/make-icon'
|
|
5
|
-
import { Vue } from '../vue'
|
|
6
|
-
|
|
7
|
-
Vue.use(IconsPlugin)
|
|
8
|
-
|
|
9
|
-
describe('icons', () => {
|
|
10
|
-
it('b-icon has expected structure', async () => {
|
|
11
|
-
const wrapper = mount(BIcon, {
|
|
12
|
-
propsData: {
|
|
13
|
-
icon: 'alarm-fill'
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
expect(wrapper.exists()).toBe(true)
|
|
18
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
19
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
20
|
-
expect(wrapper.classes()).toContain('bi')
|
|
21
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
22
|
-
expect(wrapper.classes().length).toBe(3)
|
|
23
|
-
expect(wrapper.attributes('role')).toBe('img')
|
|
24
|
-
expect(wrapper.attributes('aria-label')).toBe('alarm fill')
|
|
25
|
-
expect(wrapper.attributes('focusable')).toBe('false')
|
|
26
|
-
expect(wrapper.attributes('xmlns')).toBe('http://www.w3.org/2000/svg')
|
|
27
|
-
expect(wrapper.attributes('width')).toBe('1em')
|
|
28
|
-
expect(wrapper.attributes('height')).toBe('1em')
|
|
29
|
-
expect(wrapper.attributes('viewBox')).toBe('0 0 16 16')
|
|
30
|
-
expect(wrapper.attributes('fill')).toBe('currentColor')
|
|
31
|
-
expect(wrapper.attributes('style')).toBeUndefined()
|
|
32
|
-
expect(wrapper.element.style.fontSize).toEqual('')
|
|
33
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
34
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
35
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
36
|
-
|
|
37
|
-
wrapper.destroy()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('b-icon has expected structure when `stacked` prop is true', async () => {
|
|
41
|
-
const wrapper = mount(BIcon, {
|
|
42
|
-
propsData: {
|
|
43
|
-
icon: 'alarm-fill',
|
|
44
|
-
stacked: true
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
expect(wrapper.exists()).toBe(true)
|
|
49
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
50
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
51
|
-
expect(wrapper.classes()).toContain('bi')
|
|
52
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
53
|
-
expect(wrapper.classes().length).toBe(3)
|
|
54
|
-
expect(wrapper.attributes('role')).not.toBe('img')
|
|
55
|
-
expect(wrapper.attributes('aria-label')).not.toBe('icon')
|
|
56
|
-
expect(wrapper.attributes('focusable')).not.toBe('false')
|
|
57
|
-
expect(wrapper.attributes('focusable')).not.toBe('true')
|
|
58
|
-
expect(wrapper.attributes('xmlns')).not.toBe('http://www.w3.org/2000/svg')
|
|
59
|
-
expect(wrapper.attributes('width')).not.toBe('1em')
|
|
60
|
-
expect(wrapper.attributes('height')).not.toBe('1em')
|
|
61
|
-
expect(wrapper.attributes('viewBox')).toBe('0 0 16 16')
|
|
62
|
-
expect(wrapper.attributes('fill')).toBe('currentColor')
|
|
63
|
-
expect(wrapper.attributes('style')).toBeUndefined()
|
|
64
|
-
expect(wrapper.element.style.fontSize).toEqual('')
|
|
65
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
66
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
67
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(false)
|
|
68
|
-
expect(wrapper.find('svg > g > g > path').exists()).toBe(true)
|
|
69
|
-
|
|
70
|
-
wrapper.destroy()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('b-icon with empty icon name renders BIconBlank', async () => {
|
|
74
|
-
// This test assumes Vue doesn't puke on unknown component names
|
|
75
|
-
// As we don't specify a parent instance (which has all the registered
|
|
76
|
-
// components for the icons)
|
|
77
|
-
const wrapper = mount(BIcon, {
|
|
78
|
-
propsData: {
|
|
79
|
-
icon: ''
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
expect(wrapper.exists()).toBe(true)
|
|
84
|
-
expect(wrapper.text()).toBe('')
|
|
85
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
86
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
87
|
-
expect(wrapper.classes()).toContain('bi')
|
|
88
|
-
expect(wrapper.classes()).toContain('bi-blank')
|
|
89
|
-
expect(wrapper.classes().length).toBe(3)
|
|
90
|
-
expect(wrapper.find('svg > g').element).toBeEmptyDOMElement()
|
|
91
|
-
|
|
92
|
-
wrapper.destroy()
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it('b-icon without icon name renders BIconBlank', async () => {
|
|
96
|
-
// This test assumes Vue doesn't puke on unknown component names
|
|
97
|
-
// As we currently do not check the validity of icon names
|
|
98
|
-
const wrapper = mount(BIcon, {
|
|
99
|
-
propsData: {
|
|
100
|
-
icon: undefined
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
expect(wrapper.exists()).toBe(true)
|
|
105
|
-
expect(wrapper.text()).toBe('')
|
|
106
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
107
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
108
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
109
|
-
expect(wrapper.find('svg > g').element).toBeEmptyDOMElement()
|
|
110
|
-
|
|
111
|
-
wrapper.destroy()
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
it('b-icon with unknown icon name renders BIconBlank', async () => {
|
|
115
|
-
const wrapper = mount(BIcon, {
|
|
116
|
-
propsData: {
|
|
117
|
-
icon: 'unknown-icon-name'
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
expect(wrapper.exists()).toBe(true)
|
|
122
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
123
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
124
|
-
expect(wrapper.classes()).toContain('bi')
|
|
125
|
-
expect(wrapper.classes()).toContain('bi-blank')
|
|
126
|
-
expect(wrapper.classes().length).toBe(3)
|
|
127
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
128
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
129
|
-
expect(wrapper.find('svg > g').element).toBeEmptyDOMElement()
|
|
130
|
-
|
|
131
|
-
wrapper.destroy()
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
it('b-icon variant works', async () => {
|
|
135
|
-
const wrapper = mount(BIcon, {
|
|
136
|
-
propsData: {
|
|
137
|
-
icon: 'alarm-fill',
|
|
138
|
-
variant: 'danger'
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
expect(wrapper.exists()).toBe(true)
|
|
143
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
144
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
145
|
-
expect(wrapper.classes()).toContain('bi')
|
|
146
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
147
|
-
expect(wrapper.classes()).toContain('text-danger')
|
|
148
|
-
expect(wrapper.classes().length).toBe(4)
|
|
149
|
-
expect(wrapper.attributes('role')).toBe('img')
|
|
150
|
-
expect(wrapper.attributes('aria-label')).toBe('alarm fill')
|
|
151
|
-
expect(wrapper.attributes('focusable')).toBe('false')
|
|
152
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
153
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
154
|
-
expect(wrapper.find('path').exists()).toBe(true)
|
|
155
|
-
|
|
156
|
-
wrapper.destroy()
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
it('b-icon font-scale prop works', async () => {
|
|
160
|
-
const wrapper = mount(BIcon, {
|
|
161
|
-
propsData: {
|
|
162
|
-
icon: 'alarm-fill',
|
|
163
|
-
fontScale: '1.25'
|
|
164
|
-
}
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
expect(wrapper.exists()).toBe(true)
|
|
168
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
169
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
170
|
-
expect(wrapper.classes()).toContain('bi')
|
|
171
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
172
|
-
expect(wrapper.classes().length).toBe(3)
|
|
173
|
-
expect(wrapper.attributes('role')).toBe('img')
|
|
174
|
-
expect(wrapper.attributes('aria-label')).toBe('alarm fill')
|
|
175
|
-
expect(wrapper.attributes('focusable')).toBe('false')
|
|
176
|
-
expect(wrapper.attributes('style')).toBeDefined()
|
|
177
|
-
expect(wrapper.element.style.fontSize).toEqual('125%')
|
|
178
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
179
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
180
|
-
expect(wrapper.find('path').exists()).toBe(true)
|
|
181
|
-
|
|
182
|
-
wrapper.destroy()
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
it('b-icon with custom icon works', async () => {
|
|
186
|
-
const ParentComponent = {
|
|
187
|
-
name: 'ParentComponent',
|
|
188
|
-
components: {
|
|
189
|
-
// For testing user defined Icons
|
|
190
|
-
BIconFakeIconTest: makeIcon('FakeIconTest', '<path class="fake-path" />')
|
|
191
|
-
},
|
|
192
|
-
template: '<b-icon icon="fake-icon-test" />'
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const wrapper = mount(ParentComponent, {
|
|
196
|
-
propsData: {
|
|
197
|
-
icon: 'fake-icon-test'
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
expect(wrapper.exists()).toBe(true)
|
|
202
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
203
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
204
|
-
expect(wrapper.classes()).toContain('bi')
|
|
205
|
-
expect(wrapper.classes()).toContain('bi-fake-icon-test')
|
|
206
|
-
expect(wrapper.classes().length).toBe(3)
|
|
207
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
208
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeUndefined()
|
|
209
|
-
expect(wrapper.find('svg > g > path.fake-path').exists()).toBe(true)
|
|
210
|
-
|
|
211
|
-
wrapper.destroy()
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
it('b-icon rotate prop works', async () => {
|
|
215
|
-
const wrapper = mount(BIcon, {
|
|
216
|
-
propsData: {
|
|
217
|
-
icon: 'alarm-fill',
|
|
218
|
-
rotate: '45'
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
expect(wrapper.exists()).toBe(true)
|
|
223
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
224
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
225
|
-
expect(wrapper.classes()).toContain('bi')
|
|
226
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
227
|
-
expect(wrapper.classes().length).toBe(3)
|
|
228
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
229
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
230
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
231
|
-
'translate(8 8) rotate(45) translate(-8 -8)'
|
|
232
|
-
)
|
|
233
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
234
|
-
|
|
235
|
-
wrapper.destroy()
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
it('b-icon scale prop works', async () => {
|
|
239
|
-
const wrapper = mount(BIcon, {
|
|
240
|
-
propsData: {
|
|
241
|
-
icon: 'alarm-fill',
|
|
242
|
-
scale: '1.5'
|
|
243
|
-
}
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
expect(wrapper.exists()).toBe(true)
|
|
247
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
248
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
249
|
-
expect(wrapper.classes()).toContain('bi')
|
|
250
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
251
|
-
expect(wrapper.classes().length).toBe(3)
|
|
252
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
253
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
254
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
255
|
-
'translate(8 8) scale(1.5 1.5) translate(-8 -8)'
|
|
256
|
-
)
|
|
257
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
258
|
-
|
|
259
|
-
wrapper.destroy()
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
it('b-icon flip-h prop works', async () => {
|
|
263
|
-
const wrapper = mount(BIcon, {
|
|
264
|
-
propsData: {
|
|
265
|
-
icon: 'alarm-fill',
|
|
266
|
-
flipH: true
|
|
267
|
-
}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
expect(wrapper.exists()).toBe(true)
|
|
271
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
272
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
273
|
-
expect(wrapper.classes()).toContain('bi')
|
|
274
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
275
|
-
expect(wrapper.classes().length).toBe(3)
|
|
276
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
277
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
278
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
279
|
-
'translate(8 8) scale(-1 1) translate(-8 -8)'
|
|
280
|
-
)
|
|
281
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
282
|
-
|
|
283
|
-
wrapper.destroy()
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
it('b-icon flip-v prop works', async () => {
|
|
287
|
-
const wrapper = mount(BIcon, {
|
|
288
|
-
propsData: {
|
|
289
|
-
icon: 'alarm-fill',
|
|
290
|
-
flipV: true
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
expect(wrapper.exists()).toBe(true)
|
|
295
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
296
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
297
|
-
expect(wrapper.classes()).toContain('bi')
|
|
298
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
299
|
-
expect(wrapper.classes().length).toBe(3)
|
|
300
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
301
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
302
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
303
|
-
'translate(8 8) scale(1 -1) translate(-8 -8)'
|
|
304
|
-
)
|
|
305
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
306
|
-
|
|
307
|
-
wrapper.destroy()
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
it('b-icon flip-h prop works with flip-v prop', async () => {
|
|
311
|
-
const wrapper = mount(BIcon, {
|
|
312
|
-
propsData: {
|
|
313
|
-
icon: 'alarm-fill',
|
|
314
|
-
flipH: true,
|
|
315
|
-
flipV: true
|
|
316
|
-
}
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
expect(wrapper.exists()).toBe(true)
|
|
320
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
321
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
322
|
-
expect(wrapper.classes()).toContain('bi')
|
|
323
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
324
|
-
expect(wrapper.classes().length).toBe(3)
|
|
325
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
326
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
327
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
328
|
-
'translate(8 8) scale(-1 -1) translate(-8 -8)'
|
|
329
|
-
)
|
|
330
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
331
|
-
|
|
332
|
-
wrapper.destroy()
|
|
333
|
-
})
|
|
334
|
-
|
|
335
|
-
it('b-icon scale prop works with flip-h prop', async () => {
|
|
336
|
-
const wrapper = mount(BIcon, {
|
|
337
|
-
propsData: {
|
|
338
|
-
icon: 'alarm-fill',
|
|
339
|
-
scale: '1.5',
|
|
340
|
-
flipH: true
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
expect(wrapper.exists()).toBe(true)
|
|
345
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
346
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
347
|
-
expect(wrapper.classes()).toContain('bi')
|
|
348
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
349
|
-
expect(wrapper.classes().length).toBe(3)
|
|
350
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
351
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
352
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
353
|
-
'translate(8 8) scale(-1.5 1.5) translate(-8 -8)'
|
|
354
|
-
)
|
|
355
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
356
|
-
|
|
357
|
-
wrapper.destroy()
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
it('b-icon scale prop works with flip-v prop', async () => {
|
|
361
|
-
const wrapper = mount(BIcon, {
|
|
362
|
-
propsData: {
|
|
363
|
-
icon: 'alarm-fill',
|
|
364
|
-
scale: '1.5',
|
|
365
|
-
flipV: true
|
|
366
|
-
}
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
expect(wrapper.exists()).toBe(true)
|
|
370
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
371
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
372
|
-
expect(wrapper.classes()).toContain('bi')
|
|
373
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
374
|
-
expect(wrapper.classes().length).toBe(3)
|
|
375
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
376
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
377
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
378
|
-
'translate(8 8) scale(1.5 -1.5) translate(-8 -8)'
|
|
379
|
-
)
|
|
380
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
381
|
-
|
|
382
|
-
wrapper.destroy()
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
it('b-icon scale prop works with flip-h and flip-v prop', async () => {
|
|
386
|
-
const wrapper = mount(BIcon, {
|
|
387
|
-
propsData: {
|
|
388
|
-
icon: 'alarm-fill',
|
|
389
|
-
scale: '1.5',
|
|
390
|
-
flipH: true,
|
|
391
|
-
flipV: true
|
|
392
|
-
}
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
expect(wrapper.exists()).toBe(true)
|
|
396
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
397
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
398
|
-
expect(wrapper.classes()).toContain('bi')
|
|
399
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
400
|
-
expect(wrapper.classes().length).toBe(3)
|
|
401
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
402
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
403
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual(
|
|
404
|
-
'translate(8 8) scale(-1.5 -1.5) translate(-8 -8)'
|
|
405
|
-
)
|
|
406
|
-
expect(wrapper.find('svg > g > path').exists()).toBe(true)
|
|
407
|
-
|
|
408
|
-
wrapper.destroy()
|
|
409
|
-
})
|
|
410
|
-
|
|
411
|
-
it('b-icon shift-h and shift-v props work', async () => {
|
|
412
|
-
const wrapper = mount(BIcon, {
|
|
413
|
-
propsData: {
|
|
414
|
-
icon: 'alarm-fill',
|
|
415
|
-
shiftH: 8,
|
|
416
|
-
shiftV: 16
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
|
|
420
|
-
expect(wrapper.exists()).toBe(true)
|
|
421
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
422
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
423
|
-
expect(wrapper.classes()).toContain('bi')
|
|
424
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
425
|
-
expect(wrapper.classes().length).toBe(3)
|
|
426
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
427
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
428
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual('translate(8 -16)')
|
|
429
|
-
expect(wrapper.find('svg > g > g').exists()).toBe(true)
|
|
430
|
-
expect(wrapper.find('svg > g > g').attributes('transform')).toBeUndefined()
|
|
431
|
-
expect(wrapper.find('svg > g > g > path').exists()).toBe(true)
|
|
432
|
-
|
|
433
|
-
wrapper.destroy()
|
|
434
|
-
})
|
|
435
|
-
|
|
436
|
-
it('b-icon shift-h and shift-v props work with rotate prop', async () => {
|
|
437
|
-
const wrapper = mount(BIcon, {
|
|
438
|
-
propsData: {
|
|
439
|
-
icon: 'alarm-fill',
|
|
440
|
-
rotate: 45,
|
|
441
|
-
shiftH: 8,
|
|
442
|
-
shiftV: 16
|
|
443
|
-
}
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
expect(wrapper.exists()).toBe(true)
|
|
447
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
448
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
449
|
-
expect(wrapper.classes()).toContain('bi')
|
|
450
|
-
expect(wrapper.classes()).toContain('bi-alarm-fill')
|
|
451
|
-
expect(wrapper.classes().length).toBe(3)
|
|
452
|
-
expect(wrapper.find('svg > g').exists()).toBe(true)
|
|
453
|
-
expect(wrapper.find('svg > g').attributes('transform')).toBeDefined()
|
|
454
|
-
expect(wrapper.find('svg > g').attributes('transform')).toEqual('translate(8 -16)')
|
|
455
|
-
expect(wrapper.find('svg > g > g').exists()).toBe(true)
|
|
456
|
-
expect(wrapper.find('svg > g > g').attributes('transform')).toBeDefined()
|
|
457
|
-
expect(wrapper.find('svg > g > g').attributes('transform')).toEqual(
|
|
458
|
-
'translate(8 8) rotate(45) translate(-8 -8)'
|
|
459
|
-
)
|
|
460
|
-
expect(wrapper.find('svg > g > g > path').exists()).toBe(true)
|
|
461
|
-
|
|
462
|
-
wrapper.destroy()
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
it('b-icon animation prop works', async () => {
|
|
466
|
-
const wrapper = mount(BIcon, {
|
|
467
|
-
propsData: {
|
|
468
|
-
icon: 'circle-fill',
|
|
469
|
-
animation: 'spin'
|
|
470
|
-
}
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
expect(wrapper.exists()).toBe(true)
|
|
474
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
475
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
476
|
-
expect(wrapper.classes()).toContain('bi')
|
|
477
|
-
expect(wrapper.classes()).toContain('bi-circle-fill')
|
|
478
|
-
expect(wrapper.classes()).toContain('b-icon-animation-spin')
|
|
479
|
-
|
|
480
|
-
wrapper.destroy()
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
it('b-icon title prop works', async () => {
|
|
484
|
-
const wrapper = mount(BIcon, {
|
|
485
|
-
propsData: {
|
|
486
|
-
icon: 'circle-fill',
|
|
487
|
-
title: 'Circle'
|
|
488
|
-
}
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
expect(wrapper.exists()).toBe(true)
|
|
492
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
493
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
494
|
-
expect(wrapper.classes()).toContain('bi')
|
|
495
|
-
expect(wrapper.classes()).toContain('bi-circle-fill')
|
|
496
|
-
|
|
497
|
-
const $title = wrapper.find('title')
|
|
498
|
-
expect($title.exists()).toBe(true)
|
|
499
|
-
expect($title.text()).toBe('Circle')
|
|
500
|
-
|
|
501
|
-
wrapper.destroy()
|
|
502
|
-
})
|
|
503
|
-
|
|
504
|
-
it('b-icon <title> should not render when title is undefined', async () => {
|
|
505
|
-
const wrapper = mount(BIcon, {
|
|
506
|
-
propsData: {
|
|
507
|
-
icon: 'circle-fill'
|
|
508
|
-
}
|
|
509
|
-
})
|
|
510
|
-
|
|
511
|
-
expect(wrapper.exists()).toBe(true)
|
|
512
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
513
|
-
expect(wrapper.classes()).toContain('b-icon')
|
|
514
|
-
expect(wrapper.classes()).toContain('bi')
|
|
515
|
-
expect(wrapper.classes()).toContain('bi-circle-fill')
|
|
516
|
-
|
|
517
|
-
const $title = wrapper.find('title')
|
|
518
|
-
expect($title.exists()).toBe(false)
|
|
519
|
-
|
|
520
|
-
wrapper.destroy()
|
|
521
|
-
})
|
|
522
|
-
})
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { extend, mergeData } from '../vue'
|
|
2
|
-
import { NAME_ICONSTACK } from '../constants/components'
|
|
3
|
-
import { omit } from '../utils/object'
|
|
4
|
-
import { makePropsConfigurable } from '../utils/props'
|
|
5
|
-
import { BVIconBase, props as BVIconBaseProps } from './helpers/icon-base'
|
|
6
|
-
|
|
7
|
-
// --- Props ---
|
|
8
|
-
|
|
9
|
-
export const props = makePropsConfigurable(
|
|
10
|
-
omit(BVIconBaseProps, ['content', 'stacked']),
|
|
11
|
-
NAME_ICONSTACK
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
// --- Main component ---
|
|
15
|
-
|
|
16
|
-
// @vue/component
|
|
17
|
-
export const BIconstack = /*#__PURE__*/ extend({
|
|
18
|
-
name: NAME_ICONSTACK,
|
|
19
|
-
functional: true,
|
|
20
|
-
props,
|
|
21
|
-
render(h, { data, props, children }) {
|
|
22
|
-
return h(
|
|
23
|
-
BVIconBase,
|
|
24
|
-
mergeData(data, {
|
|
25
|
-
staticClass: 'b-iconstack',
|
|
26
|
-
props
|
|
27
|
-
}),
|
|
28
|
-
children
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
})
|