File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ describe('native components', function() {
488488 expect ( generateSnapshot ( source , template ) ) . toMatchSnapshot ( ) ;
489489 } ) ;
490490
491- test ( ' skips tagless components' , ( ) => {
491+ test ( " skips @tagName('') components" , ( ) => {
492492 let source = `
493493 import Component from '@ember/component';
494494 import { tagName } from '@ember-decorators/component';
@@ -506,6 +506,23 @@ describe('native components', function() {
506506 expect ( result . template ) . toEqual ( template ) ;
507507 } ) ;
508508
509+ test ( "skips tagName='' components" , ( ) => {
510+ let source = `
511+ import Component from '@ember/component';
512+
513+ export default class FooComponent extends Component {
514+ tagName = '';
515+ }
516+ ` ;
517+
518+ let template = 'foo' ;
519+
520+ let result = transform ( source , template ) ;
521+ expect ( result . tagName ) . toEqual ( undefined ) ;
522+ expect ( result . source ) . toEqual ( source ) ;
523+ expect ( result . template ) . toEqual ( template ) ;
524+ } ) ;
525+
509526 test ( 'throws if component is using `this.element`' , ( ) => {
510527 let source = `
511528 import Component from '@ember/component';
Original file line number Diff line number Diff line change @@ -77,9 +77,12 @@ function findStringDecorator(path, name) {
7777 return decorator . value . expression . arguments [ 0 ] . value ;
7878}
7979
80- function findTagName ( path ) {
81- let value = findStringDecorator ( path , 'tagName' ) ;
82- return value !== undefined ? value : 'div' ;
80+ function findTagName ( classDeclaration ) {
81+ let value = findStringDecorator ( classDeclaration , 'tagName' ) ;
82+ if ( value === undefined ) {
83+ value = findStringProperty ( classDeclaration . get ( 'body' , 'body' ) , 'tagName' ) ;
84+ }
85+ return value !== undefined && value !== null ? value : 'div' ;
8386}
8487
8588function findElementId ( path ) {
You can’t perform that action at this time.
0 commit comments