diff --git a/package-lock.json b/package-lock.json
index b34009c05..367e4fb60 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5038,12 +5038,6 @@
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
},
- "min-indent": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.0.tgz",
- "integrity": "sha1-z8RcN+nsDY8KDsPdTvf3w6vjklY=",
- "dev": true
- },
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@@ -6406,15 +6400,6 @@
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="
},
- "strip-indent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
- "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
- "dev": true,
- "requires": {
- "min-indent": "^1.0.0"
- }
- },
"strip-json-comments": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
diff --git a/package.json b/package.json
index 0cbbf1d14..54f627b15 100644
--- a/package.json
+++ b/package.json
@@ -40,8 +40,7 @@
"eslint": "^6.5.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-prettier": "^3.1.1",
- "jest": "^24.9.0",
- "strip-indent": "^3.0.0"
+ "jest": "^24.9.0"
},
"engines": {
"node": "^8 || >=10"
diff --git a/transforms/angle-brackets/__snapshots__/test.js.snap b/transforms/angle-brackets/__snapshots__/test.js.snap
deleted file mode 100644
index 714ce6f57..000000000
--- a/transforms/angle-brackets/__snapshots__/test.js.snap
+++ /dev/null
@@ -1,726 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`action-params 1`] = `
-"{{#bs-button onClick=(action \\"submit\\")}}
- Button
-{{/bs-button}}
-~~~~~~~~
-
- Button
-"
-`;
-
-exports[`actions 1`] = `
-"{{#bs-button-group
- value=buttonGroupValue
- type=\\"checkbox\\"
- onChange=(action (mut buttonGroupValue)) as |bg|
-}}
- {{#bg.button value=1}}1{{/bg.button}}
- {{#bg.button value=2}}2{{/bg.button}}
- {{#bg.button value=3}}3{{/bg.button}}
-{{/bs-button-group}}
-~~~~~~~~
-
-
- 1
-
-
- 2
-
-
- 3
-
-"
-`;
-
-exports[`boolean-values 1`] = `
-"{{my-component prop1=true prop2=false}}
-~~~~~~~~
-"
-`;
-
-exports[`curly 1`] = `
-"
{{foo}}
-{{{bar}}}
-~~~~~~~~
-
- {{foo}}
-
-
- {{{bar}}}
-
"
-`;
-
-exports[`custom-options 1`] = `
-"{{some-component foo=true}}
-{{some-helper1 foo=true}}
-{{some-helper2 foo=true}}
-{{link-to \\"Title\\" \\"some.route\\"}}
-{{textarea value=this.model.body}}
-{{input type=\\"checkbox\\" name=\\"email-opt-in\\" checked=this.model.emailPreference}}
-~~~~~~~~
-
-{{some-helper1 foo=true}}
-{{some-helper2 foo=true}}
-{{link-to \\"Title\\" \\"some.route\\"}}
-{{textarea value=this.model.body}}
-{{input type=\\"checkbox\\" name=\\"email-opt-in\\" checked=this.model.emailPreference}}"
-`;
-
-exports[`data-attributes 1`] = `
-"{{x-foo data-foo=true}}
-{{x-foo data-test-selector=true}}
-{{x-foo data-test-selector=post.id}}
-{{x-foo label=\\"hi\\" data-test-selector=true}}
-{{x-foo data-test-foo }}
-
-{{#x-foo data-foo=true}}
- block
-{{/x-foo}}
-
-{{#x-foo data-test-selector=true}}
- block
-{{/x-foo}}
-
-{{#x-foo data-test-selector=post.id}}
- block
-{{/x-foo}}
-
-{{#common/accordion-component data-test-accordion as |accordion|}}
- block
-{{/common/accordion-component}}
-
-{{x-foo
- data-foo
- name=\\"Sophie\\"
-}}
-~~~~~~~~
-
-
-
-
-
-
- block
-
-
- block
-
-
- block
-
-
- block
-
-"
-`;
-
-exports[`deeply-nested-sub 1`] = `
-"{{#some-component class=(concat foo (some-helper ted (some-dude bar (a b c)))) }}
- help
-{{/some-component}}
-{{some-component class=(concat foo (some-helper ted (some-dude bar (a b c)))) }}
-{{deep-component class=(concat foo (nice-helper ted (some-crazy bar (a d (d e f)))))}}
-{{some-component
- class=(concat foo (some-helper bar))
-}}
-{{some-component
- class=(concat foo (some-helper bar quuz))
-}}
-{{some-component
- person=(hash name=\\"Sophie\\" age=1)
- message=(t \\"welcome\\" count=1)
-}}
-{{some-component
- people=(array
- (hash
- name=\\"Alex\\"
- age=5
- nested=(hash oldest=true amount=(format-currency 350 sign=\\"£\\"))
- disabled=(eq foo \\"bar\\")
- )
- (hash name=\\"Ben\\" age=4)
- (hash name=\\"Sophie\\" age=1)
- )
-}}
-~~~~~~~~
-
- help
-
-
-
-
-
-
-"
-`;
-
-exports[`each-in 1`] = `
-"{{#each-in this.people as |name person|}}
- Hello, {{name}}! You are {{person.age}} years old.
-{{else}}
- Sorry, nobody is here.
-{{/each-in}}
-~~~~~~~~
-{{#each-in this.people as |name person|}}
- Hello,{{name}}! You are{{person.age}}years old.
-{{else}}
- Sorry, nobody is here.
-{{/each-in}}"
-`;
-
-exports[`entities 1`] = `
-"< > ×
-{{#foo data-a=\\""Foo & Bar"\\"}} Some text >{{/foo}}
-~~~~~~~~
-< > ×
-
- Some text >
-"
-`;
-
-exports[`html-tags 1`] = `
-"
-
-
-
-
-
-
-
-
-
-~~~~~~~~
-
-
-
-
-
-"
-`;
-
-exports[`if 1`] = `
-"{{#if (eq a b)}}
- {{my-component1 prop1=\\"hello\\"}}
-{{else}}
- {{my-component2 prop2=\\"world\\"}}
-{{/if}}
-~~~~~~~~
-{{#if (eq a b)}}
-
-{{else}}
-
-{{/if}}"
-`;
-
-exports[`input-helper 1`] = `
-"{{input type=\\"checkbox\\" name=\\"email-opt-in\\" checked=this.model.emailPreference}}
-~~~~~~~~
-"
-`;
-
-exports[`let 1`] = `
-"{{#let (capitalize this.person.firstName) (capitalize this.person.lastName)
- as |firstName lastName|
-}}
- Welcome back {{concat firstName ' ' lastName}}
-
- Account Details:
- First Name: {{firstName}}
- Last Name: {{lastName}}
-{{/let}}
-~~~~~~~~
-{{#let
- (capitalize this.person.firstName)
- (capitalize this.person.lastName) as |firstName lastName|
-}}
- Welcome back
- {{concat firstName \\" \\" lastName}}
- Account Details:
- First Name:
- {{firstName}}
- Last Name:
- {{lastName}}
-{{/let}}"
-`;
-
-exports[`link-to 1`] = `
-"{{#link-to \\"about\\"}}About Us{{/link-to}}
-{{#link-to this.dynamicRoute}}About Us{{/link-to}}
-~~~~~~~~
-
- About Us
-
-
- About Us
-"
-`;
-
-exports[`link-to-inline 1`] = `
-"{{link-to 'Title' 'some.route'}}
-{{link-to
- 'Segments'
- 'apps.segments'
- class='tabs__discrete-tab'
- activeClass='o__selected'
- current-when='apps.segments'
- data-test-segment-link='segments'
-}}
-{{link-to
- 'Segments'
- this.dynamicPath
- class='tabs__discrete-tab'
- activeClass='o__selected'
- current-when='apps.segments'
- data-test-segment-link='segments'
-}}
-{{link-to
- segment.name
- 'apps.app.companies.segments.segment'
- segment
- class=\\"t__em-link\\"
-}}
-~~~~~~~~
-
- Title
-
-
- Segments
-
-
- Segments
-
-
- {{segment.name}}
-"
-`;
-
-exports[`link-to-model 1`] = `
-"{{#link-to \\"post\\" post}}Read {{post.title}}...{{/link-to}}
-{{#link-to \\"post\\" \\"string-id\\"}}Read {{post.title}}...{{/link-to}}
-{{#link-to \\"post\\" 557}}Read {{post.title}}...{{/link-to}}
-~~~~~~~~
-
- Read
- {{post.title}}
- ...
-
-
- Read
- {{post.title}}
- ...
-
-
- Read
- {{post.title}}
- ...
-"
-`;
-
-exports[`link-to-model-array 1`] = `
-"{{#link-to \\"post.comment\\" post comment}}
- Comment by {{comment.author.name}} on {{comment.date}}
-{{/link-to}}
-{{#link-to this.dynamicPath post comment}}
- Comment by {{comment.author.name}} on {{comment.date}}
-{{/link-to}}
-~~~~~~~~
-
- Comment by
- {{comment.author.name}}
- on
- {{comment.date}}
-
-
- Comment by
- {{comment.author.name}}
- on
- {{comment.date}}
-"
-`;
-
-exports[`link-to-query-param 1`] = `
-"{{#link-to \\"posts\\" (query-params direction=\\"desc\\" showArchived=false)}}
- Recent Posts
-{{/link-to}}
-{{#link-to data-test-foo \\"posts\\"}}
- Recent Posts
-{{/link-to}}
-{{#link-to this.dynamicPath (query-params direction=\\"desc\\" showArchived=false)}}
- Recent Posts
-{{/link-to}}
-{{#link-to data-test-foo this.dynamicPath (query-params direction=\\"desc\\" showArchived=false)}}
- Recent Posts
-{{/link-to}}
-{{#link-to (query-params direction=\\"desc\\" showArchived=false)}}
- Recent Posts
-{{/link-to}}
-{{link-to
- 'Users'
- 'apps.app.users.segments.segment'
- 'all-users'
- (query-params searchTerm=searchTerm)
-}}
-~~~~~~~~
-
- Recent Posts
-
-
- Recent Posts
-
-
- Recent Posts
-
-
- Recent Posts
-
-
- Recent Posts
-
-
- Users
-"
-`;
-
-exports[`nested 1`] = `
-"{{ui/site-header user=this.user class=(if this.user.isAdmin \\"admin\\")}}
-{{ui/button text=\\"Click me\\"}}
-{{#some-path/another-path/super-select selected=this.user.country as |s|}}
- {{#each this.availableCountries as |country|}}
- {{#s.option value=country}}{{country.name}}{{/s.option}}
- {{/each}}
-{{/some-path/another-path/super-select}}
-{{x-foo/x-bar}}
-~~~~~~~~
-
-
-
- {{#each this.availableCountries as |country|}}
-
- {{country.name}}
-
- {{/each}}
-
-"
-`;
-
-exports[`null-subexp 1`] = `
-"{{some-component selected=(is-equal this.bar null)}}
-~~~~~~~~
-"
-`;
-
-exports[`positional-params 1`] = `
-"{{some-component \\"foo\\"}}
-{{#some-component \\"foo\\"}}
- hi
-{{/some-component}}
-{{#some-component foo}}
- hi
-{{/some-component}}
-{{some-component 123}}
-{{some-component (some-helper 987)}}
-~~~~~~~~
-{{some-component \\"foo\\"}}
-{{#some-component \\"foo\\"}}
- hi
-{{/some-component}}
-{{#some-component foo}}
- hi
-{{/some-component}}
-{{some-component 123}}
-{{some-component (some-helper 987)}}"
-`;
-
-exports[`sample 1`] = `
-"{{site-header user=this.user class=(if this.user.isAdmin \\"admin\\")}}
-{{site-header user=null address=undefined}}
-
-{{#super-select selected=this.user.country as |s|}}
- {{#each this.availableCountries as |country|}}
- {{#s.option value=country}}{{country.name}}{{/s.option}}
- {{/each}}
-{{/super-select}}
-
-{{foo/bar tagName=''}}
-{{foo tagName='div' a=\\"\\" b=''}}
-~~~~~~~~
-
-
-
- {{#each this.availableCountries as |country|}}
-
- {{country.name}}
-
- {{/each}}
-
-
-"
-`;
-
-exports[`sample2 1`] = `
-"{{#my-card as |card|}}
- {{card.title title=\\"My Card Title\\"}}
- {{#card.content}}
- hello
- {{/card.content}}
- {{card.foo-bar}}
- {{card.foo}}
-{{/my-card}}
-~~~~~~~~
-
-
-
-
- hello
-
-
-
- {{card.foo}}
-"
-`;
-
-exports[`skip-default-helpers (no-config) 1`] = `
-"
- {{liquid-outlet}}
-
-
-
-{{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
-
- {{#liquid-if showA use=\\"toLeft\\"}}
-
One: A
- {{else}}
-
One: B
- {{/liquid-if}}
-
-{{else}}
-
- Two
-
-{{/liquid-if}}
-{{moment '12-25-1995' 'MM-DD-YYYY'}}
-{{moment-from '1995-12-25' '2995-12-25' hideAffix=true}}
-{{some-component foo=true}}
-{{some-helper1 foo=true}}
-{{some-helper2 foo=true}}
-~~~~~~~~
-
- {{liquid-outlet}}
-
-
-
-{{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
-
- {{#liquid-if showA use=\\"toLeft\\"}}
-
- One: A
-
- {{else}}
-
- One: B
-
- {{/liquid-if}}
-
-{{else}}
-
- Two
-
-{{/liquid-if}}
-{{moment \\"12-25-1995\\" \\"MM-DD-YYYY\\"}}
-{{moment-from \\"1995-12-25\\" \\"2995-12-25\\" hideAffix=true}}
-
-
-"
-`;
-
-exports[`skip-default-helpers 1`] = `
-"
- {{liquid-outlet}}
-
-
-
-{{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
-
- {{#liquid-if showA use=\\"toLeft\\"}}
-
One: A
- {{else}}
-
One: B
- {{/liquid-if}}
-
-{{else}}
-
- Two
-
-{{/liquid-if}}
-{{moment '12-25-1995' 'MM-DD-YYYY'}}
-{{moment-from '1995-12-25' '2995-12-25' hideAffix=true}}
-{{some-component foo=true}}
-{{some-helper1 foo=true}}
-{{some-helper2 foo=true}}
-~~~~~~~~
-
- {{liquid-outlet}}
-
-
-
-{{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
-
- {{#liquid-if showA use=\\"toLeft\\"}}
-
- One: A
-
- {{else}}
-
- One: B
-
- {{/liquid-if}}
-
-{{else}}
-
- Two
-
-{{/liquid-if}}
-{{moment \\"12-25-1995\\" \\"MM-DD-YYYY\\"}}
-{{moment-from \\"1995-12-25\\" \\"2995-12-25\\" hideAffix=true}}
-
-{{some-helper1 foo=true}}
-{{some-helper2 foo=true}}"
-`;
-
-exports[`t-helper 1`] = `
-"{{t \\"some.string\\" param=\\"string\\" another=1}}
-~~~~~~~~
-{{t \\"some.string\\" param=\\"string\\" another=1}}"
-`;
-
-exports[`tag-name 1`] = `
-"{{foo/bar name=\\"\\"}}
-~~~~~~~~
-"
-`;
-
-exports[`textarea 1`] = `
-"{{textarea value=this.model.body}}
-~~~~~~~~
-"
-`;
-
-exports[`tilde 1`] = `
-"{{#if foo~}}
- {{some-component}}
-{{/if}}
-~~~~~~~~
-{{#if foo~}}
- {{some-component}}
-{{/if}}"
-`;
-
-exports[`undefined-subexp 1`] = `
-"{{some-component selected=(is-equal this.bar undefined)}}
-~~~~~~~~
-"
-`;
-
-exports[`unless 1`] = `
-"{{#unless this.hasPaid}}
- You owe: \${{this.total}}
-{{/unless}}
-~~~~~~~~
-{{#unless this.hasPaid}}
- You owe: \${{this.total}}
-{{/unless}}"
-`;
diff --git a/transforms/angle-brackets/test.js b/transforms/angle-brackets/test.js
index 24b0a2bdc..381663fac 100644
--- a/transforms/angle-brackets/test.js
+++ b/transforms/angle-brackets/test.js
@@ -1,22 +1,9 @@
'use strict';
-const stripIndent = require('strip-indent');
-
const transform = require('./transform');
function runTest(path, source, options) {
- // trim leading line break
- if (source[0] === '\n') {
- source = source.slice(1);
- }
- // trim trailing line break and indent
- if (source.slice(source.length - 3) === '\n ') {
- source = source.slice(0, source.length - 3);
- }
-
- let input = stripIndent(source);
- let output = transform({ path, source: input }, options);
- return `${input}\n~~~~~~~~\n${output}`;
+ return transform({ path, source }, options);
}
test('action-params', () => {
@@ -26,7 +13,11 @@ test('action-params', () => {
{{/bs-button}}
`;
- expect(runTest('action-params.hbs', input)).toMatchSnapshot();
+ expect(runTest('action-params.hbs', input)).toMatchInlineSnapshot(`
+ "
+ Button
+ "
+ `);
});
test('actions', () => {
@@ -42,7 +33,23 @@ test('actions', () => {
{{/bs-button-group}}
`;
- expect(runTest('actions.hbs', input)).toMatchSnapshot();
+ expect(runTest('actions.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+ 1
+
+
+ 2
+
+
+ 3
+
+ "
+ `);
});
test('boolean-values', () => {
@@ -50,7 +57,9 @@ test('boolean-values', () => {
{{my-component prop1=true prop2=false}}
`;
- expect(runTest('true-values.hbs', input)).toMatchSnapshot();
+ expect(runTest('true-values.hbs', input)).toMatchInlineSnapshot(
+ `""`
+ );
});
test('curly', () => {
@@ -59,7 +68,14 @@ test('curly', () => {
{{{bar}}}
`;
- expect(runTest('curly.hbs', input)).toMatchSnapshot();
+ expect(runTest('curly.hbs', input)).toMatchInlineSnapshot(`
+ "
+ {{foo}}
+
+
+ {{{bar}}}
+
"
+ `);
});
test('data-attributes', () => {
@@ -92,7 +108,26 @@ test('data-attributes', () => {
}}
`;
- expect(runTest('data-attributes.hbs', input)).toMatchSnapshot();
+ expect(runTest('data-attributes.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+
+
+
+
+ block
+
+
+ block
+
+
+ block
+
+
+ block
+
+ "
+ `);
});
test('deeply-nested-sub', () => {
@@ -126,7 +161,33 @@ test('deeply-nested-sub', () => {
}}
`;
- expect(runTest('deeply-nested-sub.hbs', input)).toMatchSnapshot();
+ expect(runTest('deeply-nested-sub.hbs', input)).toMatchInlineSnapshot(`
+ "
+ help
+
+
+
+
+
+
+ "
+ `);
});
test('each-in', () => {
@@ -138,7 +199,13 @@ test('each-in', () => {
{{/each-in}}
`;
- expect(runTest('each-in.hbs', input)).toMatchSnapshot();
+ expect(runTest('each-in.hbs', input)).toMatchInlineSnapshot(`
+ "{{#each-in this.people as |name person|}}
+ Hello,{{name}}! You are{{person.age}}years old.
+ {{else}}
+ Sorry, nobody is here.
+ {{/each-in}}"
+ `);
});
test('entities', () => {
@@ -147,7 +214,12 @@ test('entities', () => {
{{#foo data-a=""Foo & Bar""}} Some text >{{/foo}}
`;
- expect(runTest('entities.hbs', input)).toMatchSnapshot();
+ expect(runTest('entities.hbs', input)).toMatchInlineSnapshot(`
+ "< > ×
+
+ Some text >
+ "
+ `);
});
test('html-tags', () => {
@@ -174,7 +246,31 @@ test('html-tags', () => {
`;
- expect(runTest('html-tags.hbs', input)).toMatchSnapshot();
+ expect(runTest('html-tags.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+
+
+
+ "
+ `);
});
test('if', () => {
@@ -186,7 +282,13 @@ test('if', () => {
{{/if}}
`;
- expect(runTest('if.hbs', input)).toMatchSnapshot();
+ expect(runTest('if.hbs', input)).toMatchInlineSnapshot(`
+ "{{#if (eq a b)}}
+
+ {{else}}
+
+ {{/if}}"
+ `);
});
test('input-helper', () => {
@@ -194,7 +296,13 @@ test('input-helper', () => {
{{input type="checkbox" name="email-opt-in" checked=this.model.emailPreference}}
`;
- expect(runTest('input-helper.hbs', input)).toMatchSnapshot();
+ expect(runTest('input-helper.hbs', input)).toMatchInlineSnapshot(`
+ ""
+ `);
});
test('let', () => {
@@ -210,7 +318,20 @@ test('let', () => {
{{/let}}
`;
- expect(runTest('let.hbs', input)).toMatchSnapshot();
+ expect(runTest('let.hbs', input)).toMatchInlineSnapshot(`
+ "{{#let
+ (capitalize this.person.firstName)
+ (capitalize this.person.lastName) as |firstName lastName|
+ }}
+ Welcome back
+ {{concat firstName \\" \\" lastName}}
+ Account Details:
+ First Name:
+ {{firstName}}
+ Last Name:
+ {{lastName}}
+ {{/let}}"
+ `);
});
test('link-to', () => {
@@ -219,7 +340,14 @@ test('link-to', () => {
{{#link-to this.dynamicRoute}}About Us{{/link-to}}
`;
- expect(runTest('link-to.hbs', input)).toMatchSnapshot();
+ expect(runTest('link-to.hbs', input)).toMatchInlineSnapshot(`
+ "
+ About Us
+
+
+ About Us
+ "
+ `);
});
test('link-to-inline', () => {
@@ -249,7 +377,36 @@ test('link-to-inline', () => {
}}
`;
- expect(runTest('link-to-inline.hbs', input)).toMatchSnapshot();
+ expect(runTest('link-to-inline.hbs', input)).toMatchInlineSnapshot(`
+ "
+ Title
+
+
+ Segments
+
+
+ Segments
+
+
+ {{segment.name}}
+ "
+ `);
});
test('link-to-model', () => {
@@ -259,7 +416,23 @@ test('link-to-model', () => {
{{#link-to "post" 557}}Read {{post.title}}...{{/link-to}}
`;
- expect(runTest('link-to-model.hbs', input)).toMatchSnapshot();
+ expect(runTest('link-to-model.hbs', input)).toMatchInlineSnapshot(`
+ "
+ Read
+ {{post.title}}
+ ...
+
+
+ Read
+ {{post.title}}
+ ...
+
+
+ Read
+ {{post.title}}
+ ...
+ "
+ `);
});
test('link-to-model-array', () => {
@@ -272,7 +445,20 @@ test('link-to-model-array', () => {
{{/link-to}}
`;
- expect(runTest('link-to-model-array.hbs', input)).toMatchSnapshot();
+ expect(runTest('link-to-model-array.hbs', input)).toMatchInlineSnapshot(`
+ "
+ Comment by
+ {{comment.author.name}}
+ on
+ {{comment.date}}
+
+
+ Comment by
+ {{comment.author.name}}
+ on
+ {{comment.date}}
+ "
+ `);
});
test('link-to-query-param', () => {
@@ -300,7 +486,37 @@ test('link-to-query-param', () => {
}}
`;
- expect(runTest('link-to-query-param.hbs', input)).toMatchSnapshot();
+ expect(runTest('link-to-query-param.hbs', input)).toMatchInlineSnapshot(`
+ "
+ Recent Posts
+
+
+ Recent Posts
+
+
+ Recent Posts
+
+
+ Recent Posts
+
+
+ Recent Posts
+
+
+ Users
+ "
+ `);
});
test('nested', () => {
@@ -315,7 +531,18 @@ test('nested', () => {
{{x-foo/x-bar}}
`;
- expect(runTest('nested.hbs', input)).toMatchSnapshot();
+ expect(runTest('nested.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+
+ {{#each this.availableCountries as |country|}}
+
+ {{country.name}}
+
+ {{/each}}
+
+ "
+ `);
});
test('null-subexp', () => {
@@ -323,7 +550,9 @@ test('null-subexp', () => {
{{some-component selected=(is-equal this.bar null)}}
`;
- expect(runTest('null-subexp.hbs', input)).toMatchSnapshot();
+ expect(runTest('null-subexp.hbs', input)).toMatchInlineSnapshot(
+ `""`
+ );
});
test('positional-params', () => {
@@ -339,7 +568,17 @@ test('positional-params', () => {
{{some-component (some-helper 987)}}
`;
- expect(runTest('positional-params.hbs', input)).toMatchSnapshot();
+ expect(runTest('positional-params.hbs', input)).toMatchInlineSnapshot(`
+ "{{some-component \\"foo\\"}}
+ {{#some-component \\"foo\\"}}
+ hi
+ {{/some-component}}
+ {{#some-component foo}}
+ hi
+ {{/some-component}}
+ {{some-component 123}}
+ {{some-component (some-helper 987)}}"
+ `);
});
test('sample', () => {
@@ -357,7 +596,19 @@ test('sample', () => {
{{foo tagName='div' a="" b=''}}
`;
- expect(runTest('sample.hbs', input)).toMatchSnapshot();
+ expect(runTest('sample.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+
+ {{#each this.availableCountries as |country|}}
+
+ {{country.name}}
+
+ {{/each}}
+
+
+ "
+ `);
});
test('sample2', () => {
@@ -372,7 +623,18 @@ test('sample2', () => {
{{/my-card}}
`;
- expect(runTest('sample2.hbs', input)).toMatchSnapshot();
+ expect(runTest('sample2.hbs', input)).toMatchInlineSnapshot(`
+ "
+
+
+
+ hello
+
+
+
+ {{card.foo}}
+ "
+ `);
});
test('t-helper', () => {
@@ -380,7 +642,9 @@ test('t-helper', () => {
{{t "some.string" param="string" another=1}}
`;
- expect(runTest('t-helper.hbs', input)).toMatchSnapshot();
+ expect(runTest('t-helper.hbs', input)).toMatchInlineSnapshot(
+ `"{{t \\"some.string\\" param=\\"string\\" another=1}}"`
+ );
});
test('tag-name', () => {
@@ -388,7 +652,7 @@ test('tag-name', () => {
{{foo/bar name=""}}
`;
- expect(runTest('tag-name.hbs', input)).toMatchSnapshot();
+ expect(runTest('tag-name.hbs', input)).toMatchInlineSnapshot(`""`);
});
test('textarea', () => {
@@ -396,7 +660,9 @@ test('textarea', () => {
{{textarea value=this.model.body}}
`;
- expect(runTest('textarea.hbs', input)).toMatchSnapshot();
+ expect(runTest('textarea.hbs', input)).toMatchInlineSnapshot(
+ `""`
+ );
});
test('tilde', () => {
@@ -406,7 +672,13 @@ test('tilde', () => {
{{/if}}
`;
- expect(runTest('tilde.hbs', input)).toMatchSnapshot();
+ expect(runTest('tilde.hbs', input)).toMatchInlineSnapshot(`
+ "
+ {{#if foo~}}
+ {{some-component}}
+ {{/if}}
+ "
+ `);
});
test('undefined-subexp', () => {
@@ -414,7 +686,9 @@ test('undefined-subexp', () => {
{{some-component selected=(is-equal this.bar undefined)}}
`;
- expect(runTest('undefined-subexp.hbs', input)).toMatchSnapshot();
+ expect(runTest('undefined-subexp.hbs', input)).toMatchInlineSnapshot(
+ `""`
+ );
});
test('unless', () => {
@@ -424,7 +698,11 @@ test('unless', () => {
{{/unless}}
`;
- expect(runTest('unless.hbs', input)).toMatchSnapshot();
+ expect(runTest('unless.hbs', input)).toMatchInlineSnapshot(`
+ "{{#unless this.hasPaid}}
+ You owe: \${{this.total}}
+ {{/unless}}"
+ `);
});
test('skip-default-helpers', () => {
@@ -461,7 +739,39 @@ test('skip-default-helpers', () => {
helpers: ['some-helper1', 'some-helper2', 'some-helper3'],
};
- expect(runTest('skip-default-helpers.hbs', input, options)).toMatchSnapshot();
+ expect(runTest('skip-default-helpers.hbs', input, options)).toMatchInlineSnapshot(`
+ "
+ {{liquid-outlet}}
+
+
+
+ {{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
+
+ {{#liquid-if showA use=\\"toLeft\\"}}
+
+ One: A
+
+ {{else}}
+
+ One: B
+
+ {{/liquid-if}}
+
+ {{else}}
+
+ Two
+
+ {{/liquid-if}}
+ {{moment \\"12-25-1995\\" \\"MM-DD-YYYY\\"}}
+ {{moment-from \\"1995-12-25\\" \\"2995-12-25\\" hideAffix=true}}
+
+ {{some-helper1 foo=true}}
+ {{some-helper2 foo=true}}"
+ `);
});
test('skip-default-helpers (no-config)', () => {
@@ -494,7 +804,39 @@ test('skip-default-helpers (no-config)', () => {
{{some-helper2 foo=true}}
`;
- expect(runTest('skip-default-helpers.hbs', input)).toMatchSnapshot();
+ expect(runTest('skip-default-helpers.hbs', input)).toMatchInlineSnapshot(`
+ "
+ {{liquid-outlet}}
+
+
+
+ {{#liquid-if showOne class=\\"nested-explode-transition-scenario\\"}}
+
+ {{#liquid-if showA use=\\"toLeft\\"}}
+
+ One: A
+
+ {{else}}
+
+ One: B
+
+ {{/liquid-if}}
+
+ {{else}}
+
+ Two
+
+ {{/liquid-if}}
+ {{moment \\"12-25-1995\\" \\"MM-DD-YYYY\\"}}
+ {{moment-from \\"1995-12-25\\" \\"2995-12-25\\" hideAffix=true}}
+
+
+ "
+ `);
});
test('custom-options', () => {
@@ -512,5 +854,12 @@ test('custom-options', () => {
skipBuiltInComponents: true,
};
- expect(runTest('custom-options.hbs', input, options)).toMatchSnapshot();
+ expect(runTest('custom-options.hbs', input, options)).toMatchInlineSnapshot(`
+ "
+ {{some-helper1 foo=true}}
+ {{some-helper2 foo=true}}
+ {{link-to \\"Title\\" \\"some.route\\"}}
+ {{textarea value=this.model.body}}
+ {{input type=\\"checkbox\\" name=\\"email-opt-in\\" checked=this.model.emailPreference}}"
+ `);
});