publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
956 stars 1.83k forks source link

Make Tests for inline maps . #4722

Open sagarpreet-chadha opened 5 years ago

sagarpreet-chadha commented 5 years ago

This page : https://publiclab.org/wiki/inline-maps shows the documentation of all the inline maps that we have .

All Inline maps use the same partial _leaflet.html.erb except people-inline-map which uses _peopleleaflet.html.erb .

Thanks 😄 !

jywarren commented 5 years ago

This is super! So you think a lot of the failures on that page are due to multiple loading maps on the same page?

On Tue, Jan 29, 2019 at 9:06 AM Sagarpreet Chadha notifications@github.com wrote:

This page : https://publiclab.org/wiki/inline-maps shows the documentation of all the inline maps that we have .

All Inline maps use the same partial _leaflet.html.erb except people-inline-map which uses _peopleleaflet.html.erb .

-

Remove HASH from URL when using people-inline-map -> No sense of using URL HASH when having more than one inline map on a page .

Multiple dependencies being loaded when more than 1 inline map used .

Documentation needs to be updated on the page - https://publiclab.org/wiki/inline-maps .

Write test : Leaflet Map is loaded --- check if <div class="leaflet-map"... is present or not . When 2 inline maps are used then 2 such div's should be present . Add fixture data which calls self.notes_map_by_tag function in nodes_shared.rb to demonstrate the test .

Another test : Check if the marker is being loaded on the map ! This can be done by checking if <img class="leaflet-marker-shadow leaflet-zoom-animated"... which represents marker is present on page or not .

Thanks 😄 !

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4722, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJwqQLq3WAwn11nas-UOCGPqYzLpLks5vIDk2gaJpZM4aX6I5 .

sagarpreet-chadha commented 5 years ago

The errors currently are due to 3 reason :

1.) New API is not used (bounding rectangle API) , which is solved in #4725 . 2.) Use of Full Hash URL , which is also solved in #4725 .

3.) The 3rd error is weird , it is because this script is not getting loaded : <%= javascript_include_tag('https://unpkg.com/esri-leaflet@2.2.3/dist/esri-leaflet.js') %> <%= javascript_include_tag('https://unpkg.com/esri-leaflet-renderers@2.0.6') %> Hence , giving this error :

screenshot 2019-01-29 at 11 16 48 pm

This error is only in inline maps (other maps are working fine) AND is not there in localhost (hence i cannot replicate this error) !

jywarren commented 5 years ago

Just going to reopen this to ask if there's anything else we need to do to get the maps on this page working?

https://publiclab.org/wiki/inline-maps

jywarren commented 5 years ago

Oh, hm,

Uncaught TypeError: Cannot read property 'featureLayer' of undefined
    at wisconsinLayer (eval at <anonymous> (application-63699fb814392c5696c58b662202dbe85aaf4da5c66ced606772a14e47cf285e.js:350), <anonymous>:29409:31)
    at setupLEL (application-63699fb814392c5696c58b662202dbe85aaf4da5c66ced606772a14e47cf285e.js:37272)
    at eval (eval at <anonymous> (application-63699fb814392c5696c58b662202dbe85aaf4da5c66ced606772a14e47cf285e.js:350), 
sagarpreet-chadha commented 5 years ago

And see this (pan the maps once to load data , will fix this asap) : https://publiclab.org/notes/sagarpreet/01-30-2019/inline-map-testing

=> Working fine on NOTE but giving the above error on WIKI .

jywarren commented 5 years ago

image

Oh this is great! 2 things --

  1. see above - i think we need to clear the markers before displaying the newly fetched ones
  2. on the very first page load I'm not seeing them appear, only on dragging the map

Great work, just a few more steps here, Sagarpreet!

jywarren commented 5 years ago

Hi, I'm going to open this one more time, sorry @sagarpreet-chadha ! I still am seeing some errors here:

https://publiclab.org/wiki/inline-maps

VM297:29409 Uncaught TypeError: Cannot read property 'featureLayer' of undefined
    at wisconsinLayer

Could you take a look? Thank you!