@@ -312,78 +312,79 @@ describe('native components', function() {
312312
313313 expect ( generateSnapshot ( source , template ) ) . toMatchSnapshot ( ) ;
314314 } ) ;
315- //
316- //
317- // test('skips tagless components', () => {
318- // let source = `
319- // export default Component.extend({
320- // tagName: '',
321- // });
322- // `;
323- //
324- // let template = 'foo';
325- //
326- // let result = transform(source, template);
327- // expect(result.tagName).toEqual(undefined);
328- // expect(result.source).toEqual(source);
329- // expect(result.template).toEqual(template);
330- // });
331- //
332- // test('throws if component is using `this.element`', () => {
333- // let source = `
334- // export default Component.extend({
335- // didInsertElement() {
336- // console.log(this.element);
337- // },
338- // });
339- // `;
340- //
341- // expect(() => transform(source, '')).toThrowErrorMatchingInlineSnapshot(
342- // `"Using \`this.element\` is not supported in tagless components"`
343- // );
344- // });
345- //
346- // test('throws if component is using `this.elementId`', () => {
347- // let source = `
348- // export default Component.extend({
349- // didInsertElement() {
350- // console.log(this.elementId);
351- // },
352- // });
353- // `;
354- //
355- // expect(() => transform(source, '')).toThrowErrorMatchingInlineSnapshot(
356- // `"Using \`this.elementId\` is not supported in tagless components"`
357- // );
358- // });
359- //
360- // test('throws if component is using `keyDown()`', () => {
361- // let source = `
362- // export default Component.extend({
363- // keyDown() {
364- // console.log('Hello World!');
365- // },
366- // });
367- // `;
368- //
369- // expect(() => transform(source, '')).toThrowErrorMatchingInlineSnapshot(
370- // `"Using \`keyDown()\` is not supported in tagless components"`
371- // );
372- // });
373- //
374- // test('throws if component is using `click()`', () => {
375- // let source = `
376- // export default Component.extend({
377- // click() {
378- // console.log('Hello World!');
379- // },
380- // });
381- // `;
382- //
383- // expect(() => transform(source, '')).toThrowErrorMatchingInlineSnapshot(
384- // `"Using \`click()\` is not supported in tagless components"`
385- // );
386- // });
315+
316+ test ( 'skips tagless components' , ( ) => {
317+ let source = `
318+ import { tagName } from '@ember-decorators/component';
319+
320+ @tagName('')
321+ export default class FooComponent extends Component {
322+ }
323+ ` ;
324+
325+ let template = 'foo' ;
326+
327+ let result = transform ( source , template ) ;
328+ expect ( result . tagName ) . toEqual ( undefined ) ;
329+ expect ( result . source ) . toEqual ( source ) ;
330+ expect ( result . template ) . toEqual ( template ) ;
331+ } ) ;
332+
333+ test ( 'throws if component is using `this.element`' , ( ) => {
334+ let source = `
335+ export default class FooComponent extends Component {
336+ didInsertElement() {
337+ console.log(this.element);
338+ }
339+ }
340+ ` ;
341+
342+ expect ( ( ) => transform ( source , '' ) ) . toThrowErrorMatchingInlineSnapshot (
343+ `"Using \`this.element\` is not supported in tagless components"`
344+ ) ;
345+ } ) ;
346+
347+ test ( 'throws if component is using `this.elementId`' , ( ) => {
348+ let source = `
349+ export default class FooComponent extends Component {
350+ didInsertElement() {
351+ console.log(this.elementId);
352+ }
353+ }
354+ ` ;
355+
356+ expect ( ( ) => transform ( source , '' ) ) . toThrowErrorMatchingInlineSnapshot (
357+ `"Using \`this.elementId\` is not supported in tagless components"`
358+ ) ;
359+ } ) ;
360+
361+ test ( 'throws if component is using `keyDown()`' , ( ) => {
362+ let source = `
363+ export default class FooComponent extends Component {
364+ keyDown() {
365+ console.log('Hello World!');
366+ }
367+ }
368+ ` ;
369+
370+ expect ( ( ) => transform ( source , '' ) ) . toThrowErrorMatchingInlineSnapshot (
371+ `"Using \`keyDown()\` is not supported in tagless components"`
372+ ) ;
373+ } ) ;
374+
375+ test ( 'throws if component is using `click()`' , ( ) => {
376+ let source = `
377+ export default class FooComponent extends Component {
378+ click() {
379+ console.log('Hello World!');
380+ }
381+ }
382+ ` ;
383+
384+ expect ( ( ) => transform ( source , '' ) ) . toThrowErrorMatchingInlineSnapshot (
385+ `"Using \`click()\` is not supported in tagless components"`
386+ ) ;
387+ } ) ;
387388 //
388389 // test('multi-line template', () => {
389390 // let source = `export default Component.extend({});`;
0 commit comments