Sha256: 619d5185daf4153a2c40899777b6c1e84345a91975c39b850f77e8cd195c9315

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require 'test_helper'

module Vedeu
  class PresentationTestClass
    include Presentation

    def attributes
      {
        colour: { background: '#000033', foreground: '#aadd00' },
        style:  ['bold']
      }
    end
  end # PresentationTestClass

  describe Presentation do

    let(:receiver) { PresentationTestClass.new }

    describe '#colour' do
      it 'returns a Colour instance' do
        receiver.colour.must_be_instance_of(Colour)
      end
    end

    describe '#style' do
      it 'returns a Style instance' do
        receiver.style.must_be_instance_of(Style)
      end
    end

    describe '#to_s' do
      it 'returns output' do
        line = Line.new({
          colour: {
            foreground: '#00ff00',
            background: '#000000'
          },
          style: 'normal'
        })
        stream = Stream.new({
          colour: {
            foreground: '#ff0000',
            background: '#000000'
          },
          text:  'Some text',
          style: 'underline',
          width: nil,
          align: :left,
          parent: line.view_attributes,
        })
        stream.to_s.must_equal(
          "\e[38;2;255;0;0m\e[48;2;0;0;0m" \
          "\e[4m" \
          "Some text" \
          "\e[24m\e[22m\e[27m" \
          "\e[38;2;0;255;0m\e[48;2;0;0;0m"
        )
      end
    end

  end # Presentation

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.2.10 test/lib/vedeu/support/presentation_test.rb
vedeu-0.2.9 test/lib/vedeu/support/presentation_test.rb
vedeu-0.2.8 test/lib/vedeu/support/presentation_test.rb
vedeu-0.2.7 test/lib/vedeu/support/presentation_test.rb
vedeu-0.2.6 test/lib/vedeu/support/presentation_test.rb
vedeu-0.2.5 test/lib/vedeu/support/presentation_test.rb