diff options
| author | James Lam <[email protected]> | 2022-07-09 23:13:05 +0200 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2022-07-09 23:14:37 +0200 |
| commit | f39e9068803f5cf28a339c67e92ab976c30b00f1 (patch) | |
| tree | 6040be8b56874c8939f9b1f5613623ed6fb9b8b0 /test | |
| parent | 3703031ef2cc755fac8c7cb5b403170cda76fa67 (diff) | |
| download | caxlsx-f39e9068803f5cf28a339c67e92ab976c30b00f1.tar.gz caxlsx-f39e9068803f5cf28a339c67e92ab976c30b00f1.zip | |
Add pivot table option to sort headers (#143)
Diffstat (limited to 'test')
| -rw-r--r-- | test/workbook/worksheet/tc_pivot_table.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb index 591f0ba9..c7aa53cc 100644 --- a/test/workbook/worksheet/tc_pivot_table.rb +++ b/test/workbook/worksheet/tc_pivot_table.rb @@ -87,6 +87,19 @@ class TestPivotTable < Test::Unit::TestCase assert_equal(['Year'], pivot_table.no_subtotals_on_headers) end + def test_add_pivot_table_with_months_sorted + pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:sort_on_headers=>['Month']}) do |pt| + pt.data = ['Sales'] + pt.rows = ['Year','Month'] + end + assert_equal({'Month' => :ascending}, pivot_table.sort_on_headers) + + pivot_table.sort_on_headers = {'Month' => :descending} + assert_equal({'Month' => :descending}, pivot_table.sort_on_headers) + + shared_test_pivot_table_xml_validity(pivot_table) + end + def test_header_indices pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') assert_equal(0, pivot_table.header_index_of('Year' )) |
