Skip to content

Commit

Permalink
fix(jsx-sort-props): add test for the removal of localeComapre
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoyopenroot committed Jan 28, 2020
1 parent bbb31b9 commit be370a0
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions tests/lib/rules/jsx-sort-props.js
Expand Up @@ -109,15 +109,18 @@ ruleTester.run('jsx-sort-props', rule, {
{code: '<App a="c" b="b" c="a" />;'},
{code: '<App {...this.props} a="c" b="b" c="a" />;'},
{code: '<App c="a" {...this.props} a="c" b="b" />;'},
{code: '<App a A />;'},
{code: '<App aa aB />;'},
{code: '<App A a />;'},
{code: '<App aB aa/>;'},
{code: '<App aA aB />;'},
{code: '<App aaa aB />;'},
{code: '<App a aa aB />;'},
{code: '<App aB aaa />;'},
{code: '<App a aB aa />;'},
{code: '<App Number="2" name="John" />;'},
// Ignoring case
{code: '<App a A />;', options: ignoreCaseArgs},
{code: '<App aa aB />;', options: ignoreCaseArgs},
{code: '<App a B c />;', options: ignoreCaseArgs},
{code: '<App A b C />;', options: ignoreCaseArgs},
{code: '<App name="John" Number="2" />;', options: ignoreCaseArgs},
// Sorting callbacks below all other props
{code: '<App a z onBar onFoo />;', options: callbacksLastArgs},
{code: '<App z onBar onFoo />;', options: ignoreCaseAndCallbackLastArgs},
Expand Down Expand Up @@ -175,9 +178,14 @@ ruleTester.run('jsx-sort-props', rule, {
output: '<App a aB />;'
},
{
code: '<App A a />;',
code: '<App fistName="John" tel={5555555} name="John Smith" lastName="Smith" Number="2" />;',
errors: [expectedError, expectedError, expectedError],
output: '<App Number="2" fistName="John" lastName="Smith" name="John Smith" tel={5555555} />;'
},
{
code: '<App aa aB />;',
errors: [expectedError],
output: '<App a A />;'
output: '<App aB aa />;'
},
{
code: '<App aB aA />;',
Expand All @@ -191,8 +199,8 @@ ruleTester.run('jsx-sort-props', rule, {
},
{
code: '<App aaB aaa aA a />;',
errors: [expectedError, expectedError, expectedError],
output: '<App a aA aaa aaB />;'
errors: [expectedError, expectedError],
output: '<App a aA aaB aaa />;'
},
{
code: '<App {...this.props} b a />;',
Expand All @@ -204,6 +212,12 @@ ruleTester.run('jsx-sort-props', rule, {
errors: [expectedError],
output: '<App c {...this.props} a b />;'
},
{
code: '<App fistName="John" tel={5555555} name="John Smith" lastName="Smith" Number="2" />;',
options: ignoreCaseArgs,
errors: [expectedError, expectedError, expectedError],
output: '<App fistName="John" lastName="Smith" name="John Smith" Number="2" tel={5555555} />;'
},
{
code: '<App B a />;',
options: ignoreCaseArgs,
Expand Down

0 comments on commit be370a0

Please sign in to comment.