Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-intersect

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-intersect - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

27

__tests__/index.js

@@ -168,4 +168,31 @@ import Vue from 'vue/dist/vue.js'

expect(spy.disconnect).toHaveBeenCalledTimes(1)
spy.disconnect.mockClear()
})
test('It should emit event when component is destroyed', async () => {
const mockedIntersect = Object.assign({}, Intersect)
const onDestroy = jest.fn()
const spy = {
destroyed: jest.spyOn(mockedIntersect, 'destroyed'),
disconnect: jest.spyOn(global.IntersectionObserver.prototype, 'disconnect')
}
const vm = new Vue({
template: `<intersect @destroyed="onDestroy"><div></div></intersect>`,
components: {Intersect: mockedIntersect},
methods: {
onDestroy
}
}).$mount()
await vm.$nextTick()
vm.$destroy()
expect(spy.destroyed).toHaveBeenCalledTimes(1)
expect(spy.disconnect).toHaveBeenCalledTimes(1)
expect(onDestroy).toHaveBeenCalledTimes(1)
})
test('It should warn when no child component is defined', async () => {

@@ -172,0 +199,0 @@ global.console.warn = jest.fn()

2

package.json
{
"name": "vue-intersect",
"version": "1.1.4",
"version": "1.1.5",
"description": "A Vue component to add intersection-observer to a Vue component or HTML element.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -101,2 +101,3 @@ # Vue Intersect

| **leave** | [*IntersectionObserverEntry*](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry) | Event fired when the element is *not* intersected (not visible on the screen) |
| **destroyed** | None | Fired when the underlying element is destroyed |

@@ -103,0 +104,0 @@

@@ -56,2 +56,3 @@ import Vue from 'vue'

destroyed () {
this.$emit('destroyed')
this.observer.disconnect()

@@ -58,0 +59,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc