Sha256: 5bad54ebd2cf6043ef1f4a7b4b69d5c54aae252e90279d69f87d25a952b9900d

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

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

module Vedeu
  describe ClearInterface do
    before { Persistence.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

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.1.2 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.1.1 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.1.0 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.0.42 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.0.41 test/lib/vedeu/output/clear_interface_test.rb
vedeu-0.0.40 test/lib/vedeu/output/clear_interface_test.rb