Sha256: 109d7c73ee7a01922519cf6fea999fc689120013accd0d5505c7366e37aca7b4

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'
require 'vedeu/output/clear_interface'
require 'vedeu/models/interface'
require 'vedeu/support/interface_store'

module Vedeu
  describe ClearInterface do
    before { InterfaceStore.reset }

    describe '.call' do
      it 'returns the escape sequence to clear the whole interface' do
        interface = Interface.new({
          name:   'ClearInterface.call',
          width:  5,
          height: 2
        })
        ClearInterface.call(interface).must_equal(
          "\e[1;1H     \e[1;1H" \
          "\e[2;1H     \e[2;1H"
        )
      end

      it 'returns the escape sequence to clear the whole interface with specified colours' do
        interface = Interface.new({
          name:   'ClearInterface.call',
          width:  5,
          height: 2,
          colour: {
            foreground: '#00ff00',
            background: '#ffff00'
          }
        })
        ClearInterface.call(interface).must_equal(
          "\e[38;5;46m\e[48;5;226m" \
          "\e[1;1H     \e[1;1H" \
          "\e[2;1H     \e[2;1H"
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.3 test/lib/vedeu/output/clear_interface_test.rb