Skip to content

Commit

Permalink
Copy classes defined in <block-grid> tags to the final HTML, fixes fo…
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Mar 4, 2016
1 parent 77dd8f8 commit 1b6a989
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/componentFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ module.exports = function(element) {

// <block-grid>
case this.components.blockGrid:
return format('<table class="block-grid up-%s"><tr>%s</tr></table>', component.attr('up'), inner);
var classes = ['block-grid', 'up-'+component.attr('up')];
if (component.attr('class')) {
classes = classes.concat(component.attr('class').split(' '));
}
return format('<table class="%s"><tr>%s</tr></table>', classes.join(' '), inner);

// <menu>
case this.components.menu:
Expand Down
11 changes: 11 additions & 0 deletions test/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,15 @@ describe('Block Grid', () => {

compare(input, expected);
});

it('copies classes to the final HTML output', () => {
var input = '<block-grid up="4" class="show-for-large"></block-grid>';
var expected = `
<table class="block-grid up-4 show-for-large">
<tr></tr>
</table>
`;

compare(input, expected);
});
});

0 comments on commit 1b6a989

Please sign in to comment.