Skip to content

Add tests for <map-span>#560

Merged
prushforth merged 5 commits intoMaps4HTML:mainfrom
ben-lu-uw:map-span_test
Nov 5, 2021
Merged

Add tests for <map-span>#560
prushforth merged 5 commits intoMaps4HTML:mainfrom
ben-lu-uw:map-span_test

Conversation

@ben-lu-uw
Copy link
Contributor

@ben-lu-uw ben-lu-uw commented Nov 3, 2021

Closes #536

@ben-lu-uw ben-lu-uw requested a review from prushforth November 3, 2021 16:52
@ben-lu-uw
Copy link
Contributor Author

Also closes #559

@ben-lu-uw ben-lu-uw linked an issue Nov 4, 2021 that may be closed by this pull request
@prushforth
Copy link
Member

Seems like the volume of data included in the commit exceeds what might be strictly necessary to test the function?

@ben-lu-uw
Copy link
Contributor Author

I'll strip it down 👍

Comment on lines +243 to +247
for(let i = 0; i < nodes.length; i++){
if(nodes[i].textContent.trim().length === 0){
nodes[i].remove();
}
}
Copy link
Member

@ahmadayubi ahmadayubi Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to loop through all to childNodes or could you get away with checking just the first and last? I'm not 100% sure how whitespace and textNodes work so you may have to loop through all of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that I only need to check the last one

});

test("[" + browserType + "]" + " <map-span> hides tile boundaries", async ()=>{
const total = await page.$eval(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the variable named "total" ? What is it the total of?

});

//https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/559#issuecomment-959805896
test("[" + browserType + "]" + " White space parsing for map-coordinates", async ()=>{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title of the test could be easier to understand, e.g. "Ensure white space in map-coordinates is ignored" or something like that.

(path) => path.getAttribute("d")
);

expect(feature).toEqual("M0 217L0 217L0 217L2 217L4 218L6 218L6 218L6 216L2 214L0 216L0 216");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<map-feature id="fclass.73" class="fclass">
<map-geometry>
<map-polygon>
<map-coordinates>
Copy link
Member

@prushforth prushforth Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put an xml comment here that says e.g. <!-- leading and trailing whitespace should not affect parsing of map-coordinates -->

Copy link
Member

@prushforth prushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing these test, it is much appreciated. Testing is the basis of civilizational progress lol. Just try to keep the semantics of what your doing up front for poor old you or whoever comes after you (often yourself, actually) who comes along and tries to figure it out later.

@prushforth prushforth merged commit 456b8de into Maps4HTML:main Nov 5, 2021
@prushforth
Copy link
Member

If you feel like updating anything, go ahead, but merging this so you can move on as required.

@Malvoz Malvoz added the tests label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector rendering issue Create test for <map-span>

4 participants