Skip to content

Commit

Permalink
tests: Add this. prefix to templates (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Apr 11, 2022
1 parent b530814 commit 75bedfd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/minifier-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('collapses whitespace into single space character', async function(assert) {
await render(hbs`{{foo}} \n\n \n{{bar}}`);
await render(hbs`{{this.foo}} \n\n \n{{this.bar}}`);

let childNodes = [...this.element.childNodes].filter(it => it.textContent !== '');
assert.strictEqual(childNodes.length, 3);
Expand All @@ -20,7 +20,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('strips leading and trailing whitespace from Program nodes', async function(assert) {
await render(hbs` {{foo}} `);
await render(hbs` {{this.foo}} `);

let childNodes = [...this.element.childNodes].filter(it => it.textContent !== '');
assert.strictEqual(childNodes.length, 1);
Expand All @@ -29,7 +29,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('Collapse leading/trailing text from Program nodes into a single whitespace', async function(assert) {
await render(hbs`x {{foo}} y `);
await render(hbs`x {{this.foo}} y `);

let childNodes = [...this.element.childNodes].filter(it => it.textContent !== '');
assert.strictEqual(childNodes.length, 3);
Expand All @@ -42,7 +42,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('strips leading and trailing whitespace from ElementNode nodes', async function(assert) {
await render(hbs`<div> {{foo}} </div>`);
await render(hbs`<div> {{this.foo}} </div>`);

let childNodes = this.element.querySelector('div').childNodes;
assert.strictEqual(childNodes.length, 1);
Expand All @@ -51,7 +51,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('Collapse leading/trailing text from ElementNode nodes', async function(assert) {
await render(hbs`<div>x {{foo}} y {{bar}} z</div>`);
await render(hbs`<div>x {{this.foo}} y {{this.bar}} z</div>`);

let childNodes = this.element.querySelector('div').childNodes;
assert.strictEqual(childNodes.length, 5);
Expand All @@ -66,7 +66,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('does not strip inside of <pre> tags', async function(assert) {
await render(hbs`<pre> {{foo}} </pre>`);
await render(hbs`<pre> {{this.foo}} </pre>`);

let childNodes = this.element.querySelector('pre').childNodes;
assert.strictEqual(childNodes.length, 3);
Expand All @@ -88,7 +88,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('does not strip inside of {{#no-minify}} tags', async function(assert) {
await render(hbs`{{#no-minify}} {{foo}} {{/no-minify}}`);
await render(hbs`{{#no-minify}} {{this.foo}} {{/no-minify}}`);

let childNodes = [...this.element.childNodes].filter(it => it.textContent !== '');
assert.strictEqual(childNodes.length, 3);
Expand All @@ -101,7 +101,7 @@ module('HBS Minifier plugin', function(hooks) {
});

test('does not strip inside of {{#no-minify}} tags in other tags', async function(assert) {
await render(hbs`<div>{{#no-minify}} {{foo}} {{/no-minify}}</div>`);
await render(hbs`<div>{{#no-minify}} {{this.foo}} {{/no-minify}}</div>`);

let childNodes = this.element.querySelector('div').childNodes;
assert.strictEqual(childNodes.length, 3);
Expand Down

0 comments on commit 75bedfd

Please sign in to comment.