Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Diff tests do not track line break changes #462

Open
kptdobe opened this issue Sep 8, 2020 · 6 comments
Open

Diff tests do not track line break changes #462

kptdobe opened this issue Sep 8, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@kptdobe
Copy link
Contributor

kptdobe commented Sep 8, 2020

adobe/theblog#416 revealed that line breaks have changed which was causing issues in the consuming code (not necessarily good code). Even worst, the different behaviour was introduced by a change in a third-party module.
Diff tests should have detected the line break changes.

cc @MarquiseRosier

@kptdobe kptdobe added the enhancement New feature or request label Sep 8, 2020
@trieloff
Copy link
Contributor

trieloff commented Sep 9, 2020

Really? Line breaks are not relevant to the DOM in most cases, so I wouldn't pile one bad decision on another.

@MarquiseRosier
Copy link
Contributor

MarquiseRosier commented Sep 9, 2020

@trieloff and @kptdobe let me know what the verdict is; but I agree with Lars; what I added to build the diff tests only checks for difference in node values, # of children, content.

But there's some normalization code that makes white space not really matter, i'm very certain that this is the reason why white space change wouldn't be detected; if i'm remembering correctly!

@tripodsan
Copy link
Contributor

Really? Line breaks are not relevant to the DOM in most cases, so I wouldn't pile one bad decision on another.

most of the times... yes. but there are edge cases, e.g. between block elements.
also see https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33

@trieloff
Copy link
Contributor

And in pre

The diff test should test significant DOM differences. If our DOM diff misses the cases @tripodsan outlined, let's fix it, but don't change the definition of the test to become about string equality.

@MarquiseRosier
Copy link
Contributor

@kptdobe mind pointing me to the change that caused the break? I believe it was an update to word2md?

@MarquiseRosier MarquiseRosier self-assigned this Sep 21, 2020
@kptdobe
Copy link
Contributor Author

kptdobe commented Sep 28, 2020

Documented here: adobe/theblog#416 (comment)

The main issue is that we use "text" as reference for entries lookup which requires a lot of filtering (remove potential styling, line breaks...). In this specific case, a trim was required in the consuming code and this seriously broke the site without us noticing it.

I am not saying we should block the deployment of a new hlx version because of new line breaks introduced but we should analyse the impact before hitting the publish button.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants