-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write tests that assert the markers are shown or hidden as in the new example code #52
Conversation
Hi @jywarren !
|
Hi @jywarren , |
Gruntfile.js
Outdated
'node_modules/jasmine-ajax/lib/mock-ajax.js', | ||
'https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyDWgc7p4WWFsO3y0MTe50vF4l4NUPcPuwE', | ||
'node_modules/leaflet/dist/leaflet-src.js', | ||
'node_modules/leaflet-blurred-location/dist/Leaflet.BlurredLocation.js' , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here i think you need to include the LBLD library itself! See for reference:
<link href="../../../node_modules/leaflet/dist/leaflet.css" rel="stylesheet"> | ||
<script src="../../../node_modules/leaflet/dist/leaflet.js"></script> | ||
<script src="../../../node_modules/leaflet-blurred-location/dist/Leaflet.BlurredLocation.js"></script> | ||
<script src="../../../dist/Leaflet.BlurredLocationDisplay.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i think you may want to load these in the Gruntfile on these lines: https://github.com/publiclab/leaflet-blurred-location-display/pull/52/files#diff-35b4a816e0441e6a375cd925af50752cR35
because they won't be loaded from this file until you load the fixture. And some of the tests you may not actually want the HTML fixture data, but just to test basic methods in the JS lib.
See for example:
Yes tried that as well ! |
Hmm, confusing. Maybe you have to include the source files like this? https://github.com/publiclab/PublicLab.Editor/blob/master/Gruntfile.js#L44-L46 If this doesn't work, maybe ping |
Noticing that Travis and local both give different errors ( Working on this. |
spec/javascripts/test_spec.js
Outdated
|
||
it("Checks if at zoom level 5 , all 7 markers are shown", function () { | ||
//BlurredLocation1.map.setZoom(5); | ||
expect($("#map1").children()[0].childNodes[3].childNodes.length).toBe(0) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect($("#map1").children()[0].childNodes[3].childNodes.length).toBe(7) ;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rexagod , yes i did that purposely to tell you guys that in testing , markers are not getting loaded on map 😄 !
spec/javascripts/test_spec.js
Outdated
|
||
it("Checks if at zoom level 6 , only 5 markers are shown", function () { | ||
//BlurredLocation2.map.setZoom(6); | ||
expect($("#map2").children()[0].childNodes[3].childNodes.length).toBe(0) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect($("#map1").children()[0].childNodes[3].childNodes.length).toBe(5) ;
spec/javascripts/test_spec.js
Outdated
|
||
it("Checks if at zoom level 8 , only 3 markers are shown", function () { | ||
// BlurredLocation3.map.setZoom(8); | ||
expect($("#map3").children()[0].childNodes[3].childNodes.length).toBe(0) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect($("#map1").children()[0].childNodes[3].childNodes.length).toBe(3) ;
Hello, @sagarpreet-chadha! I've made some comments above, depending on some checks I made below. PS. All the tests are passing if length is expected to be 0, meaning that for some reason the |
Made some changes along the way.
|
Hi @rexagod ...thank you for the recommendations 😄 . What do you think could be the possible reason that LBL and LBLD libraries are not getting loaded before testing starts ? Thanks ! |
Thank you @arpansac , the fixtures are now being loaded 🎉 . Also now all libraries are also getting loaded except LBLD . Now we just have to figure why LBLD is not getting loaded . Thanks all 😄 ! |
We use Jasmine jquery to load fixtures , but this package is not maintained . Also see this which i found in its documentation (this should solve the error which one gets when And this error on Travis 😄 asks to open issue in puppeteer package : |
grunt-contrib-Jasmine runs on phantomJS , and phantomJS does not support ES6 ! |
YAYYY 🎉 I think i will write a blog about it :P . @jywarren ...kindly review 😄 ! |
@jywarren ...kindly review this one as well 😄 ! |
OK! Sorry i had replied via email but it didn't go through! |
Awesome! Thanks Sagarpreet and great problem solving, this was such a tough one. I'm sorry i wasn't able to help more! Perhaps a good deal of this testing workflow is starting to age a bit. But you got it! 🙌 |
Fixes #45 !