From b8fcb4a6b78cf0419487353d098d12671909c7e2 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 11 Mar 2012 13:04:11 +0900 Subject: no, really _fix_ the namespaced css doc selectors to use xpath and prefixed nodes... --- test/content_type/tc_content_type.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb index 05b3d93c..5757b980 100644 --- a/test/content_type/tc_content_type.rb +++ b/test/content_type/tc_content_type.rb @@ -50,34 +50,34 @@ class TestContentType < Test::Unit::TestCase end def test_should_get_worksheet_for_worksheets - o_path = "Types Override [@ContentType='%s']" + o_path = "//xmlns:Override[@ContentType='%s']" ws = @package.workbook.add_worksheet doc = Nokogiri::XML(@package.send(:content_types).to_xml) - assert_equal(doc.css("Types Override").size, 5, "adding a worksheet should add another type") - assert_equal(doc.css(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid") + assert_equal(doc.xpath("//xmlns:Override").size, 5, "adding a worksheet should add another type") + assert_equal(doc.xpath(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid") ws = @package.workbook.add_worksheet doc = Nokogiri::XML(@package.send(:content_types).to_xml) - assert_equal(doc.css("Types Override").size, 6, "adding workship should add another type") - assert_equal(doc.css(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid") + assert_equal(doc.xpath("//xmlns:Override").size, 6, "adding workship should add another type") + assert_equal(doc.xpath(o_path % Axlsx::WORKSHEET_CT).last["PartName"], "/xl/#{ws.pn}", "Worksheet part invalid") end def test_drawings_and_charts_need_content_types - o_path = "Types Override [@ContentType='%s']" + o_path = "//xmlns:Override[@ContentType='%s']" ws = @package.workbook.add_worksheet c = ws.add_chart Axlsx::Pie3DChart doc = Nokogiri::XML(@package.send(:content_types).to_xml) - assert_equal(doc.css("Types Override").size, 7, "expected 7 types got #{doc.css("Types Override").size}") - assert_equal(doc.css(o_path % Axlsx::DRAWING_CT).first["PartName"], "/xl/#{ws.drawing.pn}", "Drawing part name invlid") - assert_equal(doc.css(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid") + assert_equal(doc.xpath("//xmlns:Override").size, 7, "expected 7 types got #{doc.css("Types Override").size}") + assert_equal(doc.xpath(o_path % Axlsx::DRAWING_CT).first["PartName"], "/xl/#{ws.drawing.pn}", "Drawing part name invlid") + assert_equal(doc.xpath(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid") c = ws.add_chart Axlsx::Pie3DChart doc = Nokogiri::XML(@package.send(:content_types).to_xml) - assert_equal(doc.css("Types Override").size, 8, "expected 7 types got #{doc.css("Types Override").size}") - assert_equal(doc.css(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid") + assert_equal(doc.xpath("//xmlns:Override").size, 8, "expected 7 types got #{doc.css("Types Override").size}") + assert_equal(doc.xpath(o_path % Axlsx::CHART_CT).last["PartName"], "/xl/#{c.pn}", "Chart part name invlid") end end -- cgit v1.2.3