buefy 0.9.9 → 0.9.13
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 +1639 -1609
- package/dist/buefy.css +20 -2
- package/dist/buefy.esm.js +2227 -1869
- package/dist/buefy.esm.min.js +2 -2
- package/dist/buefy.js +2266 -1907
- package/dist/buefy.min.css +1 -1
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +6 -6
- package/dist/cjs/breadcrumb.js +127 -0
- package/dist/cjs/button.js +6 -107
- package/dist/cjs/carousel.js +9 -7
- package/dist/cjs/checkbox.js +5 -5
- package/dist/cjs/{chunk-d33a8a78.js → chunk-114191ae.js} +3 -3
- package/dist/cjs/{chunk-dafdb70c.js → chunk-2062216d.js} +39 -3
- package/dist/cjs/{chunk-64efc596.js → chunk-2911aa4b.js} +20 -16
- package/dist/cjs/{chunk-96ab31c1.js → chunk-2ae50815.js} +7 -7
- package/dist/cjs/{chunk-c3032504.js → chunk-2c7de785.js} +3 -3
- package/dist/cjs/{chunk-50ff3a78.js → chunk-30670fac.js} +96 -15
- package/dist/cjs/{chunk-e57b3891.js → chunk-34949503.js} +2 -2
- package/dist/cjs/{chunk-0abd2223.js → chunk-3b43d77a.js} +2 -2
- package/dist/cjs/{chunk-dcdbe2e8.js → chunk-3cc5d9a6.js} +1 -1
- package/dist/cjs/{chunk-0b57168e.js → chunk-61023b09.js} +3 -3
- package/dist/cjs/chunk-6cb902f8.js +314 -0
- package/dist/cjs/{chunk-adb01a93.js → chunk-7da0c017.js} +26 -24
- package/dist/cjs/{chunk-60255743.js → chunk-9103eeda.js} +4 -0
- package/dist/cjs/{chunk-14c82365.js → chunk-92621ff7.js} +37 -0
- package/dist/cjs/{chunk-816cba7a.js → chunk-9e4cf4c5.js} +1 -1
- package/dist/cjs/{chunk-33b9d1cf.js → chunk-a11294f9.js} +27 -26
- package/dist/cjs/{chunk-430b5370.js → chunk-bfcad370.js} +25 -2
- package/dist/cjs/{chunk-cc470e7c.js → chunk-c6fbc7b4.js} +7 -7
- package/dist/cjs/{chunk-993f89de.js → chunk-c7b2aa4b.js} +5 -4
- package/dist/cjs/{chunk-6474e963.js → chunk-d0f8ea39.js} +9 -9
- package/dist/cjs/{chunk-3acb500b.js → chunk-d120e215.js} +2 -2
- package/dist/cjs/{chunk-f5baaa70.js → chunk-d54e40f6.js} +2 -1
- package/dist/cjs/{chunk-916a2858.js → chunk-f5106717.js} +4 -4
- package/dist/cjs/chunk-fe2f57ee.js +110 -0
- package/dist/cjs/{chunk-2571dc7c.js → chunk-fefd7b77.js} +0 -0
- package/dist/cjs/clockpicker.js +11 -11
- package/dist/cjs/config.js +2 -2
- package/dist/cjs/datepicker.js +12 -12
- package/dist/cjs/datetimepicker.js +22 -15
- package/dist/cjs/dialog.js +13 -11
- package/dist/cjs/dropdown.js +8 -8
- package/dist/cjs/field.js +5 -5
- package/dist/cjs/helpers.js +2 -3
- package/dist/cjs/icon.js +3 -3
- package/dist/cjs/image.js +6 -311
- package/dist/cjs/index.js +29 -23
- package/dist/cjs/input.js +5 -5
- package/dist/cjs/loading.js +6 -6
- package/dist/cjs/menu.js +3 -3
- package/dist/cjs/message.js +6 -6
- package/dist/cjs/modal.js +6 -6
- package/dist/cjs/navbar.js +16 -4
- package/dist/cjs/notification.js +23 -11
- package/dist/cjs/numberinput.js +9 -7
- package/dist/cjs/pagination.js +8 -8
- package/dist/cjs/progress.js +10 -6
- package/dist/cjs/radio.js +3 -3
- package/dist/cjs/rate.js +3 -3
- package/dist/cjs/select.js +7 -7
- package/dist/cjs/sidebar.js +2 -2
- package/dist/cjs/slider.js +4 -4
- package/dist/cjs/snackbar.js +5 -5
- package/dist/cjs/steps.js +8 -8
- package/dist/cjs/switch.js +1 -1
- package/dist/cjs/table.js +13 -13
- package/dist/cjs/tabs.js +8 -8
- package/dist/cjs/tag.js +3 -3
- package/dist/cjs/taginput.js +34 -22
- package/dist/cjs/timepicker.js +13 -13
- package/dist/cjs/toast.js +5 -5
- package/dist/cjs/tooltip.js +5 -5
- package/dist/cjs/upload.js +5 -5
- package/dist/components/autocomplete/index.js +98 -13
- package/dist/components/autocomplete/index.min.js +2 -2
- package/dist/components/breadcrumb/index.js +293 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +5 -1
- package/dist/components/button/index.min.js +2 -2
- package/dist/components/carousel/index.js +348 -15
- package/dist/components/carousel/index.min.js +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.min.js +1 -1
- package/dist/components/clockpicker/index.js +54 -47
- package/dist/components/clockpicker/index.min.js +2 -2
- package/dist/components/collapse/index.js +1 -1
- package/dist/components/collapse/index.min.js +1 -1
- package/dist/components/datepicker/index.js +41 -32
- package/dist/components/datepicker/index.min.js +2 -2
- package/dist/components/datetimepicker/index.js +75 -58
- package/dist/components/datetimepicker/index.min.js +2 -2
- package/dist/components/dialog/index.js +126 -18
- package/dist/components/dialog/index.min.js +2 -2
- package/dist/components/dropdown/index.js +5 -1
- package/dist/components/dropdown/index.min.js +1 -1
- package/dist/components/field/index.js +29 -23
- package/dist/components/field/index.min.js +2 -2
- package/dist/components/icon/index.js +5 -1
- package/dist/components/icon/index.min.js +2 -2
- package/dist/components/image/index.js +463 -444
- package/dist/components/image/index.min.js +2 -2
- package/dist/components/input/index.js +5 -1
- package/dist/components/input/index.min.js +2 -2
- package/dist/components/loading/index.js +2 -2
- package/dist/components/loading/index.min.js +2 -2
- package/dist/components/menu/index.js +5 -1
- package/dist/components/menu/index.min.js +2 -2
- package/dist/components/message/index.js +43 -3
- package/dist/components/message/index.min.js +2 -2
- package/dist/components/modal/index.js +7 -2
- package/dist/components/modal/index.min.js +2 -2
- package/dist/components/navbar/index.js +16 -4
- package/dist/components/navbar/index.min.js +2 -2
- package/dist/components/notification/index.js +59 -6
- package/dist/components/notification/index.min.js +2 -2
- package/dist/components/numberinput/index.js +9 -3
- package/dist/components/numberinput/index.min.js +2 -2
- package/dist/components/pagination/index.js +5 -1
- package/dist/components/pagination/index.min.js +2 -2
- package/dist/components/progress/index.js +10 -2
- package/dist/components/progress/index.min.js +2 -2
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.min.js +1 -1
- package/dist/components/rate/index.js +5 -1
- package/dist/components/rate/index.min.js +2 -2
- package/dist/components/select/index.js +5 -1
- package/dist/components/select/index.min.js +2 -2
- package/dist/components/sidebar/index.js +5 -1
- package/dist/components/sidebar/index.min.js +1 -1
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/skeleton/index.min.js +1 -1
- package/dist/components/slider/index.js +5 -1
- package/dist/components/slider/index.min.js +2 -2
- package/dist/components/snackbar/index.js +7 -2
- package/dist/components/snackbar/index.min.js +2 -2
- package/dist/components/steps/index.js +5 -1
- package/dist/components/steps/index.min.js +2 -2
- package/dist/components/switch/index.js +5 -1
- package/dist/components/switch/index.min.js +1 -1
- package/dist/components/table/index.js +6 -2
- package/dist/components/table/index.min.js +2 -2
- package/dist/components/tabs/index.js +5 -1
- package/dist/components/tabs/index.min.js +2 -2
- package/dist/components/tag/index.js +26 -3
- package/dist/components/tag/index.min.js +2 -2
- package/dist/components/taginput/index.js +185 -29
- package/dist/components/taginput/index.min.js +2 -2
- package/dist/components/timepicker/index.js +54 -47
- package/dist/components/timepicker/index.min.js +2 -2
- package/dist/components/toast/index.js +7 -2
- package/dist/components/toast/index.min.js +2 -2
- package/dist/components/tooltip/index.js +5 -1
- package/dist/components/tooltip/index.min.js +1 -1
- package/dist/components/upload/index.js +5 -1
- package/dist/components/upload/index.min.js +2 -2
- package/dist/esm/autocomplete.js +7 -7
- package/dist/esm/breadcrumb.js +122 -0
- package/dist/esm/button.js +6 -107
- package/dist/esm/carousel.js +7 -5
- package/dist/esm/{chunk-56040896.js → chunk-18e8b067.js} +3 -3
- package/dist/esm/{chunk-fa404a2c.js → chunk-21fc0948.js} +7 -7
- package/dist/esm/{chunk-f9299099.js → chunk-22e9f916.js} +19 -15
- package/dist/esm/{chunk-1fafdf15.js → chunk-2452e3d3.js} +37 -1
- package/dist/esm/{chunk-1297c2c9.js → chunk-29ca0df8.js} +1 -1
- package/dist/esm/{chunk-3c2169d7.js → chunk-2f2f0a74.js} +25 -2
- package/dist/esm/{chunk-cf72ce36.js → chunk-3773c62d.js} +2 -2
- package/dist/esm/{chunk-2c957994.js → chunk-4b67a181.js} +3 -3
- package/dist/esm/{chunk-45740cdc.js → chunk-6019fd7a.js} +96 -15
- package/dist/esm/chunk-71a547bc.js +312 -0
- package/dist/esm/{chunk-516e4877.js → chunk-75a5af93.js} +1 -1
- package/dist/esm/{chunk-4e380ee2.js → chunk-799e084d.js} +2 -1
- package/dist/esm/{chunk-37678809.js → chunk-83eb0d37.js} +3 -3
- package/dist/esm/{chunk-34c74085.js → chunk-8d0f95b8.js} +4 -4
- package/dist/esm/{chunk-652f2dad.js → chunk-8ed29c41.js} +4 -0
- package/dist/esm/{chunk-742a9694.js → chunk-9f7f7441.js} +3 -2
- package/dist/esm/{chunk-f160efb9.js → chunk-ae8ab23a.js} +4 -4
- package/dist/esm/{chunk-c3b09672.js → chunk-b07e3182.js} +26 -24
- package/dist/esm/{chunk-e36a4f2c.js → chunk-b0c0c6b0.js} +0 -0
- package/dist/esm/{chunk-ee935ae6.js → chunk-c9c58d0c.js} +1 -1
- package/dist/esm/{chunk-1d62828e.js → chunk-d7f92d97.js} +39 -3
- package/dist/esm/{chunk-7fd02ffe.js → chunk-d92f0cd9.js} +2 -2
- package/dist/esm/chunk-e7c9b2cb.js +108 -0
- package/dist/esm/{chunk-0e22ae0a.js → chunk-ece062a7.js} +27 -26
- package/dist/esm/clockpicker.js +9 -9
- package/dist/esm/config.js +2 -2
- package/dist/esm/datepicker.js +11 -11
- package/dist/esm/datetimepicker.js +21 -14
- package/dist/esm/dialog.js +10 -8
- package/dist/esm/dropdown.js +5 -5
- package/dist/esm/field.js +4 -4
- package/dist/esm/helpers.js +2 -3
- package/dist/esm/icon.js +4 -4
- package/dist/esm/image.js +6 -311
- package/dist/esm/index.js +106 -100
- package/dist/esm/input.js +6 -6
- package/dist/esm/loading.js +4 -4
- package/dist/esm/menu.js +3 -3
- package/dist/esm/message.js +5 -5
- package/dist/esm/modal.js +4 -4
- package/dist/esm/navbar.js +16 -4
- package/dist/esm/notification.js +22 -10
- package/dist/esm/numberinput.js +9 -7
- package/dist/esm/pagination.js +5 -5
- package/dist/esm/progress.js +8 -4
- package/dist/esm/rate.js +3 -3
- package/dist/esm/select.js +6 -6
- package/dist/esm/sidebar.js +2 -2
- package/dist/esm/slider.js +3 -3
- package/dist/esm/snackbar.js +4 -4
- package/dist/esm/steps.js +6 -6
- package/dist/esm/switch.js +1 -1
- package/dist/esm/table.js +9 -9
- package/dist/esm/tabs.js +6 -6
- package/dist/esm/tag.js +2 -2
- package/dist/esm/taginput.js +33 -21
- package/dist/esm/timepicker.js +12 -12
- package/dist/esm/toast.js +4 -4
- package/dist/esm/tooltip.js +4 -4
- package/dist/esm/upload.js +3 -3
- package/dist/vetur/attributes.json +95 -19
- package/dist/vetur/tags.json +37 -4
- package/package.json +2 -2
- package/src/components/autocomplete/Autocomplete.spec.js +70 -0
- package/src/components/autocomplete/Autocomplete.vue +93 -18
- package/src/components/breadcrumb/Breadcrumb.spec.js +63 -0
- package/src/components/breadcrumb/Breadcrumb.vue +43 -0
- package/src/components/breadcrumb/BreadcrumbItem.spec.js +25 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +33 -0
- package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.js.snap +7 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +7 -0
- package/src/components/breadcrumb/index.js +20 -0
- package/src/components/carousel/CarouselList.vue +3 -1
- package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +128 -8
- package/src/components/clockpicker/Clockpicker.vue +259 -259
- package/src/components/datepicker/Datepicker.vue +10 -6
- package/src/components/datetimepicker/Datetimepicker.vue +8 -1
- package/src/components/dialog/Dialog.vue +10 -10
- package/src/components/field/Field.vue +271 -270
- package/src/components/image/Image.spec.js +197 -183
- package/src/components/image/Image.vue +4 -2
- package/src/components/index.js +2 -0
- package/src/components/loading/Loading.vue +1 -1
- package/src/components/loading/__snapshots__/Loading.spec.js.snap +1 -1
- package/src/components/message/Message.vue +7 -1
- package/src/components/message/__snapshots__/Message.spec.js.snap +1 -0
- package/src/components/modal/Modal.vue +2 -0
- package/src/components/navbar/Navbar.vue +5 -1
- package/src/components/navbar/NavbarBurger.vue +1 -0
- package/src/components/navbar/NavbarDropdown.vue +8 -2
- package/src/components/navbar/__snapshots__/NavBar.spec.js.snap +11 -11
- package/src/components/navbar/__snapshots__/NavBarBurger.spec.js.snap +3 -0
- package/src/components/navbar/__snapshots__/NavbarDropdown.spec.js.snap +1 -1
- package/src/components/notification/Notification.vue +6 -0
- package/src/components/notification/NotificationNotice.vue +16 -3
- package/src/components/notification/__snapshots__/Notification.spec.js.snap +1 -0
- package/src/components/numberinput/Numberinput.spec.js +10 -0
- package/src/components/numberinput/Numberinput.vue +4 -2
- package/src/components/progress/Progress.vue +6 -2
- package/src/components/snackbar/Snackbar.vue +2 -0
- package/src/components/tag/Tag.vue +25 -2
- package/src/components/tag/__snapshots__/Tag.spec.js.snap +1 -1
- package/src/components/taginput/Taginput.spec.js +57 -1
- package/src/components/taginput/Taginput.vue +373 -364
- package/src/components/toast/Toast.vue +1 -1
- package/src/index.js +2 -0
- package/src/scss/buefy.scss +1 -0
- package/src/scss/components/_loading.scss +2 -1
- package/src/scss/components/_message.scss +3 -0
- package/src/scss/components/_notification.scss +8 -0
- package/src/scss/components/_progress.scss +8 -0
- package/src/utils/MessageMixin.js +32 -1
- package/src/utils/NoticeMixin.js +1 -0
- package/src/utils/TimepickerMixin.js +718 -716
- package/src/utils/config.js +4 -0
- package/src/utils/helpers.js +1 -2
- package/types/components.d.ts +5 -0
- package/src/components/navbar/__snapshots__/NavbarBurger.spec.js.snap +0 -3
|
@@ -1,183 +1,197 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils'
|
|
2
|
-
import BImage from '@components/image/Image'
|
|
3
|
-
|
|
4
|
-
describe('BImage', () => {
|
|
5
|
-
const originalClientWidth = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'clientWidth')
|
|
6
|
-
const clientWidth = 500
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
Object.defineProperty(HTMLElement.prototype, 'clientWidth', { configurable: true, value: clientWidth })
|
|
9
|
-
})
|
|
10
|
-
afterAll(() => {
|
|
11
|
-
Object.defineProperty(HTMLElement.prototype, 'clientWidth', originalClientWidth)
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it('is called', () => {
|
|
15
|
-
const wrapper = shallowMount(BImage)
|
|
16
|
-
expect(wrapper.name()).toBe('BImage')
|
|
17
|
-
expect(wrapper.isVueInstance()).toBeTruthy()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('render correctly', () => {
|
|
21
|
-
const wrapper = shallowMount(BImage)
|
|
22
|
-
|
|
23
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('render placeholder correctly', () => {
|
|
27
|
-
const baseName = 'my-image-source'
|
|
28
|
-
const alt = 'Alt text'
|
|
29
|
-
const placeholder = `${baseName}.png`
|
|
30
|
-
const src = `${baseName}.webp`
|
|
31
|
-
const wrapper = shallowMount(BImage, {
|
|
32
|
-
propsData: {
|
|
33
|
-
alt,
|
|
34
|
-
placeholder,
|
|
35
|
-
src
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('compute the image src as expected', () => {
|
|
43
|
-
const baseName = 'my-image-source'
|
|
44
|
-
const src = `${baseName}.webp`
|
|
45
|
-
const wrapper = shallowMount(BImage, {
|
|
46
|
-
propsData: {
|
|
47
|
-
src
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
const vm = wrapper.vm
|
|
51
|
-
|
|
52
|
-
expect(vm.computedSrc).toBe(src)
|
|
53
|
-
|
|
54
|
-
let webpFallback = '.jpg'
|
|
55
|
-
wrapper.setProps({
|
|
56
|
-
webpFallback
|
|
57
|
-
})
|
|
58
|
-
expect(vm.computedSrc).toBe(`${baseName}${webpFallback}`)
|
|
59
|
-
|
|
60
|
-
webpFallback = 'a-complete-image-source.png'
|
|
61
|
-
wrapper.setProps({
|
|
62
|
-
webpFallback
|
|
63
|
-
})
|
|
64
|
-
expect(vm.computedSrc).toBe(webpFallback)
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('compute the placeholder src as expected', () => {
|
|
68
|
-
const baseName = 'my-image-source'
|
|
69
|
-
const placeholder = `${baseName}.webp`
|
|
70
|
-
const wrapper = shallowMount(BImage, {
|
|
71
|
-
propsData: {
|
|
72
|
-
placeholder
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
const vm = wrapper.vm
|
|
76
|
-
|
|
77
|
-
expect(vm.computedPlaceholder).toBe(placeholder)
|
|
78
|
-
|
|
79
|
-
let webpFallback = '.jpg'
|
|
80
|
-
wrapper.setProps({
|
|
81
|
-
webpFallback
|
|
82
|
-
})
|
|
83
|
-
expect(vm.computedPlaceholder).toBe(`${baseName}${webpFallback}`)
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
it('compute the srcset as expected', () => {
|
|
87
|
-
const baseName = 'my-image-source'
|
|
88
|
-
const ext = '.webp'
|
|
89
|
-
const src = `${baseName}${ext}`
|
|
90
|
-
let srcset = `${src} 100w, ${src} 500w`
|
|
91
|
-
const wrapper = shallowMount(BImage, {
|
|
92
|
-
propsData: {
|
|
93
|
-
src,
|
|
94
|
-
srcset
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
const vm = wrapper.vm
|
|
98
|
-
|
|
99
|
-
expect(vm.computedSrcset).toBe(srcset)
|
|
100
|
-
expect(vm.computedSizes).toBe(`${clientWidth}px`)
|
|
101
|
-
|
|
102
|
-
let webpFallback = '.jpg'
|
|
103
|
-
srcset = `${baseName}${webpFallback} 100w, ${baseName}${webpFallback} 500w`
|
|
104
|
-
wrapper.setProps({
|
|
105
|
-
webpFallback
|
|
106
|
-
})
|
|
107
|
-
expect(vm.computedSrcset).toBe(srcset)
|
|
108
|
-
|
|
109
|
-
srcset = `${baseName}-200${webpFallback} 200w,${baseName}-500${webpFallback} 500w`
|
|
110
|
-
wrapper.setProps({
|
|
111
|
-
srcset: null,
|
|
112
|
-
srcsetSizes: [200, 500]
|
|
113
|
-
})
|
|
114
|
-
expect(vm.computedSrcset).toBe(srcset)
|
|
115
|
-
|
|
116
|
-
srcset = `${baseName}${webpFallback}?s=200 200w,${baseName}${webpFallback}?s=500 500w`
|
|
117
|
-
wrapper.setProps({
|
|
118
|
-
srcsetFormatter: (src, size) => `${src}?s=${size}`
|
|
119
|
-
})
|
|
120
|
-
expect(vm.computedSrcset).toBe(srcset)
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('manage ratio as expected', () => {
|
|
124
|
-
const src = `my-image-source.webp`
|
|
125
|
-
let ratio = null
|
|
126
|
-
const wrapper = shallowMount(BImage, {
|
|
127
|
-
propsData: {
|
|
128
|
-
src
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
const vm = wrapper.vm
|
|
132
|
-
|
|
133
|
-
expect(vm.imgClasses['has-ratio']).toBeFalsy()
|
|
134
|
-
|
|
135
|
-
ratio = '16by9'
|
|
136
|
-
wrapper.setProps({
|
|
137
|
-
ratio
|
|
138
|
-
})
|
|
139
|
-
expect(vm.imgClasses['has-ratio']).toBeTruthy()
|
|
140
|
-
expect(vm.figureClasses[`is-${ratio}`]).toBeTruthy()
|
|
141
|
-
|
|
142
|
-
ratio = '16by8'
|
|
143
|
-
wrapper.setProps({
|
|
144
|
-
ratio
|
|
145
|
-
})
|
|
146
|
-
expect(vm.imgClasses['has-ratio']).toBeTruthy()
|
|
147
|
-
expect(vm.figureStyles['paddingTop']).toBe(`${8 / 16 * 100}%`)
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
it('
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const wrapper = shallowMount(BImage
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import BImage from '@components/image/Image'
|
|
3
|
+
|
|
4
|
+
describe('BImage', () => {
|
|
5
|
+
const originalClientWidth = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'clientWidth')
|
|
6
|
+
const clientWidth = 500
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
Object.defineProperty(HTMLElement.prototype, 'clientWidth', { configurable: true, value: clientWidth })
|
|
9
|
+
})
|
|
10
|
+
afterAll(() => {
|
|
11
|
+
Object.defineProperty(HTMLElement.prototype, 'clientWidth', originalClientWidth)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('is called', () => {
|
|
15
|
+
const wrapper = shallowMount(BImage)
|
|
16
|
+
expect(wrapper.name()).toBe('BImage')
|
|
17
|
+
expect(wrapper.isVueInstance()).toBeTruthy()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('render correctly', () => {
|
|
21
|
+
const wrapper = shallowMount(BImage)
|
|
22
|
+
|
|
23
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('render placeholder correctly', () => {
|
|
27
|
+
const baseName = 'my-image-source'
|
|
28
|
+
const alt = 'Alt text'
|
|
29
|
+
const placeholder = `${baseName}.png`
|
|
30
|
+
const src = `${baseName}.webp`
|
|
31
|
+
const wrapper = shallowMount(BImage, {
|
|
32
|
+
propsData: {
|
|
33
|
+
alt,
|
|
34
|
+
placeholder,
|
|
35
|
+
src
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('compute the image src as expected', () => {
|
|
43
|
+
const baseName = 'my-image-source'
|
|
44
|
+
const src = `${baseName}.webp`
|
|
45
|
+
const wrapper = shallowMount(BImage, {
|
|
46
|
+
propsData: {
|
|
47
|
+
src
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
const vm = wrapper.vm
|
|
51
|
+
|
|
52
|
+
expect(vm.computedSrc).toBe(src)
|
|
53
|
+
|
|
54
|
+
let webpFallback = '.jpg'
|
|
55
|
+
wrapper.setProps({
|
|
56
|
+
webpFallback
|
|
57
|
+
})
|
|
58
|
+
expect(vm.computedSrc).toBe(`${baseName}${webpFallback}`)
|
|
59
|
+
|
|
60
|
+
webpFallback = 'a-complete-image-source.png'
|
|
61
|
+
wrapper.setProps({
|
|
62
|
+
webpFallback
|
|
63
|
+
})
|
|
64
|
+
expect(vm.computedSrc).toBe(webpFallback)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('compute the placeholder src as expected', () => {
|
|
68
|
+
const baseName = 'my-image-source'
|
|
69
|
+
const placeholder = `${baseName}.webp`
|
|
70
|
+
const wrapper = shallowMount(BImage, {
|
|
71
|
+
propsData: {
|
|
72
|
+
placeholder
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
const vm = wrapper.vm
|
|
76
|
+
|
|
77
|
+
expect(vm.computedPlaceholder).toBe(placeholder)
|
|
78
|
+
|
|
79
|
+
let webpFallback = '.jpg'
|
|
80
|
+
wrapper.setProps({
|
|
81
|
+
webpFallback
|
|
82
|
+
})
|
|
83
|
+
expect(vm.computedPlaceholder).toBe(`${baseName}${webpFallback}`)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('compute the srcset as expected', () => {
|
|
87
|
+
const baseName = 'my-image-source'
|
|
88
|
+
const ext = '.webp'
|
|
89
|
+
const src = `${baseName}${ext}`
|
|
90
|
+
let srcset = `${src} 100w, ${src} 500w`
|
|
91
|
+
const wrapper = shallowMount(BImage, {
|
|
92
|
+
propsData: {
|
|
93
|
+
src,
|
|
94
|
+
srcset
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
const vm = wrapper.vm
|
|
98
|
+
|
|
99
|
+
expect(vm.computedSrcset).toBe(srcset)
|
|
100
|
+
expect(vm.computedSizes).toBe(`${clientWidth}px`)
|
|
101
|
+
|
|
102
|
+
let webpFallback = '.jpg'
|
|
103
|
+
srcset = `${baseName}${webpFallback} 100w, ${baseName}${webpFallback} 500w`
|
|
104
|
+
wrapper.setProps({
|
|
105
|
+
webpFallback
|
|
106
|
+
})
|
|
107
|
+
expect(vm.computedSrcset).toBe(srcset)
|
|
108
|
+
|
|
109
|
+
srcset = `${baseName}-200${webpFallback} 200w,${baseName}-500${webpFallback} 500w`
|
|
110
|
+
wrapper.setProps({
|
|
111
|
+
srcset: null,
|
|
112
|
+
srcsetSizes: [200, 500]
|
|
113
|
+
})
|
|
114
|
+
expect(vm.computedSrcset).toBe(srcset)
|
|
115
|
+
|
|
116
|
+
srcset = `${baseName}${webpFallback}?s=200 200w,${baseName}${webpFallback}?s=500 500w`
|
|
117
|
+
wrapper.setProps({
|
|
118
|
+
srcsetFormatter: (src, size) => `${src}?s=${size}`
|
|
119
|
+
})
|
|
120
|
+
expect(vm.computedSrcset).toBe(srcset)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('manage ratio as expected', () => {
|
|
124
|
+
const src = `my-image-source.webp`
|
|
125
|
+
let ratio = null
|
|
126
|
+
const wrapper = shallowMount(BImage, {
|
|
127
|
+
propsData: {
|
|
128
|
+
src
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
const vm = wrapper.vm
|
|
132
|
+
|
|
133
|
+
expect(vm.imgClasses['has-ratio']).toBeFalsy()
|
|
134
|
+
|
|
135
|
+
ratio = '16by9'
|
|
136
|
+
wrapper.setProps({
|
|
137
|
+
ratio
|
|
138
|
+
})
|
|
139
|
+
expect(vm.imgClasses['has-ratio']).toBeTruthy()
|
|
140
|
+
expect(vm.figureClasses[`is-${ratio}`]).toBeTruthy()
|
|
141
|
+
|
|
142
|
+
ratio = '16by8'
|
|
143
|
+
wrapper.setProps({
|
|
144
|
+
ratio
|
|
145
|
+
})
|
|
146
|
+
expect(vm.imgClasses['has-ratio']).toBeTruthy()
|
|
147
|
+
expect(vm.figureStyles['paddingTop']).toBe(`${8 / 16 * 100}%`)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('adds custom class to image as expected', () => {
|
|
151
|
+
const src = `my-image-source.webp`
|
|
152
|
+
let customClass = 'my-custom-class'
|
|
153
|
+
const wrapper = shallowMount(BImage, {
|
|
154
|
+
propsData: {
|
|
155
|
+
src,
|
|
156
|
+
customClass
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
const vm = wrapper.vm
|
|
160
|
+
|
|
161
|
+
expect(vm.imgClasses['my-custom-class']).toBeTruthy()
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
it('reset events before destroy', () => {
|
|
165
|
+
window.removeEventListener = jest.fn()
|
|
166
|
+
|
|
167
|
+
const wrapper = shallowMount(BImage)
|
|
168
|
+
wrapper.destroy()
|
|
169
|
+
|
|
170
|
+
expect(window.removeEventListener).toBeCalledWith('resize', expect.any(Function))
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
describe('has caption', () => {
|
|
174
|
+
it('as last element', () => {
|
|
175
|
+
const wrapper = shallowMount(BImage, {
|
|
176
|
+
slots: {
|
|
177
|
+
caption: ['<div>This is a caption</div>']
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it('as first element', () => {
|
|
185
|
+
const wrapper = shallowMount(BImage, {
|
|
186
|
+
slots: {
|
|
187
|
+
caption: ['<div>This is a caption</div>']
|
|
188
|
+
},
|
|
189
|
+
propsData: {
|
|
190
|
+
captionFirst: true
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
})
|
|
@@ -94,7 +94,8 @@ export default {
|
|
|
94
94
|
captionFirst: {
|
|
95
95
|
type: Boolean,
|
|
96
96
|
default: false
|
|
97
|
-
}
|
|
97
|
+
},
|
|
98
|
+
customClass: String
|
|
98
99
|
},
|
|
99
100
|
data() {
|
|
100
101
|
return {
|
|
@@ -137,7 +138,8 @@ export default {
|
|
|
137
138
|
imgClasses() {
|
|
138
139
|
return {
|
|
139
140
|
'is-rounded': this.rounded,
|
|
140
|
-
'has-ratio': this.hasRatio
|
|
141
|
+
'has-ratio': this.hasRatio,
|
|
142
|
+
[this.customClass]: !!this.customClass
|
|
141
143
|
}
|
|
142
144
|
},
|
|
143
145
|
srcExt() {
|
package/src/components/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Autocomplete from './autocomplete'
|
|
2
|
+
import Breadcrumb from './breadcrumb'
|
|
2
3
|
import Button from './button'
|
|
3
4
|
import Carousel from './carousel'
|
|
4
5
|
import Checkbox from './checkbox'
|
|
@@ -41,6 +42,7 @@ import Upload from './upload'
|
|
|
41
42
|
|
|
42
43
|
export {
|
|
43
44
|
Autocomplete,
|
|
45
|
+
Breadcrumb,
|
|
44
46
|
Button,
|
|
45
47
|
Carousel,
|
|
46
48
|
Checkbox,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`BLoading active render correctly 1`] = `
|
|
4
4
|
<transition-stub name="fade">
|
|
5
|
-
<div class="loading-overlay is-active is-full-page">
|
|
5
|
+
<div class="loading-overlay is-active is-full-page" style="">
|
|
6
6
|
<div class="loading-background"></div>
|
|
7
7
|
<div class="loading-icon"></div>
|
|
8
8
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition name="fade">
|
|
3
3
|
<article
|
|
4
|
-
v-
|
|
4
|
+
v-show="isActive"
|
|
5
5
|
class="message"
|
|
6
6
|
:class="[type, size]">
|
|
7
7
|
<header v-if="$slots.header || title" class="message-header">
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
</section>
|
|
35
|
+
<b-progress
|
|
36
|
+
v-if="autoClose && progressBar"
|
|
37
|
+
:value="remainingTime - 1"
|
|
38
|
+
:max="duration / 1000 - 1"
|
|
39
|
+
:type="type"
|
|
40
|
+
:rounded="false"/>
|
|
35
41
|
</article>
|
|
36
42
|
</transition>
|
|
37
43
|
</template>
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
v-if="showX"
|
|
41
41
|
v-show="!animating"
|
|
42
42
|
class="modal-close is-large"
|
|
43
|
+
:aria-label="closeButtonAriaLabel"
|
|
43
44
|
@click="cancel('x')"/>
|
|
44
45
|
</div>
|
|
45
46
|
</div>
|
|
@@ -131,6 +132,7 @@ export default {
|
|
|
131
132
|
return Boolean(value)
|
|
132
133
|
}
|
|
133
134
|
},
|
|
135
|
+
closeButtonAriaLabel: String,
|
|
134
136
|
destroyOnHide: {
|
|
135
137
|
type: Boolean,
|
|
136
138
|
default: true
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
}"
|
|
18
18
|
v-bind="$attrs"
|
|
19
19
|
v-on="$listeners"
|
|
20
|
-
role="menuitem"
|
|
21
20
|
aria-haspopup="true"
|
|
22
|
-
@click.prevent="
|
|
21
|
+
@click.prevent="toggleMenu"
|
|
22
|
+
@keyup.enter="toggleMenu"
|
|
23
|
+
tabindex="0"
|
|
24
|
+
>
|
|
23
25
|
<template v-if="label">{{ label }}</template>
|
|
24
26
|
<slot v-else name="label" />
|
|
25
27
|
</component>
|
|
@@ -44,6 +46,7 @@ export default {
|
|
|
44
46
|
directives: {
|
|
45
47
|
clickOutside
|
|
46
48
|
},
|
|
49
|
+
inheritAttrs: false,
|
|
47
50
|
props: {
|
|
48
51
|
label: String,
|
|
49
52
|
hoverable: Boolean,
|
|
@@ -74,6 +77,9 @@ export default {
|
|
|
74
77
|
}
|
|
75
78
|
},
|
|
76
79
|
methods: {
|
|
80
|
+
toggleMenu() {
|
|
81
|
+
this.newActive = !this.newActive
|
|
82
|
+
},
|
|
77
83
|
showMenu() {
|
|
78
84
|
this.newActive = true
|
|
79
85
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`BNavbar render correctly 1`] = `
|
|
4
|
-
<nav role="navigation" aria-label="main navigation" class="navbar">
|
|
5
|
-
<div class="navbar-brand"><a role="button" aria-label="menu" class="navbar-burger burger"><span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span></a></div>
|
|
6
|
-
<div class="navbar-menu">
|
|
7
|
-
<div class="navbar-start"></div>
|
|
8
|
-
<div class="navbar-end"></div>
|
|
9
|
-
</div>
|
|
10
|
-
</nav>
|
|
11
|
-
`;
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`BNavbar render correctly 1`] = `
|
|
4
|
+
<nav role="navigation" aria-label="main navigation" class="navbar">
|
|
5
|
+
<div class="navbar-brand"><a role="button" aria-label="menu" tabindex="0" class="navbar-burger burger"><span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span></a></div>
|
|
6
|
+
<div class="navbar-menu">
|
|
7
|
+
<div class="navbar-start"></div>
|
|
8
|
+
<div class="navbar-end"></div>
|
|
9
|
+
</div>
|
|
10
|
+
</nav>
|
|
11
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`BNavbarDropdown render correctly 1`] = `
|
|
4
|
-
<div class="navbar-item has-dropdown"><a
|
|
4
|
+
<div class="navbar-item has-dropdown"><a aria-haspopup="true" tabindex="0" class="navbar-link"></a>
|
|
5
5
|
<div class="navbar-dropdown"></div>
|
|
6
6
|
</div>
|
|
7
7
|
`;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
v-bind="$options.propsData"
|
|
4
4
|
ref="notification"
|
|
5
5
|
@click="click"
|
|
6
|
-
@close="close"
|
|
6
|
+
@close="close"
|
|
7
|
+
@mouseenter.native="pause"
|
|
8
|
+
@mouseleave.native="removePause">
|
|
7
9
|
<slot />
|
|
8
10
|
</b-notification>
|
|
9
11
|
</template>
|
|
@@ -11,6 +13,7 @@
|
|
|
11
13
|
<script>
|
|
12
14
|
import config from '../../utils/config'
|
|
13
15
|
import NoticeMixin from '../../utils/NoticeMixin.js'
|
|
16
|
+
import { removeElement } from '../../utils/helpers'
|
|
14
17
|
|
|
15
18
|
export default {
|
|
16
19
|
name: 'BNotificationNotice',
|
|
@@ -21,8 +24,18 @@ export default {
|
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
methods: {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
close() {
|
|
28
|
+
if (!this.isPaused) {
|
|
29
|
+
clearTimeout(this.timer)
|
|
30
|
+
this.$refs.notification.isActive = false
|
|
31
|
+
this.$emit('close')
|
|
32
|
+
|
|
33
|
+
// Timeout for the animation complete before destroying
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
this.$destroy()
|
|
36
|
+
removeElement(this.$el)
|
|
37
|
+
}, 150)
|
|
38
|
+
}
|
|
26
39
|
}
|
|
27
40
|
}
|
|
28
41
|
}
|
|
@@ -91,6 +91,16 @@ describe('BNumberinput', () => {
|
|
|
91
91
|
|
|
92
92
|
expect(wrapper.vm.computedValue).toBe(val)
|
|
93
93
|
})
|
|
94
|
+
|
|
95
|
+
it('increments/decrements after manually set value on input', async () => {
|
|
96
|
+
wrapper.setProps({exponential: true, value: 1, step: 1})
|
|
97
|
+
const BASE_VALUE = Math.floor(Math.random() * 10 + 1)
|
|
98
|
+
wrapper.find('input').setValue(BASE_VALUE)
|
|
99
|
+
wrapper.find('.control.plus button').trigger('click')
|
|
100
|
+
wrapper.find('.control.minus button').trigger('click')
|
|
101
|
+
|
|
102
|
+
expect(wrapper.vm.computedValue).toEqual(BASE_VALUE)
|
|
103
|
+
})
|
|
94
104
|
})
|
|
95
105
|
|
|
96
106
|
describe('Rendered (shallow)', () => {
|