@dimailn/vuetify 2.7.2-alpha21 → 2.7.2-alpha22

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.
Files changed (67) hide show
  1. package/dist/vuetify.js +89 -40
  2. package/dist/vuetify.js.map +1 -1
  3. package/dist/vuetify.min.css +1 -1
  4. package/dist/vuetify.min.js +2 -2
  5. package/es5/components/VOverlay/VOverlay.js +2 -3
  6. package/es5/components/VOverlay/VOverlay.js.map +1 -1
  7. package/es5/components/VProgressCircular/VProgressCircular.js +5 -3
  8. package/es5/components/VProgressCircular/VProgressCircular.js.map +1 -1
  9. package/es5/components/VProgressLinear/VProgressLinear.js +41 -19
  10. package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
  11. package/es5/components/VTabs/VTabsBar.js.map +1 -1
  12. package/es5/components/VVirtualScroll/VVirtualScroll.js +15 -16
  13. package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  14. package/es5/components/VWindow/VWindow.js +13 -5
  15. package/es5/components/VWindow/VWindow.js.map +1 -1
  16. package/es5/components/VWindow/VWindowItem.js +9 -5
  17. package/es5/components/VWindow/VWindowItem.js.map +1 -1
  18. package/es5/framework.js +1 -1
  19. package/es5/mixins/overlayable/index.js.map +1 -1
  20. package/lib/components/VOverlay/VOverlay.js +1 -2
  21. package/lib/components/VOverlay/VOverlay.js.map +1 -1
  22. package/lib/components/VProgressCircular/VProgressCircular.js +5 -3
  23. package/lib/components/VProgressCircular/VProgressCircular.js.map +1 -1
  24. package/lib/components/VProgressLinear/VProgressLinear.js +35 -17
  25. package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
  26. package/lib/components/VTabs/VTabsBar.js.map +1 -1
  27. package/lib/components/VVirtualScroll/VVirtualScroll.js +8 -11
  28. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  29. package/lib/components/VWindow/VWindow.js +7 -3
  30. package/lib/components/VWindow/VWindow.js.map +1 -1
  31. package/lib/components/VWindow/VWindowItem.js +3 -1
  32. package/lib/components/VWindow/VWindowItem.js.map +1 -1
  33. package/lib/framework.js +1 -1
  34. package/lib/mixins/overlayable/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/VAvatar/__tests__/VAvatar.spec.ts +72 -10
  37. package/src/components/VOverlay/VOverlay.ts +1 -1
  38. package/src/components/VOverlay/__tests__/VOverlay.spec.ts +6 -6
  39. package/src/components/VProgressCircular/VProgressCircular.ts +6 -5
  40. package/src/components/VProgressCircular/__tests__/VProgressCircular.spec.ts +28 -21
  41. package/src/components/VProgressCircular/__tests__/__snapshots__/VProgressCircular.spec.ts.snap +62 -62
  42. package/src/components/VProgressLinear/VProgressLinear.ts +42 -22
  43. package/src/components/VProgressLinear/__tests__/VProgressLinear.spec.ts +378 -71
  44. package/src/components/VProgressLinear/__tests__/__snapshots__/VProgressLinear.spec.ts.snap +53 -79
  45. package/src/components/VSheet/__tests__/VSheet.spec.ts +5 -5
  46. package/src/components/VTabs/VTabsBar.ts +7 -5
  47. package/src/components/VVirtualScroll/VVirtualScroll.ts +14 -13
  48. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +26 -19
  49. package/src/components/VWindow/VWindow.ts +9 -5
  50. package/src/components/VWindow/VWindowItem.ts +3 -1
  51. package/src/components/VWindow/__tests__/VWindow.spec.ts +226 -185
  52. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +162 -132
  53. package/src/mixins/applicationable/__tests__/applicationable.spec.ts +31 -27
  54. package/src/mixins/colorable/__tests__/colorable.spec.ts +9 -6
  55. package/src/mixins/elevatable/__tests__/elevatable.spec.ts +14 -13
  56. package/src/mixins/intersectable/__tests__/intersectable.spec.ts +35 -29
  57. package/src/mixins/menuable/__tests__/menuable.spec.ts +76 -33
  58. package/src/mixins/mobile/__tests__/mobile.spec.ts +9 -6
  59. package/src/mixins/overlayable/__tests__/overlayable.spec.ts +32 -24
  60. package/src/mixins/overlayable/index.ts +1 -1
  61. package/src/mixins/proxyable/__tests__/proxyable.spec.ts +18 -17
  62. package/src/mixins/registrable/__tests__/registrable.spec.ts +31 -0
  63. package/src/mixins/rippleable/__tests__/rippleable.spec.ts +10 -9
  64. package/src/mixins/roundable/__tests__/roundable.spec.ts +7 -5
  65. package/src/mixins/routable/__tests__/routable.spec.ts +60 -52
  66. package/src/mixins/scrollable/__tests__/scrollable.spec.ts +56 -27
  67. package/src/mixins/selectable/__tests__/selectable.spec.ts +22 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/mixins/overlayable/index.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,QAAP,MAAqB,2BAArB,C,CAEA;;AACA,SACE,QADF,EAEE,oBAFF,EAGE,uBAHF,EAIE,SAJF,EAKE,YALF,QAMO,oBANP,C,CAQA;;AACA,SAAQ,eAAR,EAA8B,SAA9B,EAAyC,CAAzC,QAAiD,KAAjD;AAkBA;;AACA,eAAe,eAAe,CAAC;AAC7B,EAAA,IAAI,EAAE,aADuB;AAG7B,EAAA,KAAK,EAAE;AACL,IAAA,WAAW,EAAE,OADR;AAEL,IAAA,YAAY,EAAE,MAFT;AAGL,IAAA,cAAc,EAAE,CAAC,MAAD,EAAS,MAAT;AAHX,GAHsB;;AAS7B,EAAA,IAAI,GAAA;AACF,WAAO;AACL,MAAA,cAAc,EAAE,CADX;AAEL,MAAA,OAAO,EAAE;AAFJ,KAAP;AAID,GAd4B;;AAgB7B,EAAA,KAAK,EAAE;AACL,IAAA,WAAW,CAAE,KAAF,EAAO;AAChB,UAAI,CAAC,KAAK,QAAV,EAAoB;AAEpB,UAAI,KAAJ,EAAW,KAAK,aAAL,GAAX,KACK,KAAK,UAAL;AACN;;AANI,GAhBsB;;AAyB7B,EAAA,aAAa,GAAA;AACX,SAAK,aAAL;AACD,GA3B4B;;AA6B7B,EAAA,OAAO,EAAE;AACP,IAAA,aAAa,GAAA;AACX;AACA,YAAM,SAAS,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAlB;AA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,OAFD,MAEO;AACL,QAAA,uBAAuB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAK,cAAvB,EAAuC;AAAE,UAAA,OAAO,EAAE;AAAX,SAAvC,CAAvB;AACA,QAAA,MAAM,CAAC,gBAAP,CAAwB,SAAxB,EAAmC,KAAK,cAAxC;AACD;AACF,KAnMM;;AAoMP,IAAA,UAAU,GAAA;AACR,MAAA,QAAQ,CAAC,eAAT,CAA0B,SAA1B,CAAoC,MAApC,CAA2C,mBAA3C;AACA,MAAA,MAAM,CAAC,mBAAP,CAA2B,OAA3B,EAAoC,KAAK,cAAzC;AACA,MAAA,MAAM,CAAC,mBAAP,CAA2B,SAA3B,EAAsC,KAAK,cAA3C;AACD;;AAxMM;AA7BoB,CAAD,CAA9B","sourcesContent":["// Components\nimport VOverlay from '../../components/VOverlay'\n\n// Utilities\nimport {\n keyCodes,\n addOnceEventListener,\n addPassiveEventListener,\n getZIndex,\n composedPath,\n} from '../../util/helpers'\n\n// Types\nimport {defineComponent, App, createApp, h} from 'vue'\n\ninterface Toggleable extends App {\n isActive?: boolean\n}\n\ninterface Stackable extends App {\n activeZIndex: number\n}\n\ninterface options {\n absolute?: boolean\n $refs: {\n dialog?: HTMLElement\n content?: HTMLElement\n }\n}\n\n/* @vue/component */\nexport default defineComponent({\n name: 'overlayable',\n\n props: {\n hideOverlay: Boolean,\n overlayColor: String,\n overlayOpacity: [Number, String],\n },\n\n data () {\n return {\n animationFrame: 0,\n overlay: null as InstanceType<typeof VOverlay> | null,\n }\n },\n\n watch: {\n hideOverlay (value) {\n if (!this.isActive) return\n\n if (value) this.removeOverlay()\n else this.genOverlay()\n },\n },\n\n beforeUnmount () {\n this.removeOverlay()\n },\n\n methods: {\n createOverlay () {\n // Create a container element\n const container = document.createElement('div');\n\n const props = {\n absolute: this.absolute,\n color: this.overlayColor,\n opacity: this.overlayOpacity\n }\n const wrapper = {\n data() {\n return { value: false, zIndex: undefined }\n },\n render() {\n return h(VOverlay, {\n modelValue: this.value,\n zIndex: this.zIndex,\n ...props\n })\n }\n }\n // // Create the overlay app\n // const overlayApp = createApp(VOverlay, {\n // absolute: this.absolute,\n // value: false,\n // color: this.overlayColor,\n // opacity: this.overlayOpacity,\n // });\n\n const overlayApp = createApp(wrapper)\n\n // Mount the app to the container\n const overlayInstance = overlayApp.mount(container);\n\n // Determine the parent element\n const parent = this.absolute\n ? this.$el.parentNode\n : document.querySelector('[data-app]');\n\n if (parent) {\n parent.insertBefore(container, parent.firstChild);\n }\n\n this.overlay = overlayInstance;\n this.overlayApp = overlayApp\n },\n genOverlay () {\n this.hideScroll()\n\n if (this.hideOverlay) return\n\n if (!this.overlay) this.createOverlay()\n\n this.animationFrame = requestAnimationFrame(() => {\n if (!this.overlay) return\n\n if (this.activeZIndex !== undefined) {\n this.overlay.zIndex = String(this.activeZIndex - 1)\n } else if (this.$el) {\n this.overlay.zIndex = getZIndex(this.$el)\n }\n\n this.overlay.value = true\n })\n\n return true\n },\n /** removeOverlay(false) will not restore the scollbar afterwards */\n removeOverlay (showScroll = true) {\n if (this.overlay) {\n addOnceEventListener(this.overlay.$el, 'transitionend', () => {\n if (\n !this.overlay ||\n !this.overlay.$el ||\n !this.overlay.$el.parentNode ||\n this.overlay.value ||\n this.isActive\n ) return\n\n this.overlay.$el.parentNode.removeChild(this.overlay.$el)\n this.overlayApp.unmount()\n this.overlayApp = null\n this.overlay = null\n })\n\n // Cancel animation frame in case\n // overlay is removed before it\n // has finished its animation\n cancelAnimationFrame(this.animationFrame)\n\n this.overlay.value = false\n }\n\n showScroll && this.showScroll()\n },\n scrollListener (e: WheelEvent | KeyboardEvent) {\n if ('key' in e) {\n if (\n ['INPUT', 'TEXTAREA', 'SELECT'].includes((e.target as Element).tagName) ||\n // https://github.com/vuetifyjs/vuetify/issues/4715\n (e.target as HTMLElement).isContentEditable\n ) return\n\n const up = [keyCodes.up, keyCodes.pageup]\n const down = [keyCodes.down, keyCodes.pagedown]\n\n if (up.includes(e.keyCode)) {\n (e as any).deltaY = -1\n } else if (down.includes(e.keyCode)) {\n (e as any).deltaY = 1\n } else {\n return\n }\n }\n\n if (e.target === this.overlay ||\n (e.type !== 'keydown' && e.target === document.body) ||\n this.checkPath(e as WheelEvent)) e.preventDefault()\n },\n hasScrollbar (el?: Element) {\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return false\n\n const style = window.getComputedStyle(el)\n return ((['auto', 'scroll'].includes(style.overflowY!) || el.tagName === 'SELECT') && el.scrollHeight > el.clientHeight) ||\n ((['auto', 'scroll'].includes(style.overflowX!)) && el.scrollWidth > el.clientWidth)\n },\n shouldScroll (el: Element, e: WheelEvent): boolean {\n if (el.hasAttribute('data-app')) return false\n\n const dir = e.shiftKey || e.deltaX ? 'x' : 'y'\n const delta = dir === 'y' ? e.deltaY : e.deltaX || e.deltaY\n\n let alreadyAtStart: boolean\n let alreadyAtEnd: boolean\n if (dir === 'y') {\n alreadyAtStart = el.scrollTop === 0\n alreadyAtEnd = el.scrollTop + el.clientHeight === el.scrollHeight\n } else {\n alreadyAtStart = el.scrollLeft === 0\n alreadyAtEnd = el.scrollLeft + el.clientWidth === el.scrollWidth\n }\n\n const scrollingUp = delta < 0\n const scrollingDown = delta > 0\n\n if (!alreadyAtStart && scrollingUp) return true\n if (!alreadyAtEnd && scrollingDown) return true\n if ((alreadyAtStart || alreadyAtEnd) && el.parentNode) {\n return this.shouldScroll(el.parentNode as Element, e)\n }\n\n return false\n },\n isInside (el: Element, parent: Element): boolean {\n if (el === parent) {\n return true\n } else if (el === null || el === document.body) {\n return false\n } else {\n return this.isInside(el.parentNode as Element, parent)\n }\n },\n checkPath (e: WheelEvent) {\n const path = composedPath(e)\n\n if (e.type === 'keydown' && path[0] === document.body) {\n const dialog = this.$refs.dialog\n // getSelection returns null in firefox in some edge cases, can be ignored\n const selected = window.getSelection()!.anchorNode as Element\n if (dialog && this.hasScrollbar(dialog) && this.isInside(selected, dialog)) {\n return !this.shouldScroll(dialog, e)\n }\n return true\n }\n\n for (let index = 0; index < path.length; index++) {\n const el = path[index]\n\n if (el === document) return true\n if (el === document.documentElement) return true\n if (el === this.$refs.content) return true\n\n if (this.hasScrollbar(el as Element)) return !this.shouldScroll(el as Element, e)\n }\n\n return true\n },\n hideScroll () {\n if (this.$vuetify.breakpoint.smAndDown) {\n document.documentElement!.classList.add('overflow-y-hidden')\n } else {\n addPassiveEventListener(window, 'wheel', this.scrollListener, { passive: false })\n window.addEventListener('keydown', this.scrollListener)\n }\n },\n showScroll () {\n document.documentElement!.classList.remove('overflow-y-hidden')\n window.removeEventListener('wheel', this.scrollListener)\n window.removeEventListener('keydown', this.scrollListener)\n },\n },\n})\n"],"sourceRoot":"","file":"index.js"}
1
+ {"version":3,"sources":["../../../src/mixins/overlayable/index.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,QAAP,MAAqB,2BAArB,C,CAEA;;AACA,SACE,QADF,EAEE,oBAFF,EAGE,uBAHF,EAIE,SAJF,EAKE,YALF,QAMO,oBANP,C,CAQA;;AACA,SAAS,eAAT,EAA+B,SAA/B,EAA0C,CAA1C,QAAmD,KAAnD;AAkBA;;AACA,eAAe,eAAe,CAAC;AAC7B,EAAA,IAAI,EAAE,aADuB;AAG7B,EAAA,KAAK,EAAE;AACL,IAAA,WAAW,EAAE,OADR;AAEL,IAAA,YAAY,EAAE,MAFT;AAGL,IAAA,cAAc,EAAE,CAAC,MAAD,EAAS,MAAT;AAHX,GAHsB;;AAS7B,EAAA,IAAI,GAAA;AACF,WAAO;AACL,MAAA,cAAc,EAAE,CADX;AAEL,MAAA,OAAO,EAAE;AAFJ,KAAP;AAID,GAd4B;;AAgB7B,EAAA,KAAK,EAAE;AACL,IAAA,WAAW,CAAE,KAAF,EAAO;AAChB,UAAI,CAAC,KAAK,QAAV,EAAoB;AAEpB,UAAI,KAAJ,EAAW,KAAK,aAAL,GAAX,KACK,KAAK,UAAL;AACN;;AANI,GAhBsB;;AAyB7B,EAAA,aAAa,GAAA;AACX,SAAK,aAAL;AACD,GA3B4B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AAK,QAAL,CAAc,UAAd,CAAyB,SAA7B,EAAwC;AACtC,QAAA,QAAQ,CAAC,eAAT,CAA0B,SAA1B,CAAoC,GAApC,CAAwC,mBAAxC;AACD,OAFD,MAEO;AACL,QAAA,uBAAuB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAK,cAAvB,EAAuC;AAAE,UAAA,OAAO,EAAE;AAAX,SAAvC,CAAvB;AACA,QAAA,MAAM,CAAC,gBAAP,CAAwB,SAAxB,EAAmC,KAAK,cAAxC;AACD;AACF,KAnMM;;AAoMP,IAAA,UAAU,GAAA;AACR,MAAA,QAAQ,CAAC,eAAT,CAA0B,SAA1B,CAAoC,MAApC,CAA2C,mBAA3C;AACA,MAAA,MAAM,CAAC,mBAAP,CAA2B,OAA3B,EAAoC,KAAK,cAAzC;AACA,MAAA,MAAM,CAAC,mBAAP,CAA2B,SAA3B,EAAsC,KAAK,cAA3C;AACD;;AAxMM;AA7BoB,CAAD,CAA9B","sourcesContent":["// Components\nimport VOverlay from '../../components/VOverlay'\n\n// Utilities\nimport {\n keyCodes,\n addOnceEventListener,\n addPassiveEventListener,\n getZIndex,\n composedPath,\n} from '../../util/helpers'\n\n// Types\nimport { defineComponent, App, createApp, h } from 'vue'\n\ninterface Toggleable extends App {\n isActive?: boolean\n}\n\ninterface Stackable extends App {\n activeZIndex: number\n}\n\ninterface options {\n absolute?: boolean\n $refs: {\n dialog?: HTMLElement\n content?: HTMLElement\n }\n}\n\n/* @vue/component */\nexport default defineComponent({\n name: 'overlayable',\n\n props: {\n hideOverlay: Boolean,\n overlayColor: String,\n overlayOpacity: [Number, String],\n },\n\n data () {\n return {\n animationFrame: 0,\n overlay: null as InstanceType<typeof VOverlay> | null,\n }\n },\n\n watch: {\n hideOverlay (value) {\n if (!this.isActive) return\n\n if (value) this.removeOverlay()\n else this.genOverlay()\n },\n },\n\n beforeUnmount () {\n this.removeOverlay()\n },\n\n methods: {\n createOverlay () {\n // Create a container element\n const container = document.createElement('div');\n\n const props = {\n absolute: this.absolute,\n color: this.overlayColor,\n opacity: this.overlayOpacity\n }\n const wrapper = {\n data() {\n return { value: false, zIndex: undefined }\n },\n render() {\n return h(VOverlay, {\n modelValue: this.value,\n zIndex: this.zIndex,\n ...props\n })\n }\n }\n // // Create the overlay app\n // const overlayApp = createApp(VOverlay, {\n // absolute: this.absolute,\n // value: false,\n // color: this.overlayColor,\n // opacity: this.overlayOpacity,\n // });\n\n const overlayApp = createApp(wrapper)\n\n // Mount the app to the container\n const overlayInstance = overlayApp.mount(container);\n\n // Determine the parent element\n const parent = this.absolute\n ? this.$el.parentNode\n : document.querySelector('[data-app]');\n\n if (parent) {\n parent.insertBefore(container, parent.firstChild);\n }\n\n this.overlay = overlayInstance;\n this.overlayApp = overlayApp\n },\n genOverlay () {\n this.hideScroll()\n\n if (this.hideOverlay) return\n\n if (!this.overlay) this.createOverlay()\n\n this.animationFrame = requestAnimationFrame(() => {\n if (!this.overlay) return\n\n if (this.activeZIndex !== undefined) {\n this.overlay.zIndex = String(this.activeZIndex - 1)\n } else if (this.$el) {\n this.overlay.zIndex = getZIndex(this.$el)\n }\n\n this.overlay.value = true\n })\n\n return true\n },\n /** removeOverlay(false) will not restore the scollbar afterwards */\n removeOverlay (showScroll = true) {\n if (this.overlay) {\n addOnceEventListener(this.overlay.$el, 'transitionend', () => {\n if (\n !this.overlay ||\n !this.overlay.$el ||\n !this.overlay.$el.parentNode ||\n this.overlay.value ||\n this.isActive\n ) return\n\n this.overlay.$el.parentNode.removeChild(this.overlay.$el)\n this.overlayApp.unmount()\n this.overlayApp = null\n this.overlay = null\n })\n\n // Cancel animation frame in case\n // overlay is removed before it\n // has finished its animation\n cancelAnimationFrame(this.animationFrame)\n\n this.overlay.value = false\n }\n\n showScroll && this.showScroll()\n },\n scrollListener (e: WheelEvent | KeyboardEvent) {\n if ('key' in e) {\n if (\n ['INPUT', 'TEXTAREA', 'SELECT'].includes((e.target as Element).tagName) ||\n // https://github.com/vuetifyjs/vuetify/issues/4715\n (e.target as HTMLElement).isContentEditable\n ) return\n\n const up = [keyCodes.up, keyCodes.pageup]\n const down = [keyCodes.down, keyCodes.pagedown]\n\n if (up.includes(e.keyCode)) {\n (e as any).deltaY = -1\n } else if (down.includes(e.keyCode)) {\n (e as any).deltaY = 1\n } else {\n return\n }\n }\n\n if (e.target === this.overlay ||\n (e.type !== 'keydown' && e.target === document.body) ||\n this.checkPath(e as WheelEvent)) e.preventDefault()\n },\n hasScrollbar (el?: Element) {\n if (!el || el.nodeType !== Node.ELEMENT_NODE) return false\n\n const style = window.getComputedStyle(el)\n return ((['auto', 'scroll'].includes(style.overflowY!) || el.tagName === 'SELECT') && el.scrollHeight > el.clientHeight) ||\n ((['auto', 'scroll'].includes(style.overflowX!)) && el.scrollWidth > el.clientWidth)\n },\n shouldScroll (el: Element, e: WheelEvent): boolean {\n if (el.hasAttribute('data-app')) return false\n\n const dir = e.shiftKey || e.deltaX ? 'x' : 'y'\n const delta = dir === 'y' ? e.deltaY : e.deltaX || e.deltaY\n\n let alreadyAtStart: boolean\n let alreadyAtEnd: boolean\n if (dir === 'y') {\n alreadyAtStart = el.scrollTop === 0\n alreadyAtEnd = el.scrollTop + el.clientHeight === el.scrollHeight\n } else {\n alreadyAtStart = el.scrollLeft === 0\n alreadyAtEnd = el.scrollLeft + el.clientWidth === el.scrollWidth\n }\n\n const scrollingUp = delta < 0\n const scrollingDown = delta > 0\n\n if (!alreadyAtStart && scrollingUp) return true\n if (!alreadyAtEnd && scrollingDown) return true\n if ((alreadyAtStart || alreadyAtEnd) && el.parentNode) {\n return this.shouldScroll(el.parentNode as Element, e)\n }\n\n return false\n },\n isInside (el: Element, parent: Element): boolean {\n if (el === parent) {\n return true\n } else if (el === null || el === document.body) {\n return false\n } else {\n return this.isInside(el.parentNode as Element, parent)\n }\n },\n checkPath (e: WheelEvent) {\n const path = composedPath(e)\n\n if (e.type === 'keydown' && path[0] === document.body) {\n const dialog = this.$refs.dialog\n // getSelection returns null in firefox in some edge cases, can be ignored\n const selected = window.getSelection()!.anchorNode as Element\n if (dialog && this.hasScrollbar(dialog) && this.isInside(selected, dialog)) {\n return !this.shouldScroll(dialog, e)\n }\n return true\n }\n\n for (let index = 0; index < path.length; index++) {\n const el = path[index]\n\n if (el === document) return true\n if (el === document.documentElement) return true\n if (el === this.$refs.content) return true\n\n if (this.hasScrollbar(el as Element)) return !this.shouldScroll(el as Element, e)\n }\n\n return true\n },\n hideScroll () {\n if (this.$vuetify.breakpoint.smAndDown) {\n document.documentElement!.classList.add('overflow-y-hidden')\n } else {\n addPassiveEventListener(window, 'wheel', this.scrollListener, { passive: false })\n window.addEventListener('keydown', this.scrollListener)\n }\n },\n showScroll () {\n document.documentElement!.classList.remove('overflow-y-hidden')\n window.removeEventListener('wheel', this.scrollListener)\n window.removeEventListener('keydown', this.scrollListener)\n },\n },\n})\n"],"sourceRoot":"","file":"index.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dimailn/vuetify",
3
3
  "description": "Vue Material Component Framework",
4
- "version": "2.7.2-alpha21",
4
+ "version": "2.7.2-alpha22",
5
5
  "author": {
6
6
  "name": "John Leider",
7
7
  "email": "john@vuetifyjs.com"
@@ -1,28 +1,49 @@
1
1
  // Libraries
2
- import Vue from 'vue'
2
+ import { h } from 'vue'
3
3
 
4
4
  // Components
5
5
  import VAvatar from '../VAvatar'
6
6
 
7
7
  // Utilities
8
8
  import {
9
- createLocalVue,
10
9
  mount,
11
- Wrapper,
10
+ MountingOptions,
11
+ VueWrapper,
12
12
  } from '@vue/test-utils'
13
13
 
14
14
  describe('VAvatar', () => {
15
- let mountFunction: (options?: object) => Wrapper<Vue>
16
- let localVue: typeof Vue
15
+ type Instance = InstanceType<typeof VAvatar>
16
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
17
17
 
18
18
  beforeEach(() => {
19
- localVue = createLocalVue()
19
+ mountFunction = (options?: MountingOptions<Instance>) => {
20
+ const defaultOptions = {
21
+ global: {
22
+ mocks: {
23
+ // Мокаем только необходимые свойства Vuetify
24
+ $vuetify: {
25
+ lang: {
26
+ t: (val: string) => val,
27
+ },
28
+ icons: {
29
+ component: 'mdi',
30
+ },
31
+ },
32
+ },
33
+ },
34
+ }
20
35
 
21
- mountFunction = (options = {}) => {
22
- return mount(VAvatar, {
23
- localVue,
36
+ // Объединяем опции правильно
37
+ const mergedOptions = {
38
+ ...defaultOptions,
24
39
  ...options,
25
- })
40
+ global: {
41
+ ...defaultOptions.global,
42
+ ...options?.global,
43
+ },
44
+ }
45
+
46
+ return mount(VAvatar, mergedOptions)
26
47
  }
27
48
  })
28
49
 
@@ -32,4 +53,45 @@ describe('VAvatar', () => {
32
53
  expect(wrapper.classes()).toContain('v-avatar')
33
54
  expect(wrapper.html()).toMatchSnapshot()
34
55
  })
56
+
57
+ it('should render with custom size', () => {
58
+ const wrapper = mountFunction({
59
+ props: {
60
+ size: 64,
61
+ },
62
+ })
63
+
64
+ expect(wrapper.attributes('style')).toContain('width: 64px')
65
+ expect(wrapper.attributes('style')).toContain('height: 64px')
66
+ })
67
+
68
+ it('should render with left class when left prop is true', () => {
69
+ const wrapper = mountFunction({
70
+ props: {
71
+ left: true,
72
+ },
73
+ })
74
+
75
+ expect(wrapper.classes()).toContain('v-avatar--left')
76
+ })
77
+
78
+ it('should render with right class when right prop is true', () => {
79
+ const wrapper = mountFunction({
80
+ props: {
81
+ right: true,
82
+ },
83
+ })
84
+
85
+ expect(wrapper.classes()).toContain('v-avatar--right')
86
+ })
87
+
88
+ it('should render slot content', () => {
89
+ const wrapper = mountFunction({
90
+ slots: {
91
+ default: () => [h('span', 'Avatar Content')],
92
+ },
93
+ })
94
+
95
+ expect(wrapper.text()).toContain('Avatar Content')
96
+ })
35
97
  })
@@ -87,7 +87,7 @@ export default mixins(
87
87
  if (this.isActive) children.push(this.genContent())
88
88
 
89
89
  return h('div', {
90
- on: this.$listeners,
90
+ ...this.$attrs,
91
91
  class: ['v-overlay', this.classes],
92
92
  style: this.styles,
93
93
  }, children)
@@ -4,12 +4,12 @@ import VOverlay from '../VOverlay'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
8
  } from '@vue/test-utils'
9
9
 
10
10
  describe('VOverlay.ts', () => {
11
11
  type Instance = InstanceType<typeof VOverlay>
12
- let mountFunction: (options?: object) => Wrapper<Instance>
12
+ let mountFunction: (options?: object) => VueWrapper<Instance>
13
13
 
14
14
  beforeEach(() => {
15
15
  mountFunction = (options = {}) => {
@@ -21,18 +21,18 @@ describe('VOverlay.ts', () => {
21
21
 
22
22
  it('should have a conditional opacity', async () => {
23
23
  const wrapper = mountFunction({
24
- propsData: { value: false },
24
+ props: { modelValue: false },
25
25
  })
26
26
 
27
27
  expect(wrapper.vm.computedOpacity).toBe(0)
28
28
 
29
- wrapper.setProps({ value: true })
29
+ await wrapper.setProps({ modelValue: true })
30
30
  expect(wrapper.vm.computedOpacity).toBe(0.46)
31
31
 
32
- wrapper.setProps({ opacity: 0.55 })
32
+ await wrapper.setProps({ opacity: 0.55 })
33
33
  expect(wrapper.vm.computedOpacity).toBe(0.55)
34
34
 
35
- wrapper.setProps({ value: false })
35
+ await wrapper.setProps({ modelValue: false })
36
36
  expect(wrapper.vm.computedOpacity).toBe(0)
37
37
  })
38
38
  })
@@ -12,7 +12,7 @@ import Colorable from '../../mixins/colorable'
12
12
  import { convertToUnit, getSlot } from '../../util/helpers'
13
13
 
14
14
  // Types
15
- import { VNode, VNodeChildren, defineComponent } from 'vue'
15
+ import { VNode, VNodeChild, defineComponent } from 'vue'
16
16
 
17
17
  /* @vue/component */
18
18
  export default defineComponent({
@@ -66,15 +66,16 @@ export default defineComponent({
66
66
  },
67
67
 
68
68
  normalizedValue (): number {
69
- if (this.value < 0) {
69
+ const numValue = parseFloat(this.value)
70
+ if (numValue < 0) {
70
71
  return 0
71
72
  }
72
73
 
73
- if (this.value > 100) {
74
+ if (numValue > 100) {
74
75
  return 100
75
76
  }
76
77
 
77
- return parseFloat(this.value)
78
+ return numValue
78
79
  },
79
80
 
80
81
  strokeDashArray (): number {
@@ -124,7 +125,7 @@ export default defineComponent({
124
125
  const children = [
125
126
  this.indeterminate || this.genCircle('underlay', 0),
126
127
  this.genCircle('overlay', this.strokeDashOffset),
127
- ] as VNodeChildren
128
+ ] as VNodeChild[]
128
129
 
129
130
  return h('svg', {
130
131
  style: this.svgStyles,
@@ -4,12 +4,15 @@ import VProgressCircular from '../VProgressCircular'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
+ enableAutoUnmount,
8
9
  } from '@vue/test-utils'
9
10
 
10
11
  describe('VProgressCircular.ts', () => {
11
12
  type Instance = InstanceType<typeof VProgressCircular>
12
- let mountFunction: (options?: object) => Wrapper<Instance>
13
+ let mountFunction: (options?: Record<string, any>) => VueWrapper<Instance>
14
+
15
+ enableAutoUnmount(afterEach)
13
16
 
14
17
  beforeEach(() => {
15
18
  mountFunction = (options = {}) => {
@@ -17,12 +20,12 @@ describe('VProgressCircular.ts', () => {
17
20
  }
18
21
  })
19
22
 
20
- it('should render component and match snapshot', () => {
23
+ it('should render component and match snapshot', async () => {
21
24
  const wrapper = mountFunction({
22
25
  data: () => ({
23
26
  isVisible: false,
24
27
  }),
25
- propsData: {
28
+ props: {
26
29
  value: 33,
27
30
  },
28
31
  slots: {
@@ -32,32 +35,32 @@ describe('VProgressCircular.ts', () => {
32
35
 
33
36
  expect(wrapper.html()).toMatchSnapshot()
34
37
 
35
- wrapper.setProps({ value: -1 })
38
+ await wrapper.setProps({ value: -1 })
36
39
  const htmlMinus1 = wrapper.html()
37
40
 
38
- wrapper.setProps({ value: 0 })
41
+ await wrapper.setProps({ value: 0 })
39
42
  const html0 = wrapper.html()
40
43
 
41
- wrapper.setProps({ value: 100 })
44
+ await wrapper.setProps({ value: 100 })
42
45
  const html100 = wrapper.html()
43
46
 
44
- wrapper.setProps({ value: 101 })
47
+ await wrapper.setProps({ value: 101 })
45
48
  const html101 = wrapper.html()
46
49
 
47
50
  expect(htmlMinus1).toBe(html0)
48
51
  expect(html100).toBe(html101)
49
52
  expect(html0).not.toBe(html100)
50
53
 
51
- wrapper.setProps({ value: '-1' })
54
+ await wrapper.setProps({ value: '-1' })
52
55
  const htmlMinus1String = wrapper.html()
53
56
 
54
- wrapper.setProps({ value: '0' })
57
+ await wrapper.setProps({ value: '0' })
55
58
  const html0String = wrapper.html()
56
59
 
57
- wrapper.setProps({ value: '100' })
60
+ await wrapper.setProps({ value: '100' })
58
61
  const html100String = wrapper.html()
59
62
 
60
- wrapper.setProps({ value: '101' })
63
+ await wrapper.setProps({ value: '101' })
61
64
  const html101String = wrapper.html()
62
65
 
63
66
  expect(htmlMinus1String).toBe(html0String)
@@ -67,7 +70,7 @@ describe('VProgressCircular.ts', () => {
67
70
 
68
71
  it('should render component with color prop and match snapshot', () => {
69
72
  const wrapper = mountFunction({
70
- propsData: {
73
+ props: {
71
74
  value: 33,
72
75
  color: 'orange lighten-1',
73
76
  },
@@ -78,7 +81,7 @@ describe('VProgressCircular.ts', () => {
78
81
 
79
82
  it('should render component with button prop and match snapshot', () => {
80
83
  const wrapper = mountFunction({
81
- propsData: {
84
+ props: {
82
85
  value: 33,
83
86
  button: true,
84
87
  },
@@ -89,7 +92,7 @@ describe('VProgressCircular.ts', () => {
89
92
 
90
93
  it('should render component with rotate prop and match snapshot', () => {
91
94
  const wrapper = mountFunction({
92
- propsData: {
95
+ props: {
93
96
  value: 33,
94
97
  rotate: 29,
95
98
  },
@@ -100,7 +103,7 @@ describe('VProgressCircular.ts', () => {
100
103
 
101
104
  it('should render component with size prop and match snapshot', () => {
102
105
  const wrapper = mountFunction({
103
- propsData: {
106
+ props: {
104
107
  value: 33,
105
108
  size: 17,
106
109
  },
@@ -111,7 +114,7 @@ describe('VProgressCircular.ts', () => {
111
114
 
112
115
  it('should render component with indeterminate prop and match snapshot', () => {
113
116
  const wrapper = mountFunction({
114
- propsData: {
117
+ props: {
115
118
  indeterminate: true,
116
119
  },
117
120
  })
@@ -121,7 +124,7 @@ describe('VProgressCircular.ts', () => {
121
124
 
122
125
  it('should render component with width prop and match snapshot', () => {
123
126
  const wrapper = mountFunction({
124
- propsData: {
127
+ props: {
125
128
  value: 33,
126
129
  width: 13,
127
130
  },
@@ -132,7 +135,7 @@ describe('VProgressCircular.ts', () => {
132
135
 
133
136
  it('should render component with fill prop and match snapshot', () => {
134
137
  const wrapper = mountFunction({
135
- propsData: {
138
+ props: {
136
139
  value: 33,
137
140
  fill: 'green lighten-1',
138
141
  },
@@ -142,10 +145,14 @@ describe('VProgressCircular.ts', () => {
142
145
  })
143
146
 
144
147
  it('should set isVisible with onObserve', () => {
145
- expect((new VProgressCircular()).isVisible).toEqual(true)
146
148
  const wrapper = mountFunction()
147
149
  expect(wrapper.vm.isVisible).toEqual(false)
148
- wrapper.vm.onObserve(null, null, true)
150
+
151
+ // Создаем мок-объекты для IntersectionObserverEntry
152
+ const mockEntries = [] as IntersectionObserverEntry[]
153
+ const mockObserver = {} as IntersectionObserver
154
+
155
+ wrapper.vm.onObserve(mockEntries, mockObserver, true)
149
156
  expect(wrapper.vm.isVisible).toEqual(true)
150
157
  })
151
158
  })