From 13c6aff4b635b22fab2a9448cd3f54539cf7b8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20S=C3=A1nchez=20Ortega?= Date: Thu, 26 Mar 2015 11:30:01 +0100 Subject: [PATCH] Unit tests for the "remember opacity" functionality --- spec/index.html | 3 + spec/suites/RememberOpacity.js | 151 +++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 spec/suites/RememberOpacity.js diff --git a/spec/index.html b/spec/index.html index a68feeefe..ad1549cf1 100644 --- a/spec/index.html +++ b/spec/index.html @@ -19,6 +19,7 @@ + + + diff --git a/spec/suites/RememberOpacity.js b/spec/suites/RememberOpacity.js new file mode 100644 index 000000000..bb023a59f --- /dev/null +++ b/spec/suites/RememberOpacity.js @@ -0,0 +1,151 @@ +describe('Remember opacity', function () { + var map, div, clock, markers; + + var markerDefs = [ + {latLng: [ 0, 0], opts: {opacity: 0.9}}, + {latLng: [ 0, 1], opts: {opacity: 0.5}}, + {latLng: [ 0,-1], opts: {opacity: 0.5}}, + {latLng: [ 1, 0], opts: {opacity: 0.5}}, + {latLng: [-1, 0], opts: {opacity: 0.5}}, + {latLng: [ 1, 1], opts: {opacity: 0.2}}, + {latLng: [ 1,-1], opts: {opacity: 0.2}}, + {latLng: [-1, 1], opts: {opacity: 0.2}}, + {latLng: [-1,-1], opts: {opacity: 0.2}} + ]; + + var bounds = L.latLngBounds( L.latLng( -1.1, -1.1), + L.latLng( 1.1, 1.1) ); + + beforeEach(function () { + clock = sinon.useFakeTimers(); + + div = document.createElement('div'); + div.style.width = '200px'; + div.style.height = '200px'; + document.body.appendChild(div); + + map = L.map(div, { maxZoom: 18 }); + + markers = []; + for (var i=0; i