Sha256: 8d59a82650b010376ebc4c79830053e1774148be1f98a7609ba84ba2aaf3dc30

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

RSpec.describe TTY::Box, ':align option' do
  it "aligns content without positioning" do
    box = TTY::Box.frame(width: 26, height: 4, align: :center) do
      "Drawing a box in terminal emulator"
    end

    expect(box).to eq([
      "┌────────────────────────┐\n",
      "│   Drawing a box in     │\n",
      "│   terminal emulator    │\n",
      "└────────────────────────┘\n"
    ].join)
  end

  it "aligns content with the option" do
    box = TTY::Box.frame(top: 0, left: 0, width: 26, height: 4, align: :center) do
      "Drawing a box in terminal emulator"
    end

    expect(box).to eq([
      "\e[1;1H┌────────────────────────┐",
      "\e[2;1H│   Drawing a box in     \e[2;26H│",
      "\e[3;1H│   terminal emulator    \e[3;26H│",
      "\e[4;1H└────────────────────────┘"
    ].join)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-box-0.5.0 spec/unit/align_spec.rb