Improve tests for JSX quotes (#19856)
This commit is contained in:
1 parent
acb755b040
commit
bee1399282
7 files changed
+425
-4865
No files matched your search
File diff suppressed because it is too large.
Load diff
File renamed without changes.
@@ -1,16 +1 @@
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: false,
|
||||
jsxSingleQuote: false,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: false,
|
||||
jsxSingleQuote: true,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: true,
|
||||
jsxSingleQuote: false,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: true,
|
||||
jsxSingleQuote: true,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"]);
|
||||
File renamed without changes.
@@ -0,0 +1,389 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
jsxSingleQuote: false
|
||||
parsers: ["babel", "typescript", "flow"]
|
||||
singleQuote: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={'\\'\\"\\\\\\''} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={'\\''}
|
||||
singleEscaped2='''
|
||||
|
||||
doubleEscaped={"\\""}
|
||||
doubleEscaped2="""
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3='' ' "'
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>
|
||||
|
||||
=====================================output=====================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={"'\\""<>&quot;"} />;
|
||||
<div id="123" />;
|
||||
<div id=''"' />;
|
||||
<div id={"'\\"\\\\'"} />;
|
||||
<div
|
||||
single="foo"
|
||||
single2={"foo"}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={"'\\""}
|
||||
singleBothEscaped2="'""
|
||||
|
||||
singleBoth="' ""
|
||||
singleBoth2={"' \\""}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "}
|
||||
</p>;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`quotes.js - {"singleQuote":false,"jsxSingleQuote":true} format 1`] = `
|
||||
====================================options=====================================
|
||||
jsxSingleQuote: true
|
||||
parsers: ["babel", "typescript", "flow"]
|
||||
singleQuote: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={'\\'\\"\\\\\\''} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={'\\''}
|
||||
singleEscaped2='''
|
||||
|
||||
doubleEscaped={"\\""}
|
||||
doubleEscaped2="""
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3='' ' "'
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>
|
||||
|
||||
=====================================output=====================================
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={"'\\""<>&quot;"} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={"'\\"\\\\'"} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={"foo"}
|
||||
|
||||
double='bar'
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={"'\\""}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={"' \\""}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth='" ''
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{" "}{" "}
|
||||
</p>;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
jsxSingleQuote: false
|
||||
parsers: ["babel", "typescript", "flow"]
|
||||
singleQuote: true
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={'\\'\\"\\\\\\''} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={'\\''}
|
||||
singleEscaped2='''
|
||||
|
||||
doubleEscaped={"\\""}
|
||||
doubleEscaped2="""
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3='' ' "'
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>
|
||||
|
||||
=====================================output=====================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id="123" />;
|
||||
<div id=''"' />;
|
||||
<div id={"'\\"\\\\'"} />;
|
||||
<div
|
||||
single="foo"
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={'bar'}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2="'""
|
||||
|
||||
singleBoth="' ""
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={'" \\''}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`quotes.js - {"singleQuote":true,"jsxSingleQuote":true} format 1`] = `
|
||||
====================================options=====================================
|
||||
jsxSingleQuote: true
|
||||
parsers: ["babel", "typescript", "flow"]
|
||||
singleQuote: true
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<div id=""'<>&quot;" />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={'\\'\\"\\\\\\''} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={'\\''}
|
||||
singleEscaped2='''
|
||||
|
||||
doubleEscaped={"\\""}
|
||||
doubleEscaped2="""
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3='' ' "'
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>
|
||||
|
||||
=====================================output=====================================
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id='"'<>&quot;' />;
|
||||
<div id={'\\'""<>&quot;'} />;
|
||||
<div id='123' />;
|
||||
<div id=''"' />;
|
||||
<div id={"'\\"\\\\'"} />;
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double='bar'
|
||||
double2={'bar'}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth='" ''
|
||||
doubleBoth2={'" \\''}
|
||||
doubleBoth3="" ' '"
|
||||
/>;
|
||||
|
||||
<p>
|
||||
GitHub Desktop has encountered an unrecoverable error and will need to 1231231
|
||||
restart. This has been reported to the team, but if youencounter this121312331
|
||||
repeatedly please report this issue to the GitHub 12312312312312313{' '}{' '}
|
||||
</p>;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,16 @@
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: false,
|
||||
jsxSingleQuote: false,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: false,
|
||||
jsxSingleQuote: true,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: true,
|
||||
jsxSingleQuote: false,
|
||||
});
|
||||
runFormatTest(import.meta, ["babel", "typescript", "flow"], {
|
||||
singleQuote: true,
|
||||
jsxSingleQuote: true,
|
||||
});
|
||||
File renamed without changes.
Reference in new issue
Block a user