Skip to content

Commit

Permalink
smoke: Worksheet.SetHyperlink (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
askonev authored Jul 3, 2023
1 parent dc1bc5a commit 1470932
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/xlsx/smoke/api_worksheet/set_hyperlink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
builder.CreateFile("xlsx");
Api.AddSheet("Sheet2");
let ws2 = Api.GetSheet("Sheet2")
ws2.SetHyperlink("A1", "", "Sheet1!A1", "SheetName!Range", "format")
ws2.SetHyperlink("B2", "", "Sheet1!C3:D5", "SheetName!Range:Range", "format")
ws2.SetHyperlink("C3", "https://google.com", "google", "google.com")
builder.SaveFile("xlsx", "SetHyperlink.xlsx");
builder.CloseFile();
7 changes: 7 additions & 0 deletions spec/xlsx/smoke/api_worksheet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
expect(xlsx.worksheets.first.sheet_views.first.show_row_column_headers).to be_falsey
end

it 'ApiWorksheet | SetHyperlink method' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_worksheet/set_hyperlink.js')
expect(xlsx.worksheets[1].hyperlinks[0].url.list).to eq('Sheet1')
expect(xlsx.worksheets[1].hyperlinks[1].url.list).to eq('Sheet1')
expect(xlsx.worksheets[1].hyperlinks[2].url).to eq('https://google.com')
end

it 'ApiWorksheet | getter Name' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_worksheet/getter_name.js')
expect(xlsx.worksheets.first.rows.first.cells.first.text).to eq(xlsx.worksheets.first.name)
Expand Down

0 comments on commit 1470932

Please sign in to comment.