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

HTML snapshot test for all samples for consistency in the markup #20

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

divdavem
Copy link
Member

No description provided.

@divdavem divdavem marked this pull request as draft July 27, 2023 15:56
@divdavem divdavem changed the title [WIP] HTML snapshot test for all samples for consistency in the markup HTML snapshot test for all samples for consistency in the markup Jul 27, 2023
@divdavem divdavem force-pushed the htmlSnapshot branch 4 times, most recently from 71c3ec0 to 0286d85 Compare July 28, 2023 09:25
@divdavem divdavem marked this pull request as ready for review July 28, 2023 09:30
@divdavem divdavem force-pushed the htmlSnapshot branch 3 times, most recently from dbcb847 to 61f82a4 Compare July 28, 2023 12:21
Copy link
Contributor

@quentinderoubaix quentinderoubaix left a 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

const cleanChildNodes = (childNodes: HTMLNode[]) => {
childNodes = [...childNodes];
const result: HTMLNode[] = [];
for (let i = 0; i < childNodes.length; i++) {
Copy link
Contributor

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); 
  }
}

return null;
}
const tagName = node.tagName.toLowerCase();
const textarea = isTextArea(node);
Copy link
Contributor

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

}
const tagName = node.tagName.toLowerCase();
const textarea = isTextArea(node);
const childNodes: any[] = [];
Copy link
Contributor

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
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #20 (c59857a) into main (5fd9bed) will increase coverage by 1.01%.
The diff coverage is 85.71%.

@@            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     
Flag Coverage Δ
e2e-1 70.57% <100.00%> (+30.94%) ⬆️
e2e-10 76.91% <0.00%> (-0.21%) ⬇️
e2e-2 81.91% <100.00%> (+0.06%) ⬆️
e2e-3 ?
e2e-4 52.33% <16.66%> (-13.62%) ⬇️
e2e-5 80.41% <100.00%> (ø)
e2e-6 80.41% <100.00%> (ø)
e2e-7 ?
e2e-8 77.01% <0.00%> (-3.07%) ⬇️
e2e-9 66.18% <0.00%> (-13.90%) ⬇️
unit 93.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
angular/lib/src/lib/select/select.component.ts 100.00% <ø> (ø)
react/lib/Alert.tsx 100.00% <ø> (ø)
react/lib/Select.tsx 100.00% <ø> (ø)
svelte/lib/select/Select.svelte 80.00% <0.00%> (ø)
angular/lib/src/lib/alert/alert.component.ts 90.90% <100.00%> (+0.66%) ⬆️
...lar/lib/src/lib/pagination/pagination.component.ts 63.21% <100.00%> (+0.42%) ⬆️
react/lib/pagination/Pagination.tsx 51.51% <100.00%> (ø)

... and 18 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@divdavem
Copy link
Member Author

@quentinderoubaix Thank you for your review!

@divdavem divdavem merged commit c09838e into AmadeusITGroup:main Jul 28, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants