diff --git a/lib/componentFactory.js b/lib/componentFactory.js index 0361e4d..c830ad6 100644 --- a/lib/componentFactory.js +++ b/lib/componentFactory.js @@ -33,7 +33,7 @@ module.exports = function(element) { } // If the button is expanded, it needs a
tag around the content - if (element.hasClass('expand')) { + if (element.hasClass('expand') || element.hasClass('expanded')) { inner = format('
%s
', inner); expander = '\n'; } @@ -111,14 +111,29 @@ module.exports = function(element) { case this.components.spacer: var classes = ['spacer']; var size = 16; + var html = ''; if (element.attr('class')) { classes = classes.concat(element.attr('class').split(' ')); } if (element.attr('size')) { size = (element.attr('size')); + html += '
 
'; + } else { + if (element.attr('size-sm')) { + size = (element.attr('size-sm')); + html += '
 
'; + } + if (element.attr('size-lg')) { + size = (element.attr('size-lg')); + html += '
 
'; + } + } + + if( element.attr('size-sm') && element.attr('size-lg') ) { + return format(html, classes.join(' '), classes.join(' '), inner); } - return format('
 
', classes.join(' '), inner); + return format(html, classes.join(' '), inner); // case this.components.wrapper: diff --git a/test/components.js b/test/components.js index 1e3af90..e6ff3af 100644 --- a/test/components.js +++ b/test/components.js @@ -246,6 +246,58 @@ describe('Spacer', () => { compare(input, expected); }); + it('creates a spacer element for small screens with correct size', () => { + var input = ''; + var expected = ` + + + + + + +
 
+ `; + + compare(input, expected); + }); + + it('creates a spacer element for large screens with correct size', () => { + var input = ''; + var expected = ` + + + + + + +
 
+ `; + + compare(input, expected); + }); + + it('creates a spacer element for small and large screens with correct sizes', () => { + var input = ''; + var expected = ` + + + + + + +
 
+ + + + + + +
 
+ `; + + compare(input, expected); + }); + it('copies classes to the final spacer HTML', () => { var input = ''; var expected = `