// font size * line height + top/bottom padding + top/bottom border
// (16 * 1.4) + (6 * 2) + 2

function getLineHeight(textarea) {
  return parseInt(textarea.css('line-height'));
}

function spacingHeight(textarea) {
  return parseInt(textarea.css('paddingBottom')) +
    parseInt(textarea.css('paddingTop')) + 
    parseInt(textarea.css('borderBottomWidth')) + 
    parseInt(textarea.css('borderTopWidth'));
}

describe("TextArea", function () {
  var textarea;
  
  beforeEach(function(){
    textarea = $("#js-single-line-textarea")
      .val('')
      .css('maxHeight', '')
      .textareaAutoSize();
  });

  it('has a rendered height of one line with no text', function() {
    expect(textarea.val()).to.equal('');
    expect(textarea.outerHeight()).to.equal(36);
  });

  it('has a rendered height of 2 lines when large enough text entered', function() {
    textarea.val('this is a test with a really long entry').trigger('input');
    
    expect(textarea.outerHeight()).to.equal(58);
  });

  it('resizes to one line when deleting all text', function() {
    textarea.val('').trigger('input');
    
    expect(textarea.outerHeight()).to.equal(36);
    expect(textarea.val()).to.equal('');
  });
});

@@ -1200,12 +1200,570 @@
 ;%0A  %7D);%0A
+  %0A  it('stops resizing when given max height is reached', function() %7B%0A    var maxHeight = 100;%0A    textarea.css('maxHeight', maxHeight + 'px');%0A    textarea.val('this is a test with a really long entry this is a test with a really long entry this is a test with a really long entry this is a test with a really long entry').trigger('input');%0A    %0A    expect(textarea.outerHeight()).to.equal(maxHeight);%0A    %0A    // double check that text has exceeded height and textarea is scrollable%0A    expect(textarea.get(0).scrollHeight).to.be.above(maxHeight);%0A  %7D);%0A
 %7D);%0A

add case for when max height reached