Sha256: 01f2cea810f35b8d7081ce60f30e2c0f17e05199f49fb3ffe6a1eb0ab4ffb413

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

import { compile } from '../../index';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'ember-template-compiler: assert-if-helper-without-argument',
  class extends AbstractTestCase {
    [`@test block if helper expects one argument`]() {
      expectAssertion(() => {
        compile(`{{#if}}aVal{{/if}}`, {
          moduleName: 'baz/foo-bar',
        });
      }, `#if requires a single argument. ('baz/foo-bar' @ L1:C0) `);

      expectAssertion(() => {
        compile(`{{#if val1 val2}}aVal{{/if}}`, {
          moduleName: 'baz/foo-bar',
        });
      }, `#if requires a single argument. ('baz/foo-bar' @ L1:C0) `);

      expectAssertion(() => {
        compile(`{{#if}}aVal{{/if}}`, {
          moduleName: 'baz/foo-bar',
        });
      }, `#if requires a single argument. ('baz/foo-bar' @ L1:C0) `);
    }

    [`@test inline if helper expects between one and three arguments`]() {
      expectAssertion(() => {
        compile(`{{if}}`, {
          moduleName: 'baz/foo-bar',
        });
      }, `The inline form of the 'if' helper expects two or three arguments. ('baz/foo-bar' @ L1:C0) `);

      compile(`{{if foo bar baz}}`, {
        moduleName: 'baz/foo-bar',
      });
    }

    ['@test subexpression if helper expects between one and three arguments']() {
      expectAssertion(() => {
        compile(`{{input foo=(if)}}`, {
          moduleName: 'baz/foo-bar',
        });
      }, `The inline form of the 'if' helper expects two or three arguments. ('baz/foo-bar' @ L1:C12) `);

      compile(`{{some-thing foo=(if foo bar baz)}}`, {
        moduleName: 'baz/foo-bar',
      });
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js
discourse-ember-source-3.5.1.1 dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js