Browse Source

Improve table head for xml parser

pull/3691/head
Artur Arseniev 5 years ago
parent
commit
b5a9774ef4
  1. 17
      src/dom_components/model/ComponentTableHead.js
  2. 4
      test/specs/dom_components/model/ComponentTypes.js

17
src/dom_components/model/ComponentTableHead.js

@ -1,22 +1,17 @@
import ComponentTableBody from './ComponentTableBody';
import { toLowerCase } from 'utils/mixins';
const type = 'thead';
export default ComponentTableBody.extend(
{
defaults: {
...ComponentTableBody.prototype.defaults,
type: 'thead',
tagName: 'thead'
type,
tagName: type
}
},
{
isComponent(el) {
let result = '';
if (el.tagName == 'THEAD') {
result = { type: 'thead' };
}
return result;
}
isComponent: el => toLowerCase(el.tagName) === type
}
);

4
test/specs/dom_components/model/ComponentTypes.js

@ -44,6 +44,10 @@ describe('Component Types', () => {
expectedType('<table></table>', 'table', { skipHtml: 1 });
});
test('<thead> is correctly recognized', () => {
expectedType('<thead></thead>', 'thead', { skipHtml: 1 });
});
test('<tbody> is correctly recognized', () => {
expectedType('<tbody></tbody>', 'tbody', { skipHtml: 1 });
});

Loading…
Cancel
Save