Skip to content
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

Better testing for different features, especially interface code #119

Open
jywarren opened this issue Feb 26, 2018 · 8 comments
Open

Better testing for different features, especially interface code #119

jywarren opened this issue Feb 26, 2018 · 8 comments

Comments

@jywarren
Copy link
Member

This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!


We're occasionally seeing features get broken by later additions, especially UI features which are harder to test. But we do have UI tests in Jasmine:

it("Checks if input listeners change maps position to the entered latitude and longitude", function() {
var fixture = loadFixtures('index.html');
var latEl = $("#lat");
var lngEl = $("#lng");
latEl.val(20);
lngEl.val(15);
expect(parseFloat(latEl.val())).toBe(20);
expect(parseFloat(lngEl.val())).toBe(15);

Let's add some more -- checking that, for example, different fields update correctly when the map is panned. Let's look at the events that trigger behaviors in our interface code:

options.map.on('move', options.onDrag);

And add some UI tests to ensure these actually happen -- that way our code will be less brittle when new changes are added!

Any help with this much appreciated!

@mridulnagpal
Copy link
Member

@jywarren I can try breaking it to first timer issue

@mridulnagpal mridulnagpal mentioned this issue Feb 28, 2018
@mridulnagpal
Copy link
Member

@jywarren Do you have any other UI tests in mind? I will create FTOs for the same

@mridulnagpal
Copy link
Member

@jywarren We have basic UI tests, do you have any more in mind?

@jywarren
Copy link
Member Author

jywarren commented Jun 6, 2018

We might add one to try to simulate the steps described in #105 -- i.e. move to a location using a Leaflet panTo() command, then use jQuery to uncheck the "blurred" checkbox, then use panTo() again, and see if we can use the test to demonstrate that the displayed fields are not properly truncated. This would be a great test!

@mridulnagpal
Copy link
Member

Will add a test for isBlurred as soon as the PR is merged

@mridulnagpal
Copy link
Member

@jywarren Added a test #138

@mridulnagpal
Copy link
Member

@jywarren adding test for newly added scale!!

@jywarren
Copy link
Member Author

jywarren commented Jan 7, 2019

I also just turned on test coverage reporting in CodeClimate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants