Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/bigtext.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! BigText - v0.1.8 - 2015-02-28
/*! BigText - v0.1.8 - 2015-05-25
* https://github.com/zachleat/bigtext
* Copyright (c) 2015 Zach Leatherman (@zachleat)
* MIT License */
Expand Down Expand Up @@ -215,7 +215,7 @@

outer: for(var m=0, n=intervals.length; m<n; m++) {
inner: for(var j=1, k=10; j<=k; j++) {
if(newFontSize + j*intervals[m] > maxFontSize) {
if(newFontSize + j*intervals[m] - 10 > maxFontSize) {
newFontSize = maxFontSize;
break outer;
}
Expand Down
13 changes: 13 additions & 0 deletions dist/test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@
'Font size should equal the maximum.');
});

test('testCloseToMaxFontSize', function()
{
$('#qunit-fixture').html('<div id="test" style="width:140px"><div>Hello</div></div>');
$('#test').bigtext();
var font_size_without_max = $('#test > div').css('font-size');

$('#test').bigtext( { maxfontsize: parseInt(font_size_without_max)+1 } );
var font_size_with_max = $('#test > div').css('font-size');

equal(font_size_with_max, font_size_without_max,
'Font size should not equal the maximum.');
});

test('testUnbrokenSingleWord', function()
{
$('#qunit-fixture').html('<div id="test" style="width:300px"><div>This</div></div>');
Expand Down
13 changes: 13 additions & 0 deletions src/bigtext-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@
'Font size should equal the maximum.');
});

test('testCloseToMaxFontSize', function()
{
$('#qunit-fixture').html('<div id="test" style="width:140px"><div>Hello</div></div>');
$('#test').bigtext();
var font_size_without_max = $('#test > div').css('font-size');

$('#test').bigtext( { maxfontsize: parseInt(font_size_without_max)+1 } );
var font_size_with_max = $('#test > div').css('font-size');

equal(font_size_with_max, font_size_without_max,
'Font size should not equal the maximum.');
});

test('testUnbrokenSingleWord', function()
{
$('#qunit-fixture').html('<div id="test" style="width:300px"><div>This</div></div>');
Expand Down
2 changes: 1 addition & 1 deletion src/bigtext.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@

outer: for(var m=0, n=intervals.length; m<n; m++) {
inner: for(var j=1, k=10; j<=k; j++) {
if(newFontSize + j*intervals[m] > maxFontSize) {
if(newFontSize + j*intervals[m] - 10 > maxFontSize) {
newFontSize = maxFontSize;
break outer;
}
Expand Down