How to use the vue2-leaflet.LPopup function in vue2-leaflet

To help you get started, we’ve selected a few vue2-leaflet examples, based on popular ways it is used in public projects.

github yunity / karrot-frontend / src / maps / components / StandardMap.spec.js View on Github external
it('renders markers with popups', async () => {
    const wrapper = mountWithDefaults(StandardMap, {
      propsData: {
        markers,
      },
    })
    await nextTicks(1)
    expect(wrapper.findAll(Vue2Leaflet.LMap).length).toBe(1)
    expect(wrapper.findAll(ExtendedMarker).length).toBe(markers.length)
    expect(wrapper.findAll(Vue2Leaflet.LPopup).length).toBe(markers.length)

    // add and remove some markers
    for (let i = 0; i < 3; i++) {
      wrapper.setProps({ markers: markers.filter((e, idx) => idx !== i) })
      await nextTicks(1)
      expect(wrapper.findAll(ExtendedMarker).length).toBe(markers.length - 1)
      expect(wrapper.findAll(Vue2Leaflet.LPopup).length).toBe(markers.length - 1)
    }
  })
})
github yunity / karrot-frontend / src / maps / components / GroupMap.spec.js View on Github external
import GroupMap from './GroupMap'
import { usersMock, placesMock } from '>/mockdata'

import * as Vue2Leaflet from 'vue2-leaflet'
import ExtendedMarker from './ExtendedMarker'
import { mountWithDefaults } from '>/helpers'
import Vue from 'vue'

/* vue2-leaflet library does not name its components, which vue-test-utils needs to find them
   so we give them names here... */
Vue2Leaflet.LMap.name = 'Vue2LeafletMap'
Vue2Leaflet.LTileLayer.name = 'Vue2LeafletTileLayer'
Vue2Leaflet.LPopup.name = 'Vue2LeafletPopup'
Vue2Leaflet.LMarker.name = 'Vue2LeafletMarker'

const defaultProps = {
  users: usersMock,
  places: placesMock,
  showUsers: true,
  showPlaces: true,
  currentGroup: {
    membership: {
      isEditor: true,
    },
  },
}

describe('GroupMap', () => {
  beforeEach(() => jest.resetModules())
github yunity / karrot-frontend / src / maps / components / StandardMap.spec.js View on Github external
const wrapper = mountWithDefaults(StandardMap, {
      propsData: {
        markers,
      },
    })
    await nextTicks(1)
    expect(wrapper.findAll(Vue2Leaflet.LMap).length).toBe(1)
    expect(wrapper.findAll(ExtendedMarker).length).toBe(markers.length)
    expect(wrapper.findAll(Vue2Leaflet.LPopup).length).toBe(markers.length)

    // add and remove some markers
    for (let i = 0; i < 3; i++) {
      wrapper.setProps({ markers: markers.filter((e, idx) => idx !== i) })
      await nextTicks(1)
      expect(wrapper.findAll(ExtendedMarker).length).toBe(markers.length - 1)
      expect(wrapper.findAll(Vue2Leaflet.LPopup).length).toBe(markers.length - 1)
    }
  })
})
github yunity / karrot-frontend / src / maps / components / GroupMap.spec.js View on Github external
it('renders users and places', async () => {
    const wrapper = mountWithDefaults(GroupMap, {
      propsData: defaultProps,
    })
    await Vue.nextTick()
    expect(wrapper.findAll(Vue2Leaflet.LMap).length).toBe(1)
    expect(wrapper.findAll(ExtendedMarker).length).toBe(usersMock.length + placesMock.length)
    for (const marker of wrapper.findAll(ExtendedMarker)) {
      expect(marker.props().opacity).toEqual(1)
    }
    expect(wrapper.findAll(Vue2Leaflet.LPopup).length).toBe(usersMock.length + placesMock.length)
  })