Issue 1989: Convert null values to empty strings in popup and tooltip by hansthen · Pull Request #2134 · python-visualization/folium
hansthen
changed the title
Special case null values in popup and tooltip
Issue 1989: Convert null values to empty strings in popup and tooltip
Can we add a test to avoid regression? Maybe ask in #1989 for some code/file we can use?
Can we add a test to avoid regression? Maybe ask in #1989 for some code/file we can use?
I wrote a small program to visually test this. But since this is behavior in the generated code, it is difficult to test with our current tests frameworks.
I have a few ideas on how to make visual snapshots and compare against those during tests. Is it okay if I work on snapshot / regression testing in a new branch?
I have a few ideas on how to make visual snapshots and compare against those during tests.
We can use https://github.com/matplotlib/pytest-mpl. I had some success with it in the past. However, we can try a text based text that checks if the HTML has null in those fields.
Is it okay if I work on snapshot / regression testing in a new branch?
Sure. IMO it is OK to merge as-is and we can open an issue for further testing here.
However, we can try a text based text that checks if the HTML has
nullin those fields.
It's not so easy. The null values are still there. We just filter them in javascript when we generate the popup.
let handleObject = feature => {
if (feature === null) {
return '';
} else if (typeof(feature)=='object') {
return JSON.stringify(feature);
} else {
return feature;
}
}
I can of course create to test that specific string, but that would feel a bit pointless.
I created an issue for the regression tests. #2140
I can of course create to test that specific string, but that would feel a bit pointless.
Indeed. Let's merge and focus on the image comparison test in the future.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters