diff --git a/src/dom_components/model/ComponentTableCell.js b/src/dom_components/model/ComponentTableCell.js index 9fa1024bf..3fe597e89 100644 --- a/src/dom_components/model/ComponentTableCell.js +++ b/src/dom_components/model/ComponentTableCell.js @@ -1,4 +1,5 @@ import Component from './Component'; +import { toLowerCase } from 'utils/mixins'; export default Component.extend( { @@ -10,18 +11,6 @@ export default Component.extend( } }, { - isComponent(el) { - let result = ''; - const tag = el.tagName; - - if (tag == 'TD' || tag == 'TH') { - result = { - type: 'cell', - tagName: tag.toLowerCase() - }; - } - - return result; - } + isComponent: el => ['td', 'th'].indexOf(toLowerCase(el.tagName)) >= 0 } ); diff --git a/test/specs/dom_components/model/ComponentTypes.js b/test/specs/dom_components/model/ComponentTypes.js index 74caea70f..c985b8a83 100644 --- a/test/specs/dom_components/model/ComponentTypes.js +++ b/test/specs/dom_components/model/ComponentTypes.js @@ -6,7 +6,7 @@ describe('Component Types', () => { const expectedType = (input, type, opts = {}) => { const cmp = wrapper.append(input)[0]; - expect(wrapper.components().length).toBe(1); + expect(wrapper.components().length).toBe(opts.total || 1); !opts.skipHtml && expect(cmp.toHTML()).toBe(input); expect(cmp.is(type)).toBe(true); }; @@ -48,6 +48,11 @@ describe('Component Types', () => { expectedType('', 'tbody', { skipHtml: 1 }); }); + test(' & are correctly recognized', () => { + expectedType('', 'cell'); + expectedType('', 'cell', { total: 2 }); + }); + test('