diff --git a/lib/makeColumn.js b/lib/makeColumn.js index 25ce424..51c540f 100644 --- a/lib/makeColumn.js +++ b/lib/makeColumn.js @@ -25,6 +25,7 @@ module.exports = function(col) { // Check for sizes. If no attribute is provided, default to small-12. Divide evenly for large columns var smallSize = $(col).attr('small') || this.columnCount; var largeSize = $(col).attr('large') || $(col).attr('small') || Math.floor(this.columnCount / colCount); + var noExpander = $(col).attr('no-expander'); classes.push(format('small-%s', smallSize)); classes.push(format('large-%s', largeSize)); @@ -38,7 +39,7 @@ module.exports = function(col) { // If the column contains a nested row, the .expander class should not be used // The == on the first check is because we're comparing a string pulled from $.attr() to a number - if (largeSize == this.columnCount && col.find('.row, row').length === 0) { + if (largeSize == this.columnCount && col.find('.row, row').length === 0 && (noExpander == undefined || noExpander == "false") ) { expander = '\n'; } diff --git a/test/grid.js b/test/grid.js index af1f831..8b49810 100644 --- a/test/grid.js +++ b/test/grid.js @@ -75,6 +75,52 @@ describe('Grid', () => { compare(input, expected); }); + it('creates a single column with first and last classes with no-expander', function () { + var input = 'One'; + var expected = ` + + + + + +
One
+ + `; + + compare(input, expected); + }); + + it('creates a single column with first and last classes with no-expander="false"', function () { + var input = 'One'; + var expected = ` + + + + + + +
One
+ + `; + + compare(input, expected); + }); + + it('creates a single column with first and last classes with no-expander="true"', function () { + var input = 'One'; + var expected = ` + + + + + +
One
+ + `; + + compare(input, expected); + }); + it('creates two columns, one first, one last', function () { var input = ` One