-
Notifications
You must be signed in to change notification settings - Fork 13
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
HTML snapshot test for all samples for consistency in the markup #20
Conversation
71c3ec0
to
0286d85
Compare
dbcb847
to
61f82a4
Compare
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.
just a few minor points
e2e/htmlSnapshot.ts
Outdated
const cleanChildNodes = (childNodes: HTMLNode[]) => { | ||
childNodes = [...childNodes]; | ||
const result: HTMLNode[] = []; | ||
for (let i = 0; i < childNodes.length; i++) { |
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.
Could this for loop not be rewritten using a while loop ?
while (childNodes.length) {
let newValue = childNodes.shift();
if (typeof newValue === 'string') {
const previousValue = result[result.length - 1];
if (typeof previousValue === 'string' ) {
result.pop();
newValue = previousValue + newValue;
} else if (newValue.tagName === '') {
childNodes.unshift(...newValue.childNoes);
continue;
}
result.push(newValue);
}
}
e2e/htmlSnapshot.ts
Outdated
return null; | ||
} | ||
const tagName = node.tagName.toLowerCase(); | ||
const textarea = isTextArea(node); |
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.
minor: could be renamed to isNodeArea
or is isNodeTextArea
to respect naming conventions on boolean variables
e2e/htmlSnapshot.ts
Outdated
} | ||
const tagName = node.tagName.toLowerCase(); | ||
const textarea = isTextArea(node); | ||
const childNodes: any[] = []; |
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.
could be typed to HTMLNode
Codecov Report
@@ Coverage Diff @@
## main #20 +/- ##
==========================================
+ Coverage 82.48% 83.49% +1.01%
==========================================
Files 60 60
Lines 1781 1818 +37
Branches 347 362 +15
==========================================
+ Hits 1469 1518 +49
+ Misses 263 250 -13
- Partials 49 50 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@quentinderoubaix Thank you for your review! |
No description provided.