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

Sort attributes by name in HTMLElement plugin #3783

Merged
merged 2 commits into from
Jun 26, 2017

Conversation

pedrottimark
Copy link
Contributor

Summary

The HTMLElement plugin has sort method for attributes, but because array consists of objects, it does not have same effect of enforcing consistent order of props like ReactElement and ReactTestComponent plugins where array consists of keys.

Goal: expected test criterion depends on what are the attributes, not on how they were set.

@mute Can you comment whether this change makes sense for serialized HTML elements?

Test plan

  • changed expected results of 2 tests in which id preceded class
  • changed received value of one test so it is already in sorted order
  • wrote 2 comments because it looks like Jest does not use invariant to prevent that kind of subtle regression in tests

@mute
Copy link
Contributor

mute commented Jun 9, 2017

This seems like a good change to me,

I think it could result in broken tests compared to existing snapshots, so it might necessitate a bump in the snapshot version, although I'm not sure how that process works.

@codecov-io
Copy link

codecov-io commented Jun 9, 2017

Codecov Report

Merging #3783 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3783      +/-   ##
==========================================
+ Coverage   58.01%   58.02%   +<.01%     
==========================================
  Files         195      195              
  Lines        6741     6742       +1     
  Branches        6        6              
==========================================
+ Hits         3911     3912       +1     
  Misses       2827     2827              
  Partials        3        3
Impacted Files Coverage Δ
packages/pretty-format/src/plugins/html_element.js 94.28% <100%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1199558...1897f6e. Read the comment docs.

@cpojer
Copy link
Member

cpojer commented Jun 26, 2017

Please rebase

@pedrottimark
Copy link
Contributor Author

Yes

@cpojer cpojer merged commit eb4c0ab into jestjs:master Jun 26, 2017
@pedrottimark pedrottimark deleted the sort-html-attributes branch June 27, 2017 19:36
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants