@@ -61,7 +61,6 @@ describe("textWrap", function () {
61
61
expect ( model . staticWidthStack . length ) . toEqual ( 0 ) ;
62
62
} ) ;
63
63
64
- //this._tryAddBreak = tryAddBreak;
65
64
it ( 'tryAddBreak should break before and item too large to break, unless it is the beginning of a line' , function ( ) {
66
65
var model = new TextWrapper . prototype . TextWrapperModel ( item ) ;
67
66
var item = document . createElement ( 'SPAN' ) ;
@@ -288,7 +287,7 @@ describe("textWrap", function () {
288
287
expect ( model . lastBreakIndex ) . toEqual ( 0 ) ;
289
288
} ) ;
290
289
291
- it ( 'startSplitTextWith a short guess no possible break' , function ( ) {
290
+ it ( 'startSplitText With a short guess no possible break' , function ( ) {
292
291
var item = document . createElement ( 'SPAN' ) ;
293
292
document . body . insertBefore ( item , document . body . firstChild ) ;
294
293
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -306,7 +305,26 @@ describe("textWrap", function () {
306
305
document . body . removeChild ( document . body . firstChild ) ;
307
306
} ) ;
308
307
309
- it ( 'startSplitTextWith a long guess no possible break' , function ( ) {
308
+ it ( 'startSplitText With a long guess and only possible break is leading space' , function ( ) {
309
+ var item = document . createElement ( 'SPAN' ) ;
310
+ document . body . insertBefore ( item , document . body . firstChild ) ;
311
+ var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
312
+ settings . maxLines = 1 ;
313
+ item . innerHTML = ' asdf' ;
314
+ var model = new TextWrapper . prototype . TextWrapperModel ( item , settings ) ;
315
+ model . children = w . _getFlattenedChildren ( item ) ;
316
+ model . splitIndex = 0 ;
317
+ model . splitNode = model . children [ model . splitIndex ] ;
318
+ model . splitNode . bounds = w . _createRangeBounds ( model . splitNode . node ) ;
319
+ model . elementBounds = new w . _elementBounds ( item , '1px' ) ;
320
+ var result = w . _startSplitText ( model , ' asdf' , 3 ) ;
321
+ expect ( item . firstChild . data ) . toEqual ( ' asdf' ) ;
322
+ expect ( result ) . toEqual ( false ) ;
323
+ expect ( model . splitIndex ) . toEqual ( 0 ) ;
324
+ document . body . removeChild ( document . body . firstChild ) ;
325
+ } ) ;
326
+
327
+ it ( 'startSplitText With a long guess no possible break' , function ( ) {
310
328
var item = document . createElement ( 'SPAN' ) ;
311
329
document . body . insertBefore ( item , document . body . firstChild ) ;
312
330
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -324,7 +342,7 @@ describe("textWrap", function () {
324
342
document . body . removeChild ( document . body . firstChild ) ;
325
343
} ) ;
326
344
327
- it ( 'startSplitTextWith a long guess and forcebreak on space default behavior' , function ( ) {
345
+ it ( 'startSplitText With a long guess and forcebreak on space default behavior' , function ( ) {
328
346
var item = document . createElement ( 'SPAN' ) ;
329
347
document . body . insertBefore ( item , document . body . firstChild ) ;
330
348
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -345,7 +363,7 @@ describe("textWrap", function () {
345
363
document . body . removeChild ( document . body . firstChild ) ;
346
364
} ) ;
347
365
348
- it ( 'startSplitTextWith a short guess and forcebreak on space default behavior' , function ( ) {
366
+ it ( 'startSplitText With a short guess and forcebreak on space default behavior' , function ( ) {
349
367
var item = document . createElement ( 'SPAN' ) ;
350
368
document . body . insertBefore ( item , document . body . firstChild ) ;
351
369
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -366,7 +384,7 @@ describe("textWrap", function () {
366
384
document . body . removeChild ( document . body . firstChild ) ;
367
385
} ) ;
368
386
369
- it ( 'startSplitTextWith a very long guess and break on space default behavior' , function ( ) {
387
+ it ( 'startSplitText With a very long guess and break on space default behavior' , function ( ) {
370
388
var item = document . createElement ( 'SPAN' ) ;
371
389
document . body . insertBefore ( item , document . body . firstChild ) ;
372
390
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -386,7 +404,7 @@ describe("textWrap", function () {
386
404
document . body . removeChild ( document . body . firstChild ) ;
387
405
} ) ;
388
406
389
- it ( 'startSplitTextWith a long guess and break on space default behavior' , function ( ) {
407
+ it ( 'startSplitText With a long guess and break on space default behavior' , function ( ) {
390
408
var item = document . createElement ( 'SPAN' ) ;
391
409
document . body . insertBefore ( item , document . body . firstChild ) ;
392
410
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -406,7 +424,7 @@ describe("textWrap", function () {
406
424
document . body . removeChild ( document . body . firstChild ) ;
407
425
} ) ;
408
426
409
- it ( 'startSplitTextWith a short guess and break on space default behavior' , function ( ) {
427
+ it ( 'startSplitText With a short guess and break on space default behavior' , function ( ) {
410
428
var item = document . createElement ( 'SPAN' ) ;
411
429
document . body . insertBefore ( item , document . body . firstChild ) ;
412
430
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -426,7 +444,7 @@ describe("textWrap", function () {
426
444
document . body . removeChild ( document . body . firstChild ) ;
427
445
} ) ;
428
446
429
- it ( 'startSplitTextWith a very short guess and break on space default behavior' , function ( ) {
447
+ it ( 'startSplitText With a very short guess and break on space default behavior' , function ( ) {
430
448
var item = document . createElement ( 'SPAN' ) ;
431
449
document . body . insertBefore ( item , document . body . firstChild ) ;
432
450
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -446,7 +464,7 @@ describe("textWrap", function () {
446
464
document . body . removeChild ( document . body . firstChild ) ;
447
465
} ) ;
448
466
449
- it ( 'startSplitTextWith a short guess and no break default behavior' , function ( ) {
467
+ it ( 'startSplitText With a short guess and no break default behavior' , function ( ) {
450
468
var item = document . createElement ( 'SPAN' ) ;
451
469
document . body . insertBefore ( item , document . body . firstChild ) ;
452
470
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
@@ -463,7 +481,7 @@ describe("textWrap", function () {
463
481
document . body . removeChild ( document . body . firstChild ) ;
464
482
} ) ;
465
483
466
- it ( 'startSplitTextWith a short guess and no word break default behavior' , function ( ) {
484
+ it ( 'startSplitText With a short guess and no word break default behavior' , function ( ) {
467
485
var item = document . createElement ( 'SPAN' ) ;
468
486
document . body . insertBefore ( item , document . body . firstChild ) ;
469
487
var settings = new TextWrapper . prototype . TextWrapperSettings ( ) ;
0 commit comments