Version 1.0.2 mit node_modules Verzeichnis

This commit is contained in:
ISA
2024-10-02 07:58:24 +02:00
parent f353a06b1b
commit 62b6e55a0a
68228 changed files with 4548477 additions and 651 deletions

View File

@@ -0,0 +1,76 @@
import test from 'ava';
import L from 'leaflet';
import randLatLng from './helpers/random-pos';
import SmoothMarkerBouncing from '../src/SmoothMarkerBouncing';
SmoothMarkerBouncing(L);
test('Test start/stop bouncing of individual markers', t => {
// Given
const div = document.createElement('div');
const map = L.map(div).setView([48.847547, 2.351074], 14);
const marker1 = L.marker(randLatLng()).addTo(map);
const marker2 = L.marker(randLatLng()).addTo(map);
const marker3 = L.marker(randLatLng()).addTo(map);
// When
let bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, []);
// When
marker2.bounce();
bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, [ marker2 ]);
// When
marker2.stopBouncing();
bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, []);
});
test('Test start/stop bouncing of exclusive marker', t => {
// Given
const div = document.createElement('div');
const map = L.map(div).setView([48.847547, 2.351074], 14);
const marker1 = L.marker(randLatLng()).addTo(map);
const marker2 = L.marker(randLatLng()).addTo(map);
const marker3 = L.marker(randLatLng()).setBouncingOptions({ exclusive: true }).addTo(map);
// When
let bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, []);
// When
marker1.bounce();
marker2.bounce();
bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, [ marker1, marker2 ]);
// When
marker3.bounce();
bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, [ marker3 ]);
// When
marker2.bounce();
bouncingMarkers = L.Marker.prototype._orchestration.getBouncingMarkers();
// Then
t.deepEqual(bouncingMarkers, [ marker2 ]);
});