11// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22
3- exports [` embedded_languages > should format embedded languages (CSS, GraphQL, HTML, Markdown) 1` ] = `
3+ exports [` embedded_languages > should format embedded languages by default 1` ] = `
44"--- FILE -----------
55embedded_languages.js
66--- BEFORE ---------
@@ -304,7 +304,7 @@ const sql = sql\`
304304--------------------"
305305` ;
306306
307- exports [` embedded_languages > should not format embedded languages by default (at alpha release) 1` ] = `
307+ exports [` embedded_languages > should format embedded languages when embeddedLanguageFormatting is auto 1` ] = `
308308"--- FILE -----------
309309embedded_languages.js
310310--- BEFORE ---------
@@ -427,52 +427,108 @@ const sql = sql\`
427427// CSS - Tagged template literals with css and styled tags
428428// ============================================================================
429429
430- const styles = css\` .button{ color :red ;background :blue ;padding :10px 20px ;} .container{ display :flex ;justify - content :center ;} \` ;
430+ const styles = css\`
431+ .button {
432+ color : red ;
433+ background : blue ;
434+ padding : 10px 20px ;
435+ }
436+ .container {
437+ display : flex ;
438+ justify - content : center ;
439+ }
440+ \` ;
431441
432- const styledComponent = styled\` background-color:#ffffff;border-radius:4px;padding:8px;\` ;
442+ const styledComponent = styled\`
443+ background-color: #ffffff;
444+ border-radius: 4px;
445+ padding: 8px;
446+ \` ;
433447
434448// ============================================================================
435449// GraphQL - Tagged template literals with gql and graphql tags
436450// ============================================================================
437451
438- const query = gql\` query GetUser($id:ID!){ user (id :$id ){name email posts{title }} }\` ;
452+ const query = gql\`
453+ query GetUser($id: ID!) {
454+ user (id : $id ) {
455+ name
456+ email
457+ posts {
458+ title
459+ }
460+ }
461+ }
462+ \` ;
439463
440- const mutation = graphql\` mutation CreatePost($input:PostInput!){ createPost (input :$input ){id title }} \` ;
464+ const mutation = graphql\`
465+ mutation CreatePost($input: PostInput!) {
466+ createPost (input : $input ) {
467+ id
468+ title
469+ }
470+ }
471+ \` ;
441472
442473// ============================================================================
443474// HTML - Tagged template literals with html tag
444475// ============================================================================
445476
446- const template = html\` <div class = " container" ><h1 >Hello World</h1 ><p >This is a paragraph with <strong >bold</strong > text.</p ></div >\` ;
477+ const template = html\`
478+ <div class = " container" >
479+ <h1 >Hello World</h1 >
480+ <p >This is a paragraph with <strong >bold</strong > text.</p >
481+ </div >
482+ \` ;
447483
448- const component = html\` <button type = " button" onclick = " handleClick()" >Click me</button >\` ;
484+ const component = html\`
485+ <button type = " button" onclick = " handleClick()" >Click me</button >
486+ \` ;
449487
450488// ============================================================================
451489// Markdown - Tagged template literals with md and markdown tags
452490// ============================================================================
453491
454- const documentation = md\` #Heading
455- This is **bold** and this is _italic_.
456- -Item 1
457- -Item 2\` ;
492+ const documentation = md\`
493+ #Heading
494+ This is **bold** and this is _italic_.
495+ -Item 1
496+ -Item 2
497+ \` ;
458498
459- const readme = markdown\` ##Installation
460- \\\`\\\`\\\` bash
461- npm install package
462- \\\`\\\`\\\`\` ;
499+ const readme = markdown\`
500+ ##Installation
501+ \\\`\\\`\\\` bash
502+ npm install package
503+ \\\`\\\`\\\`
504+ \` ;
463505
464506// ============================================================================
465507// Mixed - Multiple embedded languages in one file
466508// ============================================================================
467509
468- const mixedStyles = css\` .button{ color :red ;} \` ;
510+ const mixedStyles = css\`
511+ .button {
512+ color : red ;
513+ }
514+ \` ;
469515
470- const mixedQuery = gql\` query{ users {name }} \` ;
516+ const mixedQuery = gql\`
517+ query {
518+ users {
519+ name
520+ }
521+ }
522+ \` ;
471523
472- const mixedTemplate = html\` <div ><h1 >Title</h1 ></div >\` ;
524+ const mixedTemplate = html\`
525+ <div ><h1 >Title</h1 ></div >
526+ \` ;
473527
474- const mixedDocs = md\` #Documentation
475- This is **important**.\` ;
528+ const mixedDocs = md\`
529+ #Documentation
530+ This is **important**.
531+ \` ;
476532
477533// ============================================================================
478534// No Embedded Languages - Regular JavaScript (no tagged templates)
@@ -497,12 +553,24 @@ class Formatter {
497553// prettier-ignore
498554const unformatted = css\` .button{ color :red ;background :blue ;border :1px solid green ;} \` ;
499555
500- const formattedCss = css\` .container{ display :flex ;align - items :center ;} \` ;
556+ const formattedCss = css\`
557+ .container {
558+ display : flex ;
559+ align - items : center ;
560+ }
561+ \` ;
501562
502563// prettier-ignore
503564const ignoredGql = gql\` query GetUser($id:ID!){ user (id :$id ){name email }} \` ;
504565
505- const normalGql = gql\` query GetPosts{ posts {title author }} \` ;
566+ const normalGql = gql\`
567+ query GetPosts {
568+ posts {
569+ title
570+ author
571+ }
572+ }
573+ \` ;
506574
507575// ============================================================================
508576// Unsupported Tags - Tags not recognized by the formatter
0 commit comments