Sha256: 5f1bb4f7e5e0c50eb18a67f4ce18cd0d63a4c6e4636358fe5b2534b0fb626d5d

Contents?: true

Size: 1.16 KB

Versions: 16

Compression:

Stored size: 1.16 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'write_xlsx'
require 'stringio'

class TestWriteHyperlink < Minitest::Test
  def setup
    @workbook = WriteXLSX.new(StringIO.new)
    @worksheet = @workbook.add_worksheet('')
  end

  def test_write_hyperlink_internal_sheet2
    hyperlink = Writexlsx::Worksheet::Hyperlink.factory('internal:Sheet2!A1', 'Sheet2!A1')
    result = hyperlink.attributes(0, 0)
    expected = [%w(ref A1), %w(location Sheet2!A1), %w(display Sheet2!A1)]
    assert_equal(expected, result)
  end

  def test_write_hyperlink_internal_quoted_sheet
    hyperlink = Writexlsx::Worksheet::Hyperlink.factory("internal:'Data Sheet'!D5", "'Data Sheet'!D5")
    result = hyperlink.attributes(4, 0)
    expected = [%w(ref A5), ["location", "'Data Sheet'!D5"], ["display", "'Data Sheet'!D5"]]
    assert_equal(expected, result)
  end

  def test_write_hyperlink_internal_tooltip
    hyperlink = Writexlsx::Worksheet::Hyperlink.factory('internal:Sheet2!A1', 'Sheet2!A1', 'Screen Tip 1')
    result = hyperlink.attributes(17, 0)
    expected = [%w(ref A18), %w(location Sheet2!A1), ["tooltip", "Screen Tip 1"], %w(display Sheet2!A1)]
    assert_equal(expected, result)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
write_xlsx-1.09.4 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.09.3 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.09.2 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.09.1 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.09.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.08.2 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.08.1 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.08.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.07.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.04.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.02.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.01.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-1.00.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-0.99.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-0.97.0 test/worksheet/test_write_hyperlink.rb
write_xlsx-0.90.0 test/worksheet/test_write_hyperlink.rb