| skipped 345 lines |
346 | 346 | | }); |
347 | 347 | | |
348 | 348 | | |
| 349 | + | test(`Render - Top align block font`, () => { |
| 350 | + | const test = Render( 'text', { |
| 351 | + | align: 'top', |
| 352 | + | }, false, 1, { width: 50, height: 10 }); |
| 353 | + | |
| 354 | + | expect( test.string ).toBe( |
| 355 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ \n' + |
| 356 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ \n' + |
| 357 | + | ' ██║ █████╗ ╚███╔╝ ██║ \n' + |
| 358 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ \n' + |
| 359 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ \n' + |
| 360 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ \n\n\n\n' |
| 361 | + | ); |
| 362 | + | expect( test.array ).toEqual([ |
| 363 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ ', |
| 364 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ ', |
| 365 | + | ' ██║ █████╗ ╚███╔╝ ██║ ', |
| 366 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ ', |
| 367 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ ', |
| 368 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ \n\n\n\n', |
| 369 | + | ]); |
| 370 | + | expect( test.lines ).toBe( 1 ); |
| 371 | + | expect( test.options ).toEqual({ |
| 372 | + | font: 'block', |
| 373 | + | align: 'top', |
| 374 | + | colors: [], |
| 375 | + | background: 'transparent', |
| 376 | + | letterSpacing: 1, |
| 377 | + | lineHeight: 1, |
| 378 | + | space: true, |
| 379 | + | maxLength: 0, |
| 380 | + | gradient: false, |
| 381 | + | independentGradient: false, |
| 382 | + | transitionGradient: false, |
| 383 | + | env: 'node', |
| 384 | + | }); |
| 385 | + | }); |
| 386 | + | |
| 387 | + | |
| 388 | + | test(`Render - Bottom align block font`, () => { |
| 389 | + | const test = Render( 'text', { |
| 390 | + | align: 'bottom', |
| 391 | + | }, false, 1, { width: 50, height: 10 }); |
| 392 | + | |
| 393 | + | expect( test.string ).toBe( |
| 394 | + | '\n\n\n\n' + |
| 395 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ \n' + |
| 396 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ \n' + |
| 397 | + | ' ██║ █████╗ ╚███╔╝ ██║ \n' + |
| 398 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ \n' + |
| 399 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ \n' + |
| 400 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ' |
| 401 | + | ); |
| 402 | + | expect( test.array ).toEqual([ |
| 403 | + | '\n\n\n\n ████████╗ ███████╗ ██╗ ██╗ ████████╗ ', |
| 404 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ ', |
| 405 | + | ' ██║ █████╗ ╚███╔╝ ██║ ', |
| 406 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ ', |
| 407 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ ', |
| 408 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ', |
| 409 | + | ]); |
| 410 | + | expect( test.lines ).toBe( 1 ); |
| 411 | + | expect( test.options ).toEqual({ |
| 412 | + | font: 'block', |
| 413 | + | align: 'bottom', |
| 414 | + | colors: [], |
| 415 | + | background: 'transparent', |
| 416 | + | letterSpacing: 1, |
| 417 | + | lineHeight: 1, |
| 418 | + | space: true, |
| 419 | + | maxLength: 0, |
| 420 | + | gradient: false, |
| 421 | + | independentGradient: false, |
| 422 | + | transitionGradient: false, |
| 423 | + | env: 'node', |
| 424 | + | }); |
| 425 | + | }); |
| 426 | + | |
| 427 | + | |
| 428 | + | test(`Render - Ignore alignment top when combining it with space option`, () => { |
| 429 | + | const test = Render( 'text', { |
| 430 | + | space: false, |
| 431 | + | align: 'top', |
| 432 | + | }, false, 1, { width: 100, height: 10 } ); |
| 433 | + | |
| 434 | + | expect( test.string ).toBe( |
| 435 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ \n' + |
| 436 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ \n' + |
| 437 | + | ' ██║ █████╗ ╚███╔╝ ██║ \n' + |
| 438 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ \n' + |
| 439 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ \n' + |
| 440 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ' |
| 441 | + | ); |
| 442 | + | expect( test.array ).toEqual([ |
| 443 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ ', |
| 444 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ ', |
| 445 | + | ' ██║ █████╗ ╚███╔╝ ██║ ', |
| 446 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ ', |
| 447 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ ', |
| 448 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ', |
| 449 | + | ]); |
| 450 | + | expect( test.lines ).toBe( 1 ); |
| 451 | + | expect( test.options ).toEqual({ |
| 452 | + | font: 'block', |
| 453 | + | align: 'top', |
| 454 | + | colors: [], |
| 455 | + | background: 'transparent', |
| 456 | + | letterSpacing: 1, |
| 457 | + | lineHeight: 1, |
| 458 | + | space: false, |
| 459 | + | maxLength: 0, |
| 460 | + | gradient: false, |
| 461 | + | independentGradient: false, |
| 462 | + | transitionGradient: false, |
| 463 | + | env: 'node', |
| 464 | + | }); |
| 465 | + | }); |
| 466 | + | |
| 467 | + | |
| 468 | + | test(`Render - Ignore alignment bottom when combining it with space option`, () => { |
| 469 | + | const test = Render( 'text', { |
| 470 | + | space: false, |
| 471 | + | align: 'bottom', |
| 472 | + | }, false, 1, { width: 100, height: 10 } ); |
| 473 | + | |
| 474 | + | expect( test.string ).toBe( |
| 475 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ \n' + |
| 476 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ \n' + |
| 477 | + | ' ██║ █████╗ ╚███╔╝ ██║ \n' + |
| 478 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ \n' + |
| 479 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ \n' + |
| 480 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ' |
| 481 | + | ); |
| 482 | + | expect( test.array ).toEqual([ |
| 483 | + | ' ████████╗ ███████╗ ██╗ ██╗ ████████╗ ', |
| 484 | + | ' ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝ ', |
| 485 | + | ' ██║ █████╗ ╚███╔╝ ██║ ', |
| 486 | + | ' ██║ ██╔══╝ ██╔██╗ ██║ ', |
| 487 | + | ' ██║ ███████╗ ██╔╝ ██╗ ██║ ', |
| 488 | + | ' ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ', |
| 489 | + | ]); |
| 490 | + | expect( test.lines ).toBe( 1 ); |
| 491 | + | expect( test.options ).toEqual({ |
| 492 | + | font: 'block', |
| 493 | + | align: 'bottom', |
| 494 | + | colors: [], |
| 495 | + | background: 'transparent', |
| 496 | + | letterSpacing: 1, |
| 497 | + | lineHeight: 1, |
| 498 | + | space: false, |
| 499 | + | maxLength: 0, |
| 500 | + | gradient: false, |
| 501 | + | independentGradient: false, |
| 502 | + | transitionGradient: false, |
| 503 | + | env: 'node', |
| 504 | + | }); |
| 505 | + | }); |
| 506 | + | |
| 507 | + | |
349 | 508 | | test(`Render - Break into new line on smaller viewports`, () => { |
350 | 509 | | const test = Render( 'text', {}, false, 1, { width: 20, height: 10 }); |
351 | 510 | | |
| skipped 401 lines |