expect-maptalks
Advanced tools
Comparing version 0.3.0 to 0.4.0
19
index.js
@@ -135,9 +135,18 @@ 'use strict'; | ||
} | ||
var size = layer.getMap().getSize(), | ||
image = layer._getRenderer().getCanvasImage(); | ||
if (!image) { | ||
var size, point, canvas; | ||
if (layer.getMap) { | ||
size = layer.getMap().getSize(); | ||
var image = layer._getRenderer().getCanvasImage(); | ||
point = image.point; | ||
canvas = image.image; | ||
} else { | ||
var map = layer; | ||
size = map.getSize(); | ||
point = { x: 0, y: 0 }; | ||
canvas = map._getRenderer().canvas; | ||
} | ||
if (!canvas) { | ||
return false; | ||
} | ||
var canvas = image.image; | ||
return isDrawn(parseInt(size.width) / 2 - image.point.x + dx, parseInt(size.height) / 2 - image.point.y + dy, canvas, color); | ||
return isDrawn(parseInt(size.width) / 2 - point.x + dx, parseInt(size.height) / 2 - point.y + dy, canvas, color); | ||
} | ||
@@ -144,0 +153,0 @@ |
{ | ||
"name": "expect-maptalks", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A plugin of expect.js(https://github.com/Automattic/expect.js) for maptalks with assertions for Coordinate/GeoJSON/Layer", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -57,3 +57,3 @@ # expect-maptalks | ||
**painted**: asserts the given layer is painted in the center with a offset. | ||
**painted**: asserts the given layer or map is painted in the center with a offset. | ||
@@ -70,2 +70,4 @@ ```js | ||
expect(v).to.be.painted(5, 3, [255, 255, 255]); | ||
//also support map | ||
expect(map).to.be.painted(5, 3, [255, 255, 255]); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11236
191
72