Sha256: 4beca2e2c556146d3c5c05549b31115f4d34343c45359a542b24d712f2a69507

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 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',
          geometry: {
            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',
          geometry: {
            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

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.1.7 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.1.6 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.1.5 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.1.4 test/lib/vedeu/output/clear_interface_test.rb