2011-07-20 14:23:04 +08:00
|
|
|
|
if (!Array.prototype.map) {
|
2015-09-25 20:37:07 +08:00
|
|
|
|
Array.prototype.map = function (fun) {
|
2013-11-08 05:54:33 +08:00
|
|
|
|
"use strict";
|
2011-07-20 14:23:04 +08:00
|
|
|
|
|
2015-09-04 23:46:55 +08:00
|
|
|
|
if (this === undefined || this === null) {
|
2013-11-08 05:54:33 +08:00
|
|
|
|
throw new TypeError();
|
|
|
|
|
}
|
2011-07-20 14:23:04 +08:00
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
|
var t = Object(this);
|
|
|
|
|
var len = t.length >>> 0;
|
|
|
|
|
if (typeof fun !== "function") {
|
|
|
|
|
throw new TypeError();
|
|
|
|
|
}
|
2011-07-20 14:23:04 +08:00
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
|
var res = new Array(len);
|
|
|
|
|
var thisp = arguments[1];
|
|
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
|
|
if (i in t) {
|
|
|
|
|
res[i] = fun.call(thisp, t[i], i, t);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-07-20 14:23:04 +08:00
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
|
return res;
|
|
|
|
|
};
|
2013-09-10 15:03:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
|
expect.Assertion.prototype.near = function (expected, delta) {
|
|
|
|
|
delta = delta || 1;
|
|
|
|
|
expect(this.obj.x).to
|
|
|
|
|
.be.within(expected.x - delta, expected.x + delta);
|
|
|
|
|
expect(this.obj.y).to
|
|
|
|
|
.be.within(expected.y - delta, expected.y + delta);
|
2013-09-10 15:03:59 +08:00
|
|
|
|
};
|
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
|
expect.Assertion.prototype.nearLatLng = function (expected, delta) {
|
|
|
|
|
delta = delta || 1e-4;
|
|
|
|
|
expect(this.obj.lat).to
|
|
|
|
|
.be.within(expected.lat - delta, expected.lat + delta);
|
|
|
|
|
expect(this.obj.lng).to
|
|
|
|
|
.be.within(expected.lng - delta, expected.lng + delta);
|
|
|
|
|
};
|
2015-07-16 23:01:44 +08:00
|
|
|
|
|
|
|
|
|
happen.at = function (what, x, y, props) {
|
|
|
|
|
this.once(document.elementFromPoint(x, y), L.Util.extend({
|
2015-09-25 18:55:37 +08:00
|
|
|
|
type: what,
|
|
|
|
|
clientX: x,
|
|
|
|
|
clientY: y,
|
|
|
|
|
screenX: x,
|
|
|
|
|
screenY: y,
|
|
|
|
|
which: 1,
|
|
|
|
|
button: 0
|
|
|
|
|
}, props || {}));
|
2015-07-16 23:01:44 +08:00
|
|
|
|
};
|
2016-02-05 23:30:29 +08:00
|
|
|
|
|
2016-03-17 21:46:15 +08:00
|
|
|
|
// We'll want to skip a couple of things when in PhantomJS, due to lack of CSS animations
|
2016-02-05 23:30:29 +08:00
|
|
|
|
it.skipInPhantom = L.Browser.any3d ? it : it.skip;
|
2016-03-17 21:46:15 +08:00
|
|
|
|
|
ES6 modules & Rollup (#4989)
* WIP ES6 modules & rollup
* WIP ES6 modules & rollup 2
* WIP ES6 modules & rollup 3
* WIP ES6 modules Browser
* WIP ES6 module fixes
* WIP ES6 modules: simpler browser exports
* WIP ES6: refactor CRS/Projection modules, CRS obj -> CRS.Base
* get rid of unnecessary index.js
* WIP ES6 modules, dom events and stuff
* Make linter happy, rollup to dist/
* revert to CRS namespace/class for now
* WIP rollup: export more stuff
* export controls
* rollup: export Layer
* rollup: export DomEvent
* rollup: export more layer types
* rollup: export Popup/Tooltip
* WIP: ES6-ify marker, icon, domutil, draggable.
* ES6-ify gridlayer, tilelayer.
* ES6-ify: Tweak imports-exports, code is now runnable!!
* ES6-ify: Fix scope in some DomUtils
* ES6-ify: Path, fix Popup
* ES6-ify: Lint & cleanup
* ES6-ify map handlers, more linting
* ES6-ify: Icon.Default namespacing
* ES6-ify: Renderers, CircleMarker
* ES6-ify: Circle, Polyline, LineUtil
* ES6-ify: Polygon, Rectangle, LineUtil, PolyUtil, linting
* ES6-ify: SVG.VML
* ES6-ify: DomEvent.Pointer, DomEvent.DoubleTap
* ES6-ify: Linting, make Karma play nice with Rollup
* ES6-ify: More work on fixing bits breaking some unit tests.
* ES6-ify: rollup the version number, fiddled with build scripts
* ES6-ify: Fiddle with test scripts
* ES6-ify: cleanup (refs to global L, imports from (DOM)Util), prevent cyclic loop on Map imports
* ES6-ify: More cleanup of (DOM)Util/Browser/DomEvent imports
* ES6ify: Use rollup's "legacy" option for ES3 (IE8) builds
* ES6-ify: Clean up build scripts, fix CONTRIBUTING.md instructions
* Typo
* ES6-ify: minor fixes and lefovers after rebasing on top of 1.0.2
* ES6-ify: upgrade to rollup 0.38 for proper IE8 builds, fix L.SVG.VML
* Make linter happy.
* ES6: Fixing typos and sxrew-ups after big rebase
* Fix symlink for debugging scripts
* ES6: Cleanup old build scripts
* ES6-ify: Update build system to include git rev in L.version
* ES6-ify: re-enable unit tests replacing L.Path with L.Polyline
* Export Path
* ES6ify: cleanup old banner file
* ES6-ify: whitespace in var declarations
* ES6-ify: Export toTransformation as L.transformation
* ES6-ify: cleanup L.transform exports
* ES6-ify: "import Util" in Transformation and SVG.VML
2017-01-30 18:35:16 +08:00
|
|
|
|
// Viceversa: some tests we want only to run in browsers without CSS animations.
|
|
|
|
|
it.skipInNonPhantom = L.Browser.any3d ? it.skip : it;
|
|
|
|
|
|
2016-03-17 21:46:15 +08:00
|
|
|
|
// A couple of tests need the browser to be touch-capable
|
|
|
|
|
it.skipIfNotTouch = window.TouchEvent ? it : it.skip;
|
|
|
|
|
|
|
|
|
|
// A couple of tests need the browser to be pointer-capable
|
|
|
|
|
it.skipIfNotEdge = window.PointerEvent ? it : it.skip;
|
2016-07-08 17:05:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function takeScreenshot(path) {
|
|
|
|
|
window.top.callPhantom({'render': path || 'screenshot.png'});
|
|
|
|
|
}
|