| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7457855 commit 0b74f21
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ import Polygon from 'ol/geom/Polygon'; | |||
| 20 | 20 | import VectorLayer from 'ol/layer/Vector'; | |
| 21 | 21 | import LayerGroup from 'ol/layer/Group'; | |
| 22 | 22 | import VectorSource from 'ol/source/Vector'; | |
| 23 | + import { unByKey } from 'ol/Observable'; | ||
| 23 | 24 | ||
| 24 | 25 | describe('openlayers_MapExtend', () => { | |
| 25 | 26 | let originalTimeout, map, testDiv; | |
@@ -80,7 +81,9 @@ describe('openlayers_MapExtend', () => { | |||
| 80 | 81 | }); | |
| 81 | 82 | map.addLayer(graphicLayer); | |
| 82 | 83 | ||
| 83 | - setTimeout(() => { | ||
| 84 | + const key = graphicLayer.once('postrender', function () { | ||
| 85 | + if (graphicLayer.getSource().renderer) { | ||
| 86 | + unByKey(key); | ||
| 84 | 87 | graphicLayer.getSource()._forEachFeatureAtCoordinate([30, 30], 1, (result) => { | |
| 85 | 88 | expect(graphics).toContain(result); | |
| 86 | 89 | }); | |
@@ -97,7 +100,8 @@ describe('openlayers_MapExtend', () => { | |||
| 97 | 100 | expect(map.getFeaturesAtPixel(pixel).length).toBe(2); | |
| 98 | 101 | map.removeLayer(graphicLayer); | |
| 99 | 102 | done(); | |
| 100 | - }, 0) | ||
| 103 | + } | ||
| 104 | + }) | ||
| 101 | 105 | }) | |
| 102 | 106 | it('forEachFeatureAtPixel_layerGroup_issue26', (done) => { | |
| 103 | 107 | var feature = new Feature(new Polygon([ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments