import { EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION } from '@ember/canary-features'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; import { compile } from '../../index'; moduleFor( 'ember-template-compiler: assert-splattribute-expression', class extends AbstractTestCase { expectedMessage(locInfo) { return EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION ? `Using "...attributes" can only be used in the element position e.g.
. It cannot be used as a path. (${locInfo}) ` : `...attributes is an invalid path (${locInfo}) `; } '@test ...attributes is in element space'(assert) { if (EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION) { assert.expect(0); compile('
Foo
'); } else { expectAssertion(() => { compile('
Foo
'); }, this.expectedMessage('L1:C5')); } } '@test {{...attributes}} is not valid'() { expectAssertion(() => { compile('
{{...attributes}}
', { moduleName: 'foo-bar', }); }, this.expectedMessage(`'foo-bar' @ L1:C7`)); } '@test {{...attributes}} is not valid path expression'() { expectAssertion(() => { compile('
{{...attributes}}
', { moduleName: 'foo-bar', }); }, this.expectedMessage(`'foo-bar' @ L1:C7`)); } '@test {{...attributes}} is not valid modifier'() { expectAssertion(() => { compile('
Wat
', { moduleName: 'foo-bar', }); }, this.expectedMessage(`'foo-bar' @ L1:C7`)); } '@test {{...attributes}} is not valid attribute'() { expectAssertion(() => { compile('
Wat
', { moduleName: 'foo-bar', }); }, this.expectedMessage(`'foo-bar' @ L1:C13`)); } } );