diff --git a/tests/glimmer/__snapshots__/jsfmt.spec.js.snap b/tests/glimmer/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 80f37894..00000000 --- a/tests/glimmer/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,1658 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`block-statement.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} -{{/block}} - -{{#block param param param param param param param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} - Hello -{{/block}} - -{{#block param param param param param param param param param param param param param}} - Hello -{{/block}} - -{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} - Hello -{{/block}} - -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} - -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block}} - hello -{{/block}} - - - {{firstName}} - - - - {{firstName}} {{lastName}} - - -=====================================output===================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} -{{#block - almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars - helloWorldParam - key=here -}}{{/block}} -{{#block - param - param - param - param - param - param - param - hashKey=hashValue as |blockParam| -}} - Hello -{{/block}} -{{#block - param - param - param - param - param - param - param - hashKey=HashValue - hashKey=hashValue -}} - Hello -{{/block}} -{{#block - param - param - param - param - param - param - param - param - param - param - param - param - param -}} - Hello -{{/block}} -{{#block - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue -}} - Hello -{{/block}} -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} -{{#block}} - hello -{{/block}} - - {{firstName}} - - - {{firstName}} {{lastName}} - -================================================================================ -`; - -exports[`block-statement.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} -{{/block}} - -{{#block param param param param param param param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} - -{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} - Hello -{{/block}} - -{{#block param param param param param param param param param param param param param}} - Hello -{{/block}} - -{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} - Hello -{{/block}} - -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} - -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} - -{{#block}} - hello -{{/block}} - - - {{firstName}} - - - - {{firstName}} {{lastName}} - - -=====================================output===================================== -{{#block param hashKey=hashValue as |blockParam|}} - Hello -{{/block}} -{{#block - almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars - helloWorldParam - key=here -}}{{/block}} -{{#block - param - param - param - param - param - param - param - hashKey=hashValue as |blockParam| -}} - Hello -{{/block}} -{{#block - param - param - param - param - param - param - param - hashKey=HashValue - hashKey=hashValue -}} - Hello -{{/block}} -{{#block - param - param - param - param - param - param - param - param - param - param - param - param - param -}} - Hello -{{/block}} -{{#block - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue - hashKey=hashValue - hashKey=HashValue -}} - Hello -{{/block}} -{{#block}} - {{#block}} - hello - {{/block}} -{{/block}} -{{#block}} - {{#block param}} - hello - {{/block}} -{{/block}} -{{#block param}} - {{#block param}} - hello - {{/block}} -{{/block}} -{{#block}} - hello -{{/block}} - - {{firstName}} - - - {{firstName}} {{lastName}} - -================================================================================ -`; - -exports[`comment.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- {{! Foo }} - {{#if @foo}} - Foo - {{/if}} - - {{! Bar }} - {{#if @bar}} - Bar - {{/if}} -
-=====================================output===================================== -
- {{! Foo }} - {{#if @foo}} - Foo - {{/if}} - {{! Bar }} - {{#if @bar}} - Bar - {{/if}} -
-================================================================================ -`; - -exports[`comment.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- {{! Foo }} - {{#if @foo}} - Foo - {{/if}} - - {{! Bar }} - {{#if @bar}} - Bar - {{/if}} -
-=====================================output===================================== -
- {{! Foo }} - {{#if @foo}} - Foo - {{/if}} - {{! Bar }} - {{#if @bar}} - Bar - {{/if}} -
-================================================================================ -`; - -exports[`component.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== - -{{@greeting}}, {{@name}}! - -
- -
- -
- - hello - - - - - - - - - - - - -
Hello
- -=====================================output===================================== - -{{@greeting}} -, -{{@name}} -! -
- -
-
- - - hello - - - - - - - -
- Hello -
-================================================================================ -`; - -exports[`component.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== - -{{@greeting}}, {{@name}}! - -
- -
- -
- - hello - - - - - - - - - - - - -
Hello
- -=====================================output===================================== - -{{@greeting}} -, -{{@name}} -! -
- -
-
- - - hello - - - - - - - -
- Hello -
-================================================================================ -`; - -exports[`concat-statement.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- - - -
-
-
-
-
-
-
-
-
-
-=====================================output===================================== -
- Hello -
-
- Hello -
- -
-
-
-
-
-
-
-
-
-
-================================================================================ -`; - -exports[`concat-statement.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- - - -
-
-
-
-
-
-
-
-
-
-=====================================output===================================== -
- Hello -
-
- Hello -
- -
-
-
-
-
-
-
-
-
-
-================================================================================ -`; - -exports[`curly.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -

Your username is @{{name}}

-

Hi {{firstName}} {{lastName}}

-=====================================output===================================== -

- Your username is @{{name}} -

-

- Hi {{firstName}} {{lastName}} -

-================================================================================ -`; - -exports[`curly.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -

Your username is @{{name}}

-

Hi {{firstName}} {{lastName}}

-=====================================output===================================== -

- Your username is @{{name}} -

-

- Hi {{firstName}} {{lastName}} -

-================================================================================ -`; - -exports[`element-modifier-statement.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- Hello -
- -
- Hello -
- -=====================================output===================================== -
- Hello -
-
- Hello -
-
- Hello -
-
- Hello -
-================================================================================ -`; - -exports[`element-modifier-statement.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- Hello -
- -
- Hello -
- -=====================================output===================================== -
- Hello -
-
- Hello -
-
- Hello -
-
- Hello -
-================================================================================ -`; - -exports[`element-node.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- hi -
- -
- A long enough string to trigger a line break that would prevent wrapping. -
- -
- A long enough string to trigger a line break that would prevent wrapping more. -
- -
- A long enough string to trigger a line break that would prevent wrapping more and more. -
- -
- {{#block}} - {{hello}} - {{/block}} -
- -
- {{hello}} -
- -
- - -=====================================output===================================== -
- Hello -
-
- Hello -
-
- hi -
-
- A long enough string to trigger a line break that would prevent wrapping. -
-
- A long enough string to trigger a line break that would prevent wrapping more. -
-
- A long enough string to trigger a line break that would prevent wrapping more and more. -
-
- {{#block}} - {{hello}} - {{/block}} -
-
- {{hello}} -
-
- -================================================================================ -`; - -exports[`element-node.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- Hello -
- -
- Hello -
- -
- hi -
- -
- A long enough string to trigger a line break that would prevent wrapping. -
- -
- A long enough string to trigger a line break that would prevent wrapping more. -
- -
- A long enough string to trigger a line break that would prevent wrapping more and more. -
- -
- {{#block}} - {{hello}} - {{/block}} -
- -
- {{hello}} -
- -
- - -=====================================output===================================== -
- Hello -
-
- Hello -
-
- hi -
-
- A long enough string to trigger a line break that would prevent wrapping. -
-
- A long enough string to trigger a line break that would prevent wrapping more. -
-
- A long enough string to trigger a line break that would prevent wrapping more and more. -
-
- {{#block}} - {{hello}} - {{/block}} -
-
- {{hello}} -
-
- -================================================================================ -`; - -exports[`else-if.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} - -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
- -
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
- -{{#if a}} - b -{{else}} - {{#each c as |d|}} - e - {{/each}} -{{/if}} - -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} - -{{#if a}} - a -
b
- c -{{else}} - {{#if c}} - a - b -
c
- {{/if}} -
a
- b - c -{{/if}} - -=====================================output===================================== -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
-{{#if a}} - b -{{else}} - {{#each c as |d|}} - e - {{/each}} -{{/if}} -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} -{{#if a}} - a -
- b -
- c -{{else}} - {{#if c}} - a - b -
- c -
- {{/if}} -
- a -
- b - c -{{/if}} -================================================================================ -`; - -exports[`else-if.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} - -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} - -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
- -
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
- -{{#if a}} - b -{{else}} - {{#each c as |d|}} - e - {{/each}} -{{/if}} - -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} - -{{#if a}} - a -
b
- c -{{else}} - {{#if c}} - a - b -
c
- {{/if}} -
a
- b - c -{{/if}} - -=====================================output===================================== -{{#if a}} - b -{{else if c}} - d -{{else}} - e -{{/if}} -{{#if a}} - b -{{else if c}} - d -{{else}} - hello - {{#if f}} - g - {{/if}} - e -{{/if}} -{{#if a}} - b -{{else if c}} - d -{{else if e}} - f -{{else if g}} - h -{{else}} - j -{{/if}} -
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
-
- {{#if a}} - b - {{else if c}} - d - {{else}} - e - {{/if}} -
-
-{{#if a}} - b -{{else}} - {{#each c as |d|}} - e - {{/each}} -{{/if}} -{{#if a}} - {{#if b}} - ab - {{else if c}} - ac - {{/if}} -{{/if}} -{{#if a}} - a -
- b -
- c -{{else}} - {{#if c}} - a - b -
- c -
- {{/if}} -
- a -
- b - c -{{/if}} -================================================================================ -`; - -exports[`html-entities.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -

Some escaped characters: < > &

-=====================================output===================================== -

- Some escaped characters: < > & -

-================================================================================ -`; - -exports[`html-entities.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -

Some escaped characters: < > &

-=====================================output===================================== -

- Some escaped characters: < > & -

-================================================================================ -`; - -exports[`literals.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} - -=====================================output===================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} -================================================================================ -`; - -exports[`literals.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} - -=====================================output===================================== -{{mustache true}} -{{mustache 5}} -{{mustache undefined}} -{{mustache null}} - -{{! Mustache Comment}} -{{!-- Mustache Comment }} --}} -================================================================================ -`; - -exports[`loop.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
    - {{#each speakers key="@index" as |speaker|}} -
  • {{speaker}}
  • - {{/each}} -
- -=====================================output===================================== -
    - {{#each speakers key="@index" as |speaker|}} -
  • - {{speaker}} -
  • - {{/each}} -
-================================================================================ -`; - -exports[`loop.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
    - {{#each speakers key="@index" as |speaker|}} -
  • {{speaker}}
  • - {{/each}} -
- -=====================================output===================================== -
    - {{#each speakers key='@index' as |speaker|}} -
  • - {{speaker}} -
  • - {{/each}} -
-================================================================================ -`; - -exports[`string-literals.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{"abc"}} -{{'abc'}} -{{" \\" \\" ' more double quote than single quote "}} -{{' \\' \\' " more single quote than double quote '}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} - -=====================================output===================================== -{{"abc"}} -{{"abc"}} -{{' " " \\' more double quote than single quote '}} -{{" ' ' \\" more single quote than double quote "}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} -================================================================================ -`; - -exports[`string-literals.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -{{"abc"}} -{{'abc'}} -{{" \\" \\" ' more double quote than single quote "}} -{{' \\' \\' " more single quote than double quote '}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} - -=====================================output===================================== -{{'abc'}} -{{'abc'}} -{{' " " \\' more double quote than single quote '}} -{{" ' ' \\" more single quote than double quote "}} -{{' " \\' \\" \\\\ '}} -{{" \\" \\' ' \\\\ "}} -================================================================================ -`; - -exports[`sub-expressions.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- -{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) - hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}} - -{{/block}} - -{{foobar-sub-component/foobar-foo - hook="stringLiteral" - foo= - (t - (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} - -=====================================output===================================== -
-{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper - param param param param hashPair=value hashPair=value hashPair=Value - ) - hashPair=(helper - param - param - param - param - param - param - hashPair=value - hashPair=value - hashPair=value - ) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}}{{/block}} -{{foobar-sub-component/foobar-foo - hook="stringLiteral" - foo=(t - (concat - "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash - ) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} -================================================================================ -`; - -exports[`sub-expressions.hbs 2`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 -singleQuote: true - | printWidth -=====================================input====================================== -
- -{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) - hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}} - -{{/block}} - -{{foobar-sub-component/foobar-foo - hook="stringLiteral" - foo= - (t - (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} - -=====================================output===================================== -
-{{#block - (concat - (service) - (helper param hashPair=Value) - (largeNameHelper - param param param param hashPair=value hashPair=value hashPair=Value - ) - hashPair=(helper - param - param - param - param - param - param - hashPair=value - hashPair=value - hashPair=value - ) - hashPair=(does not need a line break due to being under 80 chars long) - ) -}}{{/block}} -{{foobar-sub-component/foobar-foo - hook='stringLiteral' - foo=(t - (concat - 'stringLiteral' (get blockParam 'stringLiteral') hash=hash hash=hash - ) - foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) - ) -}} -================================================================================ -`; diff --git a/tests/glimmer/comment.hbs b/tests/glimmer/comment.hbs deleted file mode 100644 index 8b49144e..00000000 --- a/tests/glimmer/comment.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
- {{! Foo }} - {{#if @foo}} - Foo - {{/if}} - - {{! Bar }} - {{#if @bar}} - Bar - {{/if}} -
\ No newline at end of file diff --git a/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..aa576549 --- /dev/null +++ b/tests/handlebars-basics/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,381 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`basic-handlebars.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +
+ +=====================================output===================================== + +
+================================================================================ +`; + +exports[`basic-handlebars.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + + +
+ +=====================================output===================================== + +
+================================================================================ +`; + +exports[`component.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== + +{{@greeting}}, {{@name}}! + +
+ +
+ +
+ + hello + + + + + + + + + + + + +
Hello
+ +=====================================output===================================== + +{{@greeting}} +, +{{@name}} +! +
+ +
+
+ + + hello + + + + + + + +
+ Hello +
+================================================================================ +`; + +exports[`component.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + +{{@greeting}}, {{@name}}! + +
+ +
+ +
+ + hello + + + + + + + + + + + + +
Hello
+ +=====================================output===================================== + +{{@greeting}} +, +{{@name}} +! +
+ +
+
+ + + hello + + + + + + + +
+ Hello +
+================================================================================ +`; + +exports[`literals.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} + +=====================================output===================================== +{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} +================================================================================ +`; + +exports[`literals.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} + +=====================================output===================================== +{{mustache true}} +{{mustache 5}} +{{mustache undefined}} +{{mustache null}} + +{{! Mustache Comment}} +{{!-- Mustache Comment }} --}} +================================================================================ +`; + +exports[`nested-path.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+

{{title}}

+

By {{author.name}}

+ +
+ {{body}} +
+
+ +=====================================output===================================== +
+

+ {{title}} +

+

+ By {{author.name}} +

+
+ {{body}} +
+
+================================================================================ +`; + +exports[`nested-path.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+

{{title}}

+

By {{author.name}}

+ +
+ {{body}} +
+
+ +=====================================output===================================== +
+

+ {{title}} +

+

+ By {{author.name}} +

+
+ {{body}} +
+
+================================================================================ +`; + +exports[`raw.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +

{{{raw}}}

+ +=====================================output===================================== +

+ {{{raw}}} +

+================================================================================ +`; + +exports[`raw.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +

{{{raw}}}

+ +=====================================output===================================== +

+ {{{raw}}} +

+================================================================================ +`; + +exports[`string-literals.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +{{"abc"}} +{{'abc'}} +{{" \\" \\" ' more double quote than single quote "}} +{{' \\' \\' " more single quote than double quote '}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} + +=====================================output===================================== +{{"abc"}} +{{"abc"}} +{{' " " \\' more double quote than single quote '}} +{{" ' ' \\" more single quote than double quote "}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} +================================================================================ +`; + +exports[`string-literals.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +{{"abc"}} +{{'abc'}} +{{" \\" \\" ' more double quote than single quote "}} +{{' \\' \\' " more single quote than double quote '}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} + +=====================================output===================================== +{{'abc'}} +{{'abc'}} +{{' " " \\' more double quote than single quote '}} +{{" ' ' \\" more single quote than double quote "}} +{{' " \\' \\" \\\\ '}} +{{" \\" \\' ' \\\\ "}} +================================================================================ +`; diff --git a/tests/handlebars/basic-handlebars.hbs b/tests/handlebars-basics/basic-handlebars.hbs similarity index 100% rename from tests/handlebars/basic-handlebars.hbs rename to tests/handlebars-basics/basic-handlebars.hbs diff --git a/tests/glimmer/component.hbs b/tests/handlebars-basics/component.hbs similarity index 100% rename from tests/glimmer/component.hbs rename to tests/handlebars-basics/component.hbs diff --git a/tests/glimmer/jsfmt.spec.js b/tests/handlebars-basics/jsfmt.spec.js similarity index 100% rename from tests/glimmer/jsfmt.spec.js rename to tests/handlebars-basics/jsfmt.spec.js diff --git a/tests/glimmer/literals.hbs b/tests/handlebars-basics/literals.hbs similarity index 100% rename from tests/glimmer/literals.hbs rename to tests/handlebars-basics/literals.hbs diff --git a/tests/handlebars/nested-path.hbs b/tests/handlebars-basics/nested-path.hbs similarity index 100% rename from tests/handlebars/nested-path.hbs rename to tests/handlebars-basics/nested-path.hbs diff --git a/tests/handlebars/raw.hbs b/tests/handlebars-basics/raw.hbs similarity index 100% rename from tests/handlebars/raw.hbs rename to tests/handlebars-basics/raw.hbs diff --git a/tests/glimmer/string-literals.hbs b/tests/handlebars-basics/string-literals.hbs similarity index 100% rename from tests/glimmer/string-literals.hbs rename to tests/handlebars-basics/string-literals.hbs diff --git a/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..de285353 --- /dev/null +++ b/tests/handlebars-block-statement/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,825 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`block-statement.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} +{{/block}} + +{{#block param param param param param param param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} + Hello +{{/block}} + +{{#block param param param param param param param param param param param param param}} + Hello +{{/block}} + +{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} + Hello +{{/block}} + +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} + +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block}} + hello +{{/block}} + + + {{firstName}} + + + + {{firstName}} {{lastName}} + + +=====================================output===================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} +{{#block + almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars + helloWorldParam + key=here +}}{{/block}} +{{#block + param + param + param + param + param + param + param + hashKey=hashValue as |blockParam| +}} + Hello +{{/block}} +{{#block + param + param + param + param + param + param + param + hashKey=HashValue + hashKey=hashValue +}} + Hello +{{/block}} +{{#block + param + param + param + param + param + param + param + param + param + param + param + param + param +}} + Hello +{{/block}} +{{#block + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue +}} + Hello +{{/block}} +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} +{{#block}} + hello +{{/block}} + + {{firstName}} + + + {{firstName}} {{lastName}} + +================================================================================ +`; + +exports[`block-statement.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars helloWorldParam key=here}} +{{/block}} + +{{#block param param param param param param param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} + +{{#block param param param param param param param hashKey=HashValue hashKey=hashValue}} + Hello +{{/block}} + +{{#block param param param param param param param param param param param param param}} + Hello +{{/block}} + +{{#block hashKey=HashValue hashKey=hashValue hashKey=HashValue hashKey=hashValue hashKey=HashValue}} + Hello +{{/block}} + +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} + +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} + +{{#block}} + hello +{{/block}} + + + {{firstName}} + + + + {{firstName}} {{lastName}} + + +=====================================output===================================== +{{#block param hashKey=hashValue as |blockParam|}} + Hello +{{/block}} +{{#block + almost80CharacterLongPositionalParamThatIsFirstAlmost80Chars + helloWorldParam + key=here +}}{{/block}} +{{#block + param + param + param + param + param + param + param + hashKey=hashValue as |blockParam| +}} + Hello +{{/block}} +{{#block + param + param + param + param + param + param + param + hashKey=HashValue + hashKey=hashValue +}} + Hello +{{/block}} +{{#block + param + param + param + param + param + param + param + param + param + param + param + param + param +}} + Hello +{{/block}} +{{#block + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue + hashKey=hashValue + hashKey=HashValue +}} + Hello +{{/block}} +{{#block}} + {{#block}} + hello + {{/block}} +{{/block}} +{{#block}} + {{#block param}} + hello + {{/block}} +{{/block}} +{{#block param}} + {{#block param}} + hello + {{/block}} +{{/block}} +{{#block}} + hello +{{/block}} + + {{firstName}} + + + {{firstName}} {{lastName}} + +================================================================================ +`; + +exports[`each.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ {{#each comments}} +

{{title}}

+
{{body}}
+ {{/each}} +
+ +=====================================output===================================== +
+ {{#each comments}} +

+ + {{title}} + +

+
+ {{body}} +
+ {{/each}} +
+================================================================================ +`; + +exports[`each.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ {{#each comments}} +

{{title}}

+
{{body}}
+ {{/each}} +
+ +=====================================output===================================== +
+ {{#each comments}} +

+ + {{title}} + +

+
+ {{body}} +
+ {{/each}} +
+================================================================================ +`; + +exports[`if-else.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +

+{{#if isAtWork}} + Ship that code! +{{else if isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/if}} +

+ +

+{{#if a}} + A +{{else}} + B +{{/if}} +

+ +{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} + +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+ +
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+ +{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} + +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} + +{{#if a}} + a +
b
+ c +{{else}} + {{#if c}} + a + b +
c
+ {{/if}} +
a
+ b + c +{{/if}} + +=====================================output===================================== +

+ {{#if isAtWork}} + Ship that code! + {{else if isReading}} + You can finish War and Peace eventually... + {{else}} + Go to bed! + {{/if}} +

+

+ {{#if a}} + A + {{else}} + B + {{/if}} +

+{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} +{{#if a}} + a +
+ b +
+ c +{{else}} + {{#if c}} + a + b +
+ c +
+ {{/if}} +
+ a +
+ b + c +{{/if}} +================================================================================ +`; + +exports[`if-else.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +

+{{#if isAtWork}} + Ship that code! +{{else if isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/if}} +

+ +

+{{#if a}} + A +{{else}} + B +{{/if}} +

+ +{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} + +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} + +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+ +
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+ +{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} + +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} + +{{#if a}} + a +
b
+ c +{{else}} + {{#if c}} + a + b +
c
+ {{/if}} +
a
+ b + c +{{/if}} + +=====================================output===================================== +

+ {{#if isAtWork}} + Ship that code! + {{else if isReading}} + You can finish War and Peace eventually... + {{else}} + Go to bed! + {{/if}} +

+

+ {{#if a}} + A + {{else}} + B + {{/if}} +

+{{#if a}} + b +{{else if c}} + d +{{else}} + e +{{/if}} +{{#if a}} + b +{{else if c}} + d +{{else}} + hello + {{#if f}} + g + {{/if}} + e +{{/if}} +{{#if a}} + b +{{else if c}} + d +{{else if e}} + f +{{else if g}} + h +{{else}} + j +{{/if}} +
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+
+ {{#if a}} + b + {{else if c}} + d + {{else}} + e + {{/if}} +
+
+{{#if a}} + b +{{else}} + {{#each c as |d|}} + e + {{/each}} +{{/if}} +{{#if a}} + {{#if b}} + ab + {{else if c}} + ac + {{/if}} +{{/if}} +{{#if a}} + a +
+ b +
+ c +{{else}} + {{#if c}} + a + b +
+ c +
+ {{/if}} +
+ a +
+ b + c +{{/if}} +================================================================================ +`; + +exports[`loop.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
    + {{#each speakers key="@index" as |speaker|}} +
  • {{speaker}}
  • + {{/each}} +
+ +=====================================output===================================== +
    + {{#each speakers key="@index" as |speaker|}} +
  • + {{speaker}} +
  • + {{/each}} +
+================================================================================ +`; + +exports[`loop.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
    + {{#each speakers key="@index" as |speaker|}} +
  • {{speaker}}
  • + {{/each}} +
+ +=====================================output===================================== +
    + {{#each speakers key='@index' as |speaker|}} +
  • + {{speaker}} +
  • + {{/each}} +
+================================================================================ +`; diff --git a/tests/glimmer/block-statement.hbs b/tests/handlebars-block-statement/block-statement.hbs similarity index 100% rename from tests/glimmer/block-statement.hbs rename to tests/handlebars-block-statement/block-statement.hbs diff --git a/tests/handlebars/each.hbs b/tests/handlebars-block-statement/each.hbs similarity index 100% rename from tests/handlebars/each.hbs rename to tests/handlebars-block-statement/each.hbs diff --git a/tests/glimmer/else-if.hbs b/tests/handlebars-block-statement/if-else.hbs similarity index 78% rename from tests/glimmer/else-if.hbs rename to tests/handlebars-block-statement/if-else.hbs index 94e1fdf8..350252fc 100644 --- a/tests/glimmer/else-if.hbs +++ b/tests/handlebars-block-statement/if-else.hbs @@ -1,3 +1,21 @@ +

+{{#if isAtWork}} + Ship that code! +{{else if isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/if}} +

+ +

+{{#if a}} + A +{{else}} + B +{{/if}} +

+ {{#if a}} b {{else if c}} diff --git a/tests/handlebars-block-statement/jsfmt.spec.js b/tests/handlebars-block-statement/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-block-statement/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/glimmer/loop.hbs b/tests/handlebars-block-statement/loop.hbs similarity index 73% rename from tests/glimmer/loop.hbs rename to tests/handlebars-block-statement/loop.hbs index 608d1259..5e28341d 100644 --- a/tests/glimmer/loop.hbs +++ b/tests/handlebars-block-statement/loop.hbs @@ -1,5 +1,5 @@
    {{#each speakers key="@index" as |speaker|}} -
  • {{speaker}}
  • +
  • {{speaker}}
  • {{/each}}
diff --git a/tests/handlebars-comment/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-comment/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..0f1f94ce --- /dev/null +++ b/tests/handlebars-comment/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ {{! Foo }} + {{#if @foo}} + Foo + {{/if}} + + {{! Bar }} + {{#if @bar}} + Bar + {{/if}} +
+ +
+ {{! This comment will not be in the output }} + {{!-- This comment as }} and will not be in the output --}} + +
+ +=====================================output===================================== +
+ {{! Foo }} + {{#if @foo}} + Foo + {{/if}} + {{! Bar }} + {{#if @bar}} + Bar + {{/if}} +
+
+ {{! This comment will not be in the output }} + {{!-- This comment as }} and will not be in the output --}} + +
+================================================================================ +`; diff --git a/tests/handlebars/comments.hbs b/tests/handlebars-comment/comments.hbs similarity index 63% rename from tests/handlebars/comments.hbs rename to tests/handlebars-comment/comments.hbs index c2a47ee0..5df2a8a4 100644 --- a/tests/handlebars/comments.hbs +++ b/tests/handlebars-comment/comments.hbs @@ -1,3 +1,15 @@ +
+ {{! Foo }} + {{#if @foo}} + Foo + {{/if}} + + {{! Bar }} + {{#if @bar}} + Bar + {{/if}} +
+
{{! This comment will not be in the output }} {{!-- This comment as }} and will not be in the output --}} diff --git a/tests/handlebars/jsfmt.spec.js b/tests/handlebars-comment/jsfmt.spec.js similarity index 100% rename from tests/handlebars/jsfmt.spec.js rename to tests/handlebars-comment/jsfmt.spec.js diff --git a/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..fd651801 --- /dev/null +++ b/tests/handlebars-concat-statement/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,118 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`concat-statement.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ + + +
+
+
+
+
+
+
+
+
+
+=====================================output===================================== +
+ Hello +
+
+ Hello +
+ +
+
+
+
+
+
+
+
+
+
+================================================================================ +`; + +exports[`concat-statement.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ + + +
+
+
+
+
+
+
+
+
+
+=====================================output===================================== +
+ Hello +
+
+ Hello +
+ +
+
+
+
+
+
+
+
+
+
+================================================================================ +`; diff --git a/tests/glimmer/concat-statement.hbs b/tests/handlebars-concat-statement/concat-statement.hbs similarity index 100% rename from tests/glimmer/concat-statement.hbs rename to tests/handlebars-concat-statement/concat-statement.hbs diff --git a/tests/handlebars-concat-statement/jsfmt.spec.js b/tests/handlebars-concat-statement/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-concat-statement/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..987e7e26 --- /dev/null +++ b/tests/handlebars-element-node/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,152 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`element-node.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ +
+ hi +
+ +
+ A long enough string to trigger a line break that would prevent wrapping. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+ +
+ {{#block}} + {{hello}} + {{/block}} +
+ +
+ {{hello}} +
+ +
+ + +=====================================output===================================== +
+ Hello +
+
+ Hello +
+
+ hi +
+
+ A long enough string to trigger a line break that would prevent wrapping. +
+
+ A long enough string to trigger a line break that would prevent wrapping more. +
+
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+
+ {{#block}} + {{hello}} + {{/block}} +
+
+ {{hello}} +
+
+ +================================================================================ +`; + +exports[`element-node.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ +
+ hi +
+ +
+ A long enough string to trigger a line break that would prevent wrapping. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more. +
+ +
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+ +
+ {{#block}} + {{hello}} + {{/block}} +
+ +
+ {{hello}} +
+ +
+ + +=====================================output===================================== +
+ Hello +
+
+ Hello +
+
+ hi +
+
+ A long enough string to trigger a line break that would prevent wrapping. +
+
+ A long enough string to trigger a line break that would prevent wrapping more. +
+
+ A long enough string to trigger a line break that would prevent wrapping more and more. +
+
+ {{#block}} + {{hello}} + {{/block}} +
+
+ {{hello}} +
+
+ +================================================================================ +`; diff --git a/tests/glimmer/element-node.hbs b/tests/handlebars-element-node/element-node.hbs similarity index 100% rename from tests/glimmer/element-node.hbs rename to tests/handlebars-element-node/element-node.hbs diff --git a/tests/handlebars-element-node/jsfmt.spec.js b/tests/handlebars-element-node/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-element-node/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..f593d0c0 --- /dev/null +++ b/tests/handlebars-escape/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`html-entities.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +

Some escaped characters: < > &

+=====================================output===================================== +

+ Some escaped characters: < > & +

+================================================================================ +`; + +exports[`html-entities.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +

Some escaped characters: < > &

+=====================================output===================================== +

+ Some escaped characters: < > & +

+================================================================================ +`; diff --git a/tests/glimmer/html-entities.hbs b/tests/handlebars-escape/html-entities.hbs similarity index 100% rename from tests/glimmer/html-entities.hbs rename to tests/handlebars-escape/html-entities.hbs diff --git a/tests/handlebars-escape/jsfmt.spec.js b/tests/handlebars-escape/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-escape/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..ba4ac6a8 --- /dev/null +++ b/tests/handlebars-last-line/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`empty-with-no-trailing-newline.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; + +exports[`empty-with-no-trailing-newline.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; + +exports[`empty-with-trailing-newline.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + +================================================================================ +`; + +exports[`empty-with-trailing-newline.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== + + +=====================================output===================================== + +================================================================================ +`; + +exports[`end-of-line-last.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +a bare string to hightlight eol last handling + +=====================================output===================================== +a bare string to hightlight eol last handling +================================================================================ +`; + +exports[`end-of-line-last.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +a bare string to hightlight eol last handling + +=====================================output===================================== +a bare string to hightlight eol last handling +================================================================================ +`; diff --git a/tests/handlebars-last-line/empty-with-no-trailing-newline.hbs b/tests/handlebars-last-line/empty-with-no-trailing-newline.hbs new file mode 100644 index 00000000..e69de29b diff --git a/tests/handlebars-last-line/empty-with-trailing-newline.hbs b/tests/handlebars-last-line/empty-with-trailing-newline.hbs new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/tests/handlebars-last-line/empty-with-trailing-newline.hbs @@ -0,0 +1 @@ + diff --git a/tests/handlebars-last-line/end-of-line-last.hbs b/tests/handlebars-last-line/end-of-line-last.hbs new file mode 100644 index 00000000..71ec7dc1 --- /dev/null +++ b/tests/handlebars-last-line/end-of-line-last.hbs @@ -0,0 +1 @@ +a bare string to hightlight eol last handling diff --git a/tests/handlebars-last-line/jsfmt.spec.js b/tests/handlebars-last-line/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-last-line/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..1f3254ee --- /dev/null +++ b/tests/handlebars-mustache-statement/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,148 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`element-modifier-statement.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ +
+ Hello +
+ +
+ Hello +
+ +=====================================output===================================== +
+ Hello +
+
+ Hello +
+
+ Hello +
+
+ Hello +
+================================================================================ +`; + +exports[`element-modifier-statement.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ Hello +
+ +
+ Hello +
+ +
+ Hello +
+ +
+ Hello +
+ +=====================================output===================================== +
+ Hello +
+
+ Hello +
+
+ Hello +
+
+ Hello +
+================================================================================ +`; diff --git a/tests/glimmer/element-modifier-statement.hbs b/tests/handlebars-mustache-statement/element-modifier-statement.hbs similarity index 100% rename from tests/glimmer/element-modifier-statement.hbs rename to tests/handlebars-mustache-statement/element-modifier-statement.hbs diff --git a/tests/handlebars-mustache-statement/jsfmt.spec.js b/tests/handlebars-mustache-statement/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-mustache-statement/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/handlebars-newline/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-newline/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..ee9f7307 --- /dev/null +++ b/tests/handlebars-newline/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,134 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +

+ Welcome to the Ember.js Guides. + This documentation will take you from total beginner to Ember expert. +

+ +{{!-- newlines text --}} +
+ hi + there + how + + are you + + + are you fine today? +
+ +{{!-- newlines text spaced --}} +
+ + space above + + space below + +
+ +{{!-- newlines elems spaced --}} +
+ + space above + + space below + +
+ +{{!-- newlines mixed --}} +
+ hi + there + + how + + are you + + + are you fine today? +
+ +{{!-- newlines elems --}} +
+
+ + +
+ + +
+ + + hi + + +
+ + + + + +
+ +=====================================output===================================== +

+ Welcome to the + Ember.js Guides + + . + This documentation will take you from total beginner to Ember expert. +

+{{! newlines text }} +
+ hi + there + how + + are you + + + are you fine today? +
+{{! newlines text spaced }} +
+ space above + + space below +
+{{! newlines elems spaced }} +
+ + space above + + + space below + +
+{{! newlines mixed }} +
+ hi + there + + how + + are + you + + are you fine today? +
+{{! newlines elems }} +
+
+
+
+ hi
+ +
+================================================================================ +`; diff --git a/tests/handlebars-newline/jsfmt.spec.js b/tests/handlebars-newline/jsfmt.spec.js new file mode 100644 index 00000000..da9b8840 --- /dev/null +++ b/tests/handlebars-newline/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["glimmer"]); diff --git a/tests/handlebars-newline/test.hbs b/tests/handlebars-newline/test.hbs new file mode 100644 index 00000000..0f8bf4e4 --- /dev/null +++ b/tests/handlebars-newline/test.hbs @@ -0,0 +1,69 @@ +

+ Welcome to the Ember.js Guides. + This documentation will take you from total beginner to Ember expert. +

+ +{{!-- newlines text --}} +
+ hi + there + how + + are you + + + are you fine today? +
+ +{{!-- newlines text spaced --}} +
+ + space above + + space below + +
+ +{{!-- newlines elems spaced --}} +
+ + space above + + space below + +
+ +{{!-- newlines mixed --}} +
+ hi + there + + how + + are you + + + are you fine today? +
+ +{{!-- newlines elems --}} +
+
+ + +
+ + +
+ + + hi + + +
+ + + + + +
diff --git a/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..b22c2c8d --- /dev/null +++ b/tests/handlebars-sub-expression/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,194 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`sub-expressions.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) + hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}} + +{{/block}} + +{{foobar-sub-component/foobar-foo + hook="stringLiteral" + foo= + (t + (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} + +=====================================output===================================== +
+{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper + param param param param hashPair=value hashPair=value hashPair=Value + ) + hashPair=(helper + param + param + param + param + param + param + hashPair=value + hashPair=value + hashPair=value + ) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}}{{/block}} +{{foobar-sub-component/foobar-foo + hook="stringLiteral" + foo=(t + (concat + "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash + ) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} +================================================================================ +`; + +exports[`sub-expressions.hbs 2`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 +singleQuote: true + | printWidth +=====================================input====================================== +
+ +{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper param param param param hashPair=value hashPair=value hashPair=Value) + hashPair=(helper param param param param param param hashPair=value hashPair=value hashPair=value) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}} + +{{/block}} + +{{foobar-sub-component/foobar-foo + hook="stringLiteral" + foo= + (t + (concat "stringLiteral" (get blockParam "stringLiteral") hash=hash hash=hash) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} + +=====================================output===================================== +
+{{#block + (concat + (service) + (helper param hashPair=Value) + (largeNameHelper + param param param param hashPair=value hashPair=value hashPair=Value + ) + hashPair=(helper + param + param + param + param + param + param + hashPair=value + hashPair=value + hashPair=value + ) + hashPair=(does not need a line break due to being under 80 chars long) + ) +}}{{/block}} +{{foobar-sub-component/foobar-foo + hook='stringLiteral' + foo=(t + (concat + 'stringLiteral' (get blockParam 'stringLiteral') hash=hash hash=hash + ) + foo=(simple-helper (hash hashKey=blockParam.foo assignParam=blockParam.bar)) + ) +}} +================================================================================ +`; diff --git a/tests/handlebars-sub-expression/jsfmt.spec.js b/tests/handlebars-sub-expression/jsfmt.spec.js new file mode 100644 index 00000000..4abf117d --- /dev/null +++ b/tests/handlebars-sub-expression/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["glimmer"]); +run_spec(__dirname, ["glimmer"], { singleQuote: true }); diff --git a/tests/glimmer/sub-expressions.hbs b/tests/handlebars-sub-expression/sub-expressions.hbs similarity index 100% rename from tests/glimmer/sub-expressions.hbs rename to tests/handlebars-sub-expression/sub-expressions.hbs diff --git a/tests/handlebars-text-wrap/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-text-wrap/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..31a65197 --- /dev/null +++ b/tests/handlebars-text-wrap/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 80 + | printWidth +=====================================input====================================== +{{!-- Wrapping text --}} +
+ Some text that would need to wrap on to a new line in order to display correctly and nicely +
+ +{{!-- Wrapping tags --}} +
+ f f f f f f +
+ +{{!-- Wrapping tags --}} +
+ ffffff +
+ +{{!-- Wrapping tags --}} +
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f +
+ +
+ before
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis lorem.
after +
+ +
+ before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}{stuff}{stuff}after{stuff}after +
+ +
+ before {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} {{stuff}} {{stuff}} after {{stuff}} after +
+ +
+ Please state your name and occupation for the board of school directors. +
+ +
+ First second third +
Something
+
+ +
+
+ First +
+ Second +
+ Third +
+
+ +
+ First
+ Second +
Third +
+ +{{!-- leading whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- trailing whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- no leading or trailing whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- translation leave text around tag --}} +
+ + First + , + ( + Second + ) +
+ +
+ + First second third fourth fifth sixth seventh + , + ( + Second + ) +
+ +{{!-- this really should split across lines --}} +
+ before{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after +
+ +{{!-- solitary whitespace --}} +
+ +{{!-- whitespace on newline --}} +
+
+ First +
+ Second +
+ Third +
+
+ +{{!-- around multiline element --}} +
Before
{"Enough text to make this element wrap on to multiple lines when formatting"}
After
+ +{{!-- around multiline element second pass --}} +
+ Before{" "} +
+ { + "Enough text to make this element wrap on to multiple lines when formatting" + } +
{" "} + After +
+ +{{!-- dont preserve blank lines when contains text --}} +
+ +
Zeroth
+ +
First
+ + Second + +
+ +{{!-- multiple expressions --}} +
+ {{header}} + {{body}} + {{footer}} +
+ +{{!-- single expression child tags --}} +
+ You currently have {{dashboardStr}} and {{userStr}} +
+ +{{!-- expression does not break --}} +
texty text text text text text text text text text text text {{this.props.type}}
+ +// FIXME + +=====================================output===================================== +{{! Wrapping text }} +
+ Some text that would need to wrap on to a new line in order to display correctly and nicely +
+{{! Wrapping tags }} +
+ + f + + + f + + + f + + + f + + + f + + + f + +
+{{! Wrapping tags }} +
+ + f + + + f + + + f + + + f + + + f + + + f + +
+{{! Wrapping tags }} +
+ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + + + f + +
+
+ before
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis lorem. +
+ after +
+
+ before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}{stuff}{stuff}after{stuff}after +
+
+ before {{stuff}}after {{stuff}}after {{stuff}}after {{stuff}}after {{stuff + }}after {{stuff}} {{stuff}} {{stuff}}after {{stuff}}after +
+
+ Please state your + name + + and + occupation + + for the board of + school + + directors. +
+
+ First second third
+ Something +
+
+
+
+ First +
+ Second
+ Third +
+
+
+ First
+ Second +
+ Third +
+{{! leading whitespace }} +
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth +
+{{! trailing whitespace }} +
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth +
+{{! no leading or trailing whitespace }} +
+ First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth +
+{{! translation leave text around tag }} +
+ + First + + , + ( + Second + + ) +
+
+ + First second third fourth fifth sixth seventh + + , + ( + Second + + ) +
+{{! this really should split across lines }} +
+ before{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff + }}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff + }}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after +
+{{! solitary whitespace }} +
+ +
+{{! whitespace on newline }} +
+
+ First +
+
+ Second +
+
+ Third +
+
+{{! around multiline element }} +
+ Before
+ {"Enough text to make this element wrap on to multiple lines when formatting"} +
+ After +
+{{! around multiline element second pass }} +
+ Before{" "}
+ { + "Enough text to make this element wrap on to multiple lines when formatting" + } +
+ {" "} + After +
+{{! dont preserve blank lines when contains text }} +
+
+ Zeroth +
+
+ First +
+ Second +
+{{! multiple expressions }} +
+ {{header}} {{body}} {{footer}} +
+{{! single expression child tags }} +
+ You currently have + {{dashboardStr}} + + and + {{userStr}} + +
+{{! expression does not break }} +
+ texty text text text text text text text text text text text {{this.props.type + }} +
+// FIXME +================================================================================ +`; diff --git a/tests/handlebars-text-wrap/jsfmt.spec.js b/tests/handlebars-text-wrap/jsfmt.spec.js new file mode 100644 index 00000000..da9b8840 --- /dev/null +++ b/tests/handlebars-text-wrap/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["glimmer"]); diff --git a/tests/handlebars-text-wrap/test.hbs b/tests/handlebars-text-wrap/test.hbs new file mode 100644 index 00000000..44905334 --- /dev/null +++ b/tests/handlebars-text-wrap/test.hbs @@ -0,0 +1,145 @@ +{{!-- Wrapping text --}} +
+ Some text that would need to wrap on to a new line in order to display correctly and nicely +
+ +{{!-- Wrapping tags --}} +
+ f f f f f f +
+ +{{!-- Wrapping tags --}} +
+ ffffff +
+ +{{!-- Wrapping tags --}} +
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f +
+ +
+ before
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis lorem.
after +
+ +
+ before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}{stuff}{stuff}after{stuff}after +
+ +
+ before {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} after {{stuff}} {{stuff}} {{stuff}} after {{stuff}} after +
+ +
+ Please state your name and occupation for the board of school directors. +
+ +
+ First second third +
Something
+
+ +
+
+ First +
+ Second +
+ Third +
+
+ +
+ First
+ Second +
Third +
+ +{{!-- leading whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- trailing whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- no leading or trailing whitespace --}} +
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
+ +{{!-- translation leave text around tag --}} +
+ + First + , + ( + Second + ) +
+ +
+ + First second third fourth fifth sixth seventh + , + ( + Second + ) +
+ +{{!-- this really should split across lines --}} +
+ before{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after{{stuff}}after +
+ +{{!-- solitary whitespace --}} +
+ +{{!-- whitespace on newline --}} +
+
+ First +
+ Second +
+ Third +
+
+ +{{!-- around multiline element --}} +
Before
{"Enough text to make this element wrap on to multiple lines when formatting"}
After
+ +{{!-- around multiline element second pass --}} +
+ Before{" "} +
+ { + "Enough text to make this element wrap on to multiple lines when formatting" + } +
{" "} + After +
+ +{{!-- dont preserve blank lines when contains text --}} +
+ +
Zeroth
+ +
First
+ + Second + +
+ +{{!-- multiple expressions --}} +
+ {{header}} + {{body}} + {{footer}} +
+ +{{!-- single expression child tags --}} +
+ You currently have {{dashboardStr}} and {{userStr}} +
+ +{{!-- expression does not break --}} +
texty text text text text text text text text text text text {{this.props.type}}
+ +// FIXME diff --git a/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..9dbdbda3 --- /dev/null +++ b/tests/handlebars-whitespace/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,509 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`basics.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +{{!-- after --}} + + foo bar + + +{{!-- before --}} + + bar foo + + +{{!-- within --}} + + foo bar + + +{{!-- break components --}} +
+ +

foobar bar bar

yep

+
+

nope

+
+ +
+ hello hi sdkflsdfjk +
; + +=====================================output===================================== +{{! after }} + + foo + bar + + +{{! before }} + + + bar + + foo + +{{! within }} + + foo + bar + + +{{! break components }} +
+ +

+ foo + bar bar bar + +

+

+ + + yep + + +

+
+

+ nope +

+
+
+ hello + hi + + + sdkflsdfjk + +
+; +================================================================================ +`; + +exports[`boss.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +

Hi {{firstName}} {{lastName}} , welcome!

+{{#component propA}} + for {{propB}} do {{propC}} f +{{/component}} +{{#component propA}} + for {{propB}} namedo {{propC}} f +{{/component}} +{{propA}} {{propB}} +{{propC}}{{propD}} +{{propE}} {{propF}} +{{propG}}{{propH}} + + + +hey + +=====================================output===================================== +

+ Hi {{firstName}} {{lastName + }}, welcome! +

+{{#component propA}} + for{{propB}}do{{propC}}f +{{/component}} +{{#component propA}} + for + {{propB}} + + name + + do + {{propC}} + f +{{/component}} +{{propA}} +{{propB}} +{{propC}} +{{propD}} + + {{propE}} {{propF}} + + + {{propG}}{{propH}} + +hey +================================================================================ +`; + +exports[`curly.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +

Your username is @{{name}}

+

Hi {{firstName}} {{lastName}}

+=====================================output===================================== +

+ Your username is @{{name}} +

+

+ Hi {{firstName}} {{lastName}} +

+================================================================================ +`; + +exports[`display-inline-block.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== + + +
+ +
+
+ + +
+ + +=====================================output===================================== + + +
+ + +
+
+ + +
+ +================================================================================ +`; + +exports[`display-none.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +{{!-- TO FIX --}} +My tITlE + +=====================================output===================================== +{{! TO FIX }} + + + + My tITlE + + + +================================================================================ +`; + +exports[`fill.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +

+ about fedco bottom imageWe are a cooperative, one of the few seed companies so organized + in the United States. Because we do not have an individual owner or beneficiary, + profit is not our primary goal. Consumers own 60% of the cooperative and worker + members 40%. Consumer and worker members share proportionately in the cooperative’s + profits through our annual patronage dividends. +

+ +=====================================output===================================== +

+ about fedco bottom image + + We are a cooperative + + , one of the few seed companies so organized + in the United States. Because we do not have an individual owner or beneficiary, + profit is not our primary goal. Consumers own 60% of the cooperative and worker + members 40%. Consumer and worker members share proportionately in the cooperative’s + profits through our annual patronage dividends. +

+================================================================================ +`; + +exports[`inline-element.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +{{!-- TO FIX --}} +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec maximus rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit.

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec maximus rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit.

+ +=====================================output===================================== +{{! TO FIX }} +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec + maximus + + rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec + + maximus + + + rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit. +

+================================================================================ +`; + +exports[`non-breaking-whitespace.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== + +Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + +Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + +Prix : 32 € + +=====================================output===================================== + + + Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + + + + Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + + + + Prix : 32 € + +================================================================================ +`; + +exports[`punctuation.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +This is your name: {{name}}. +This is your name: {{name}} (employee) +This is your name: {{name}} ({{role}}) + +=====================================output===================================== + + This is your name: {{name}}. + + + This is your name: {{name}}(employee) + + + This is your name: {{name}}({{role}}) + +================================================================================ +`; + +exports[`surrounding-linebreak.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== +123 + +123 +123 + + +123 + + +
123
+
+123
+
123 +
+
+123 +
+ +=====================================output===================================== + + 123 + + + 123 + + + 123 + + + 123 + +
+ 123 +
+
+ 123 +
+
+ 123 +
+
+ 123 +
+================================================================================ +`; + +exports[`table.hbs 1`] = ` +====================================options===================================== +parsers: ["glimmer"] +printWidth: 40 + | printWidth +=====================================input====================================== + + + + + + + + +
ABC
+ +
ABC
+ +
A B C
+ + + + + + +
+ +=====================================output===================================== + + + + + + + + +
+ A + + B + + C +
+ + + + + + + + +
+ A + + B + + C +
+ + + + + + + + +
+ A + + B + + C +
+ + + + + + +
+================================================================================ +`; diff --git a/tests/handlebars-whitespace/basics.hbs b/tests/handlebars-whitespace/basics.hbs new file mode 100644 index 00000000..89cae36b --- /dev/null +++ b/tests/handlebars-whitespace/basics.hbs @@ -0,0 +1,26 @@ +{{!-- after --}} + + foo bar + + +{{!-- before --}} + + bar foo + + +{{!-- within --}} + + foo bar + + +{{!-- break components --}} +
+ +

foobar bar bar

yep

+
+

nope

+
+ +
+ hello hi sdkflsdfjk +
; diff --git a/tests/handlebars-whitespace/boss.hbs b/tests/handlebars-whitespace/boss.hbs new file mode 100644 index 00000000..1e15a8a9 --- /dev/null +++ b/tests/handlebars-whitespace/boss.hbs @@ -0,0 +1,15 @@ +

Hi {{firstName}} {{lastName}} , welcome!

+{{#component propA}} + for {{propB}} do {{propC}} f +{{/component}} +{{#component propA}} + for {{propB}} namedo {{propC}} f +{{/component}} +{{propA}} {{propB}} +{{propC}}{{propD}} +{{propE}} {{propF}} +{{propG}}{{propH}} + + + +hey diff --git a/tests/glimmer/curly.hbs b/tests/handlebars-whitespace/curly.hbs similarity index 100% rename from tests/glimmer/curly.hbs rename to tests/handlebars-whitespace/curly.hbs diff --git a/tests/handlebars-whitespace/display-inline-block.hbs b/tests/handlebars-whitespace/display-inline-block.hbs new file mode 100644 index 00000000..abb06852 --- /dev/null +++ b/tests/handlebars-whitespace/display-inline-block.hbs @@ -0,0 +1,12 @@ + + +
+ +
+
+ + +
+ diff --git a/tests/handlebars-whitespace/display-none.hbs b/tests/handlebars-whitespace/display-none.hbs new file mode 100644 index 00000000..0570c11e --- /dev/null +++ b/tests/handlebars-whitespace/display-none.hbs @@ -0,0 +1,2 @@ +{{!-- TO FIX --}} +My tITlE diff --git a/tests/handlebars-whitespace/fill.hbs b/tests/handlebars-whitespace/fill.hbs new file mode 100644 index 00000000..3a475a42 --- /dev/null +++ b/tests/handlebars-whitespace/fill.hbs @@ -0,0 +1,11 @@ +

+ about fedco bottom imageWe are a cooperative, one of the few seed companies so organized + in the United States. Because we do not have an individual owner or beneficiary, + profit is not our primary goal. Consumers own 60% of the cooperative and worker + members 40%. Consumer and worker members share proportionately in the cooperative’s + profits through our annual patronage dividends. +

diff --git a/tests/handlebars-whitespace/inline-element.hbs b/tests/handlebars-whitespace/inline-element.hbs new file mode 100644 index 00000000..749afd13 --- /dev/null +++ b/tests/handlebars-whitespace/inline-element.hbs @@ -0,0 +1,16 @@ +{{!-- TO FIX --}} +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec maximus rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit.

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce cursus massa vel augue +vestibulum facilisis in porta turpis. Ut faucibus lectus sit amet urna consectetur dignissim. +Sam vitae neque quis ex dapibus faucibus at sed ligula. Nulla sit amet aliquet nibh. +Vestibulum at congue mi. Suspendisse vitae odio vitae massa hendrerit mattis sed eget dui. +Sed eu scelerisque neque. Donec maximus rhoncus pellentesque. Aenean purus turpis, vehicula +euismod ante vel, ultricies eleifend dui. Class aptent taciti sociosqu ad litora torquent per +conubia nostra, per inceptos himenaeos. Donec in ornare velit.

diff --git a/tests/handlebars-whitespace/jsfmt.spec.js b/tests/handlebars-whitespace/jsfmt.spec.js new file mode 100644 index 00000000..36123c9a --- /dev/null +++ b/tests/handlebars-whitespace/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["glimmer"], { printWidth: 40 }); diff --git a/tests/handlebars-whitespace/non-breaking-whitespace.hbs b/tests/handlebars-whitespace/non-breaking-whitespace.hbs new file mode 100644 index 00000000..55a8b947 --- /dev/null +++ b/tests/handlebars-whitespace/non-breaking-whitespace.hbs @@ -0,0 +1,6 @@ + +Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + +Nihil aut odit omnis. Quam maxime est molestiae. Maxime dolorem dolores voluptas quaerat ut qui sunt vitae error. + +Prix : 32 € diff --git a/tests/handlebars-whitespace/punctuation.hbs b/tests/handlebars-whitespace/punctuation.hbs new file mode 100644 index 00000000..762851bd --- /dev/null +++ b/tests/handlebars-whitespace/punctuation.hbs @@ -0,0 +1,3 @@ +This is your name: {{name}}. +This is your name: {{name}} (employee) +This is your name: {{name}} ({{role}}) diff --git a/tests/handlebars-whitespace/surrounding-linebreak.hbs b/tests/handlebars-whitespace/surrounding-linebreak.hbs new file mode 100644 index 00000000..06862eba --- /dev/null +++ b/tests/handlebars-whitespace/surrounding-linebreak.hbs @@ -0,0 +1,17 @@ +123 + +123 +123 + + +123 + + +
123
+
+123
+
123 +
+
+123 +
diff --git a/tests/handlebars-whitespace/table.hbs b/tests/handlebars-whitespace/table.hbs new file mode 100644 index 00000000..c161476d --- /dev/null +++ b/tests/handlebars-whitespace/table.hbs @@ -0,0 +1,20 @@ + + + + + + + + +
ABC
+ +
ABC
+ +
A B C
+ + + + + + +
diff --git a/tests/handlebars/__snapshots__/jsfmt.spec.js.snap b/tests/handlebars/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 1aacaef7..00000000 --- a/tests/handlebars/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,210 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`basic-handlebars.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== - - -
- -=====================================output===================================== - -
-================================================================================ -`; - -exports[`comments.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- {{! This comment will not be in the output }} - {{!-- This comment as }} and will not be in the output --}} - -
- -=====================================output===================================== -
- {{! This comment will not be in the output }} - {{!-- This comment as }} and will not be in the output --}} - -
-================================================================================ -`; - -exports[`component.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{my-component foo="bar" bar="baz" action=(action "almostTheMaximumLengthxxxxxx")}} - -{{my-component foo="bar"}} - -=====================================output===================================== -{{my-component - foo="bar" - bar="baz" - action=(action "almostTheMaximumLengthxxxxxx") -}} -{{my-component foo="bar"}} -================================================================================ -`; - -exports[`each.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
- {{#each comments}} -

{{title}}

-
{{body}}
- {{/each}} -
- -=====================================output===================================== -
- {{#each comments}} -

- - {{title}} - -

-
- {{body}} -
- {{/each}} -
-================================================================================ -`; - -exports[`if.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -{{#if title}} - {{permalink}} -{{/if}} - -=====================================output===================================== -{{#if title}} - {{permalink}} -{{/if}} -================================================================================ -`; - -exports[`if-else.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -

-{{#if isAtWork}} - Ship that code! -{{else if isReading}} - You can finish War and Peace eventually... -{{else}} - Go to bed! -{{/if}} -

- -

-{{#if a}} - A -{{else}} - B -{{/if}} -

- - -=====================================output===================================== -

- {{#if isAtWork}} - Ship that code! - {{else if isReading}} - You can finish War and Peace eventually... - {{else}} - Go to bed! - {{/if}} -

-

- {{#if a}} - A - {{else}} - B - {{/if}} -

-================================================================================ -`; - -exports[`nested-path.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -
-

{{title}}

-

By {{author.name}}

- -
- {{body}} -
-
- -=====================================output===================================== -
-

- {{title}} -

-

- By {{author.name}} -

-
- {{body}} -
-
-================================================================================ -`; - -exports[`raw.hbs 1`] = ` -====================================options===================================== -parsers: ["glimmer"] -printWidth: 80 - | printWidth -=====================================input====================================== -

{{{raw}}}

- -=====================================output===================================== -

- {{{raw}}} -

-================================================================================ -`; diff --git a/tests/handlebars/component.hbs b/tests/handlebars/component.hbs deleted file mode 100644 index 220bff15..00000000 --- a/tests/handlebars/component.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{my-component foo="bar" bar="baz" action=(action "almostTheMaximumLengthxxxxxx")}} - -{{my-component foo="bar"}} diff --git a/tests/handlebars/if-else.hbs b/tests/handlebars/if-else.hbs deleted file mode 100644 index 9d0ce585..00000000 --- a/tests/handlebars/if-else.hbs +++ /dev/null @@ -1,18 +0,0 @@ -

-{{#if isAtWork}} - Ship that code! -{{else if isReading}} - You can finish War and Peace eventually... -{{else}} - Go to bed! -{{/if}} -

- -

-{{#if a}} - A -{{else}} - B -{{/if}} -

- diff --git a/tests/handlebars/if.hbs b/tests/handlebars/if.hbs deleted file mode 100644 index 0ac91886..00000000 --- a/tests/handlebars/if.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{#if title}} - {{permalink}} -{{/if}}