jsfmt.spec.js.snap 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. // Jest Snapshot v1, https://goo.gl/fbAQLP
  2. exports[`strings.js 1`] = `
  3. [
  4. "abc",
  5. 'abc',
  6. '\\'',
  7. '"',
  8. '\\"',
  9. '\\\\"',
  10. "'",
  11. "\\'",
  12. "\\\\'",
  13. "'\\"",
  14. '\\'"',
  15. '\\\\',
  16. "\\\\",
  17. '\\0',
  18. '🐶',
  19. '\\uD801\\uDC28',
  20. ];
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. [
  23. "abc",
  24. "abc",
  25. "'",
  26. '"',
  27. '"',
  28. '\\\\"',
  29. "'",
  30. "'",
  31. "\\\\'",
  32. "'\\"",
  33. "'\\"",
  34. "\\\\",
  35. "\\\\",
  36. "\\0",
  37. "🐶",
  38. "\\uD801\\uDC28"
  39. ];
  40. `;
  41. exports[`strings.js 2`] = `
  42. [
  43. "abc",
  44. 'abc',
  45. '\\'',
  46. '"',
  47. '\\"',
  48. '\\\\"',
  49. "'",
  50. "\\'",
  51. "\\\\'",
  52. "'\\"",
  53. '\\'"',
  54. '\\\\',
  55. "\\\\",
  56. '\\0',
  57. '🐶',
  58. '\\uD801\\uDC28',
  59. ];
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. [
  62. "abc",
  63. "abc",
  64. "'",
  65. '"',
  66. '"',
  67. '\\\\"',
  68. "'",
  69. "'",
  70. "\\\\'",
  71. "'\\"",
  72. "'\\"",
  73. "\\\\",
  74. "\\\\",
  75. "\\0",
  76. "🐶",
  77. "\\uD801\\uDC28",
  78. ];
  79. `;
  80. exports[`template-literals.js 1`] = `
  81. foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`);
  82. const x = \`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {return 3 })() + 3 + 2 + 3 + 2 + 3 } with expr\`;
  83. foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {
  84. const x = 5;
  85. return x;
  86. })() + 3 + 2 + 3 + 2 + 3 } with expr\`);
  87. pipe.write(
  88. \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`,
  89. );
  90. // https://github.com/prettier/prettier/issues/1662#issue-230406820
  91. const content = \`
  92. const env = \${ JSON.stringify({
  93. assetsRootUrl: env.assetsRootUrl,
  94. env: env.env,
  95. role: "client",
  96. adsfafa: "sdfsdff",
  97. asdfasff: "wefwefw",
  98. fefef: "sf sdfs fdsfdsf s dfsfds"
  99. }, null, "\\t") });
  100. \`;
  101. // https://github.com/prettier/prettier/issues/821#issue-210557749
  102. f(\`\${{
  103. a: 4,
  104. b: 9,
  105. }}\`);
  106. // https://github.com/prettier/prettier/issues/1183#issue-220863505
  107. const makeBody = (store, assets, html) =>
  108. \`<!doctype html>\${
  109. ReactDOMServer.renderToStaticMarkup(
  110. <Html
  111. headScripts={compact([ assets.javascript.head ])}
  112. headStyles={compact([ assets.styles.body, assets.styles.head ])}
  113. bodyScripts={compact([ assets.javascript.body ])}
  114. bodyStyles={[]}
  115. stringScripts={[
  116. \`window.__INITIAL_STATE__ = \${
  117. JSON.stringify(store.getState(), null, 2)
  118. };\`,
  119. ]}
  120. content={[
  121. { id: 'app-container', dangerouslySetInnerHTML: { __html: html } },
  122. ]}
  123. />
  124. )
  125. }\`
  126. // https://github.com/prettier/prettier/issues/1626#issue-229655106
  127. const Bar = styled.div\`
  128. color: \${props => (props.highlight.length > 0 ? palette(['text', 'dark', 'tertiary'])(props) : palette(['text', 'dark', 'primary'])(props))} !important;
  129. \`
  130. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131. foo(
  132. \`a long string \${1 +
  133. 2 +
  134. 3 +
  135. 2 +
  136. 3 +
  137. 2 +
  138. 3 +
  139. 2 +
  140. 3 +
  141. 2 +
  142. 3 +
  143. 2 +
  144. 3 +
  145. 2 +
  146. 3 +
  147. 2 +
  148. 3} with expr\`
  149. );
  150. const x = \`a long string \${1 +
  151. 2 +
  152. 3 +
  153. 2 +
  154. 3 +
  155. 2 +
  156. 3 +
  157. 2 +
  158. 3 +
  159. 2 +
  160. 3 +
  161. 2 +
  162. (function() {
  163. return 3;
  164. })() +
  165. 3 +
  166. 2 +
  167. 3 +
  168. 2 +
  169. 3} with expr\`;
  170. foo(
  171. \`a long string \${1 +
  172. 2 +
  173. 3 +
  174. 2 +
  175. 3 +
  176. 2 +
  177. 3 +
  178. 2 +
  179. 3 +
  180. 2 +
  181. 3 +
  182. 2 +
  183. (function() {
  184. const x = 5;
  185. return x;
  186. })() +
  187. 3 +
  188. 2 +
  189. 3 +
  190. 2 +
  191. 3} with expr\`
  192. );
  193. pipe.write(
  194. \`\\n \${chalk.dim(
  195. \`\\u203A and \${more} more \${more} more \${more} more \${more}\`
  196. )}\`
  197. );
  198. // https://github.com/prettier/prettier/issues/1662#issue-230406820
  199. const content = \`
  200. const env = \${JSON.stringify(
  201. {
  202. assetsRootUrl: env.assetsRootUrl,
  203. env: env.env,
  204. role: "client",
  205. adsfafa: "sdfsdff",
  206. asdfasff: "wefwefw",
  207. fefef: "sf sdfs fdsfdsf s dfsfds"
  208. },
  209. null,
  210. "\\t"
  211. )});
  212. \`;
  213. // https://github.com/prettier/prettier/issues/821#issue-210557749
  214. f(
  215. \`\${{
  216. a: 4,
  217. b: 9
  218. }}\`
  219. );
  220. // https://github.com/prettier/prettier/issues/1183#issue-220863505
  221. const makeBody = (store, assets, html) =>
  222. \`<!doctype html>\${ReactDOMServer.renderToStaticMarkup(
  223. <Html
  224. headScripts={compact([assets.javascript.head])}
  225. headStyles={compact([assets.styles.body, assets.styles.head])}
  226. bodyScripts={compact([assets.javascript.body])}
  227. bodyStyles={[]}
  228. stringScripts={[
  229. \`window.__INITIAL_STATE__ = \${JSON.stringify(
  230. store.getState(),
  231. null,
  232. 2
  233. )};\`
  234. ]}
  235. content={[
  236. { id: "app-container", dangerouslySetInnerHTML: { __html: html } }
  237. ]}
  238. />
  239. )}\`;
  240. // https://github.com/prettier/prettier/issues/1626#issue-229655106
  241. const Bar = styled.div\`
  242. color: \${props =>
  243. props.highlight.length > 0
  244. ? palette(["text", "dark", "tertiary"])(props)
  245. : palette(["text", "dark", "primary"])(props)} !important;
  246. \`;
  247. `;
  248. exports[`template-literals.js 2`] = `
  249. foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 } with expr\`);
  250. const x = \`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {return 3 })() + 3 + 2 + 3 + 2 + 3 } with expr\`;
  251. foo(\`a long string \${ 1 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + 3 + 2 + ( function() {
  252. const x = 5;
  253. return x;
  254. })() + 3 + 2 + 3 + 2 + 3 } with expr\`);
  255. pipe.write(
  256. \`\\n \${chalk.dim(\`\\u203A and \${more} more \${more} more \${more} more \${more}\`)}\`,
  257. );
  258. // https://github.com/prettier/prettier/issues/1662#issue-230406820
  259. const content = \`
  260. const env = \${ JSON.stringify({
  261. assetsRootUrl: env.assetsRootUrl,
  262. env: env.env,
  263. role: "client",
  264. adsfafa: "sdfsdff",
  265. asdfasff: "wefwefw",
  266. fefef: "sf sdfs fdsfdsf s dfsfds"
  267. }, null, "\\t") });
  268. \`;
  269. // https://github.com/prettier/prettier/issues/821#issue-210557749
  270. f(\`\${{
  271. a: 4,
  272. b: 9,
  273. }}\`);
  274. // https://github.com/prettier/prettier/issues/1183#issue-220863505
  275. const makeBody = (store, assets, html) =>
  276. \`<!doctype html>\${
  277. ReactDOMServer.renderToStaticMarkup(
  278. <Html
  279. headScripts={compact([ assets.javascript.head ])}
  280. headStyles={compact([ assets.styles.body, assets.styles.head ])}
  281. bodyScripts={compact([ assets.javascript.body ])}
  282. bodyStyles={[]}
  283. stringScripts={[
  284. \`window.__INITIAL_STATE__ = \${
  285. JSON.stringify(store.getState(), null, 2)
  286. };\`,
  287. ]}
  288. content={[
  289. { id: 'app-container', dangerouslySetInnerHTML: { __html: html } },
  290. ]}
  291. />
  292. )
  293. }\`
  294. // https://github.com/prettier/prettier/issues/1626#issue-229655106
  295. const Bar = styled.div\`
  296. color: \${props => (props.highlight.length > 0 ? palette(['text', 'dark', 'tertiary'])(props) : palette(['text', 'dark', 'primary'])(props))} !important;
  297. \`
  298. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  299. foo(
  300. \`a long string \${1 +
  301. 2 +
  302. 3 +
  303. 2 +
  304. 3 +
  305. 2 +
  306. 3 +
  307. 2 +
  308. 3 +
  309. 2 +
  310. 3 +
  311. 2 +
  312. 3 +
  313. 2 +
  314. 3 +
  315. 2 +
  316. 3} with expr\`,
  317. );
  318. const x = \`a long string \${1 +
  319. 2 +
  320. 3 +
  321. 2 +
  322. 3 +
  323. 2 +
  324. 3 +
  325. 2 +
  326. 3 +
  327. 2 +
  328. 3 +
  329. 2 +
  330. (function() {
  331. return 3;
  332. })() +
  333. 3 +
  334. 2 +
  335. 3 +
  336. 2 +
  337. 3} with expr\`;
  338. foo(
  339. \`a long string \${1 +
  340. 2 +
  341. 3 +
  342. 2 +
  343. 3 +
  344. 2 +
  345. 3 +
  346. 2 +
  347. 3 +
  348. 2 +
  349. 3 +
  350. 2 +
  351. (function() {
  352. const x = 5;
  353. return x;
  354. })() +
  355. 3 +
  356. 2 +
  357. 3 +
  358. 2 +
  359. 3} with expr\`,
  360. );
  361. pipe.write(
  362. \`\\n \${chalk.dim(
  363. \`\\u203A and \${more} more \${more} more \${more} more \${more}\`,
  364. )}\`,
  365. );
  366. // https://github.com/prettier/prettier/issues/1662#issue-230406820
  367. const content = \`
  368. const env = \${JSON.stringify(
  369. {
  370. assetsRootUrl: env.assetsRootUrl,
  371. env: env.env,
  372. role: "client",
  373. adsfafa: "sdfsdff",
  374. asdfasff: "wefwefw",
  375. fefef: "sf sdfs fdsfdsf s dfsfds",
  376. },
  377. null,
  378. "\\t",
  379. )});
  380. \`;
  381. // https://github.com/prettier/prettier/issues/821#issue-210557749
  382. f(
  383. \`\${{
  384. a: 4,
  385. b: 9,
  386. }}\`,
  387. );
  388. // https://github.com/prettier/prettier/issues/1183#issue-220863505
  389. const makeBody = (store, assets, html) =>
  390. \`<!doctype html>\${ReactDOMServer.renderToStaticMarkup(
  391. <Html
  392. headScripts={compact([assets.javascript.head])}
  393. headStyles={compact([assets.styles.body, assets.styles.head])}
  394. bodyScripts={compact([assets.javascript.body])}
  395. bodyStyles={[]}
  396. stringScripts={[
  397. \`window.__INITIAL_STATE__ = \${JSON.stringify(
  398. store.getState(),
  399. null,
  400. 2,
  401. )};\`,
  402. ]}
  403. content={[
  404. { id: "app-container", dangerouslySetInnerHTML: { __html: html } },
  405. ]}
  406. />,
  407. )}\`;
  408. // https://github.com/prettier/prettier/issues/1626#issue-229655106
  409. const Bar = styled.div\`
  410. color: \${props =>
  411. props.highlight.length > 0
  412. ? palette(["text", "dark", "tertiary"])(props)
  413. : palette(["text", "dark", "primary"])(props)} !important;
  414. \`;
  415. `;