Sha256: c68c6e31d4556a09e9f6c336ae33cc8476ff154f386b7a9087360a430a2c0fdc

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'write_xlsx/package/comments'

class TestWriteTextT < Minitest::Test
  def setup
    @comment = Writexlsx::Package::Comments.new(nil)
  end

  def test_write_text_t_with_center_space
    @comment.__send__('write_text_t', 'Some text')
    result = @comment.xml_str
    expected = '<t>Some text</t>'
    assert_equal(expected, result)
  end

  def test_write_text_t_with_beginning_space
    @comment.__send__('write_text_t', ' Some text')
    result = @comment.xml_str
    expected = '<t xml:space="preserve"> Some text</t>'
    assert_equal(expected, result)
  end

  def test_write_text_t_with_ending_space
    @comment.__send__('write_text_t', 'Some text ')
    result = @comment.xml_str
    expected = '<t xml:space="preserve">Some text </t>'
    assert_equal(expected, result)
  end

  def test_write_text_t_with_both_space
    @comment.__send__('write_text_t', ' Some text ')
    result = @comment.xml_str
    expected = '<t xml:space="preserve"> Some text </t>'
    assert_equal(expected, result)
  end

  def test_write_text_t_with_cr
    @comment.__send__('write_text_t', "Some text\n")
    result = @comment.xml_str
    expected = %Q!<t xml:space="preserve">Some text\n</t>!
    assert_equal(expected, result)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
write_xlsx-0.97.0 test/package/comments/test_write_text_t.rb
write_xlsx-0.90.0 test/package/comments/test_write_text_t.rb
write_xlsx-0.89.0 test/package/comments/test_write_text_t.rb
write_xlsx-0.88.0 test/package/comments/test_write_text_t.rb
write_xlsx-0.87.0 test/package/comments/test_write_text_t.rb