openxml-docx 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/Gemfile.lock +1 -1
  2. data/examples/booklet-printing +55 -0
  3. data/lib/openxml/docx/attribute_builder.rb +11 -5
  4. data/lib/openxml/docx/elements/absolute_position_tab.rb +1 -1
  5. data/lib/openxml/docx/elements/background.rb +16 -0
  6. data/lib/openxml/docx/elements/book_fold_printing.rb +1 -1
  7. data/lib/openxml/docx/elements/book_fold_reverse_printing.rb +1 -1
  8. data/lib/openxml/docx/elements/compatibility_setting.rb +10 -0
  9. data/lib/openxml/docx/elements/compatibility_settings.rb +15 -0
  10. data/lib/openxml/docx/elements/embed_bold.rb +2 -10
  11. data/lib/openxml/docx/elements/embed_bold_italic.rb +2 -10
  12. data/lib/openxml/docx/elements/embed_italic.rb +2 -10
  13. data/lib/openxml/docx/elements/embed_regular.rb +3 -3
  14. data/lib/openxml/docx/elements/embed_system_fonts.rb +1 -1
  15. data/lib/openxml/docx/elements/embed_true_type_fonts.rb +1 -1
  16. data/lib/openxml/docx/elements/even_and_odd_headers.rb +11 -0
  17. data/lib/openxml/docx/elements/family.rb +1 -1
  18. data/lib/openxml/docx/elements/markup_compatibility_choice.rb +1 -1
  19. data/lib/openxml/docx/elements/paragraph.rb +1 -0
  20. data/lib/openxml/docx/elements/save_subset_fonts.rb +1 -1
  21. data/lib/openxml/docx/elements/table_cell.rb +1 -0
  22. data/lib/openxml/docx/elements/textbox_content.rb +9 -0
  23. data/lib/openxml/docx/elements/word_processing_drawing_anchor.rb +6 -6
  24. data/lib/openxml/docx/elements/word_processing_drawing_inline.rb +16 -0
  25. data/lib/openxml/docx/elements/word_processing_drawing_object_nv_properties.rb +1 -1
  26. data/lib/openxml/docx/elements/word_processing_drawing_wrap_polygon.rb +1 -1
  27. data/lib/openxml/docx/elements/word_processing_shapes_body_properties.rb +12 -12
  28. data/lib/openxml/docx/elements/word_processing_shapes_nv_drawing_properties.rb +1 -1
  29. data/lib/openxml/docx/elements/word_processing_shapes_shape.rb +1 -2
  30. data/lib/openxml/docx/elements/word_processing_shapes_shape_properties.rb +1 -11
  31. data/lib/openxml/docx/elements/word_processing_shapes_textual_contents.rb +13 -0
  32. data/lib/openxml/{drawingml → docx}/elements/wordprocessing_shape_group.rb +1 -1
  33. data/lib/openxml/docx/package.rb +4 -3
  34. data/lib/openxml/docx/parts/document.rb +5 -0
  35. data/lib/openxml/docx/parts/header.rb +1 -1
  36. data/lib/openxml/docx/properties.rb +1 -0
  37. data/lib/openxml/docx/properties/border.rb +2 -2
  38. data/lib/openxml/docx/properties/columns.rb +8 -2
  39. data/lib/openxml/docx/properties/conditional_formatting.rb +12 -12
  40. data/lib/openxml/docx/properties/container_property.rb +10 -10
  41. data/lib/openxml/docx/properties/footer_references.rb +12 -0
  42. data/lib/openxml/docx/properties/frame.rb +1 -1
  43. data/lib/openxml/docx/properties/header_references.rb +12 -0
  44. data/lib/openxml/docx/properties/indentation.rb +5 -1
  45. data/lib/openxml/docx/properties/latent_styles.rb +4 -4
  46. data/lib/openxml/docx/properties/latent_styles_exception.rb +4 -4
  47. data/lib/openxml/docx/properties/section.rb +15 -0
  48. data/lib/openxml/docx/properties/table_border.rb +2 -2
  49. data/lib/openxml/docx/properties/table_cell_border.rb +2 -2
  50. data/lib/openxml/docx/properties/table_look.rb +7 -6
  51. data/lib/openxml/docx/properties/text_direction.rb +1 -1
  52. data/lib/openxml/docx/properties/transparent_container_property.rb +14 -0
  53. data/lib/openxml/docx/properties/vertical_merge.rb +14 -0
  54. data/lib/openxml/docx/section.rb +2 -0
  55. data/lib/openxml/docx/style.rb +18 -6
  56. data/lib/openxml/docx/version.rb +1 -1
  57. data/lib/openxml/drawingml/elements/blip_fill.rb +1 -1
  58. data/lib/openxml/drawingml/elements/children_extents.rb +14 -0
  59. data/lib/openxml/drawingml/elements/children_offset.rb +14 -0
  60. data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +6 -6
  61. data/lib/openxml/drawingml/elements/no_autofit.rb +10 -0
  62. data/lib/openxml/drawingml/elements/no_fill.rb +1 -1
  63. data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +1 -1
  64. data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +1 -1
  65. data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +12 -0
  66. data/lib/openxml/drawingml/elements/picture_locks.rb +11 -11
  67. data/lib/openxml/drawingml/elements/preset_text_warp.rb +25 -0
  68. data/lib/openxml/vml/elements/group.rb +17 -37
  69. data/lib/openxml/vml/elements/rectangle.rb +29 -62
  70. data/lib/openxml/vml/elements/rounded_rectangle.rb +29 -61
  71. data/spec/elements/absolute_position_tab_spec.rb +21 -15
  72. data/spec/elements/background_spec.rb +52 -0
  73. data/spec/elements/bidi_embed_spec.rb +12 -4
  74. data/spec/elements/bidi_override_spec.rb +12 -4
  75. data/spec/elements/break_spec.rb +12 -10
  76. data/spec/elements/compatibility_setting_spec.rb +41 -0
  77. data/spec/elements/compatibility_settings_spec.rb +8 -0
  78. data/spec/elements/content_part_spec.rb +2 -2
  79. data/spec/elements/control_spec.rb +5 -5
  80. data/spec/elements/deleted_text_spec.rb +2 -2
  81. data/spec/elements/drawingml/blip_fill_spec.rb +8 -3
  82. data/spec/elements/drawingml/extents_spec.rb +4 -4
  83. data/spec/elements/drawingml/head_end_spec.rb +16 -13
  84. data/spec/elements/drawingml/no_autofit_spec.rb +8 -0
  85. data/spec/elements/drawingml/non_visual_drawing_properties_spec.rb +6 -6
  86. data/spec/elements/drawingml/non_visual_shape_drawing_properties_spec.rb +24 -0
  87. data/spec/elements/drawingml/offset_spec.rb +14 -4
  88. data/spec/elements/drawingml/outline_spec.rb +20 -14
  89. data/spec/elements/drawingml/preset_geometry_spec.rb +1 -1
  90. data/spec/elements/drawingml/preset_text_warp_spec.rb +36 -0
  91. data/spec/elements/drawingml/shape_guide_spec.rb +7 -3
  92. data/spec/elements/drawingml/srgb_color_spec.rb +3 -4
  93. data/spec/elements/drawingml/tail_end_spec.rb +17 -14
  94. data/spec/elements/drawingml/transform_effect_spec.rb +48 -26
  95. data/spec/elements/markup_compatibility_choice_spec.rb +2 -2
  96. data/spec/elements/paragraph_spec.rb +25 -0
  97. data/spec/elements/symbol_spec.rb +4 -4
  98. data/spec/elements/text_spec.rb +1 -1
  99. data/spec/elements/textbox_content_spec.rb +8 -0
  100. data/spec/elements/vml/group_spec.rb +367 -375
  101. data/spec/elements/vml/rectangle_spec.rb +503 -513
  102. data/spec/elements/vml/rounded_rectangle_spec.rb +591 -463
  103. data/spec/elements/word_processing_drawing_effect_extent_spec.rb +32 -12
  104. data/spec/elements/word_processing_drawing_extent_spec.rb +4 -4
  105. data/spec/elements/word_processing_drawing_object_nv_properties_spec.rb +6 -6
  106. data/spec/elements/word_processing_drawing_simple_position_spec.rb +16 -6
  107. data/spec/elements/word_processing_shapes_body_properties_spec.rb +53 -44
  108. data/spec/elements/word_processing_shapes_shape_properties_spec.rb +6 -5
  109. data/spec/elements/word_processing_shapes_shape_spec.rb +2 -2
  110. data/spec/elements/word_processing_shapes_textual_content_spec.rb +23 -0
  111. data/spec/elements/{drawingml/wordprocessing_shape_group_spec.rb → wordprocessing_shape_group_spec.rb} +1 -1
  112. data/spec/properties/indentation_spec.rb +28 -0
  113. data/spec/properties/table_look_spec.rb +5 -0
  114. data/spec/properties/text_direction_spec.rb +5 -0
  115. data/spec/properties/vertical_merge_spec.rb +22 -0
  116. data/spec/support/data/elements/paragraph_with_section_properties_element.xml +12 -0
  117. data/spec/support/data/parts/empty_header_part.xml +1 -1
  118. data/spec/support/data/parts/header_with_children_part.xml +1 -1
  119. metadata +76 -27
  120. checksums.yaml +0 -7
@@ -9,11 +9,12 @@ describe OpenXml::Docx::Elements::AbsolutePositionTab do
9
9
  it_should_output "<w:ptab/>", assign: false
10
10
  end
11
11
 
12
- for_attribute(:alignment, with_namespace: :w) do
13
- allowed = %i(center left right)
14
- with_values(allowed) do
15
- it_should_assign_successfully
16
- it_should_output_regular_xml
12
+ for_attribute(:alignment) do
13
+ %i(center left right).each do |allowed_value|
14
+ with_value(allowed_value) do
15
+ it_should_assign_successfully
16
+ it_should_output "<w:ptab w:alignment=\"#{allowed_value}\"/>"
17
+ end
17
18
  end
18
19
 
19
20
  with_value(:somethingElse) do
@@ -21,11 +22,12 @@ describe OpenXml::Docx::Elements::AbsolutePositionTab do
21
22
  end
22
23
  end
23
24
 
24
- for_attribute(:leader, with_namespace: :w) do
25
- allowed = %i(dot hyphen middleDot none underscore)
26
- with_values(allowed) do
27
- it_should_assign_successfully
28
- it_should_output_regular_xml
25
+ for_attribute(:leader) do
26
+ %i(dot hyphen middleDot none underscore).each do |allowed_value|
27
+ with_value(allowed_value) do
28
+ it_should_assign_successfully
29
+ it_should_output "<w:ptab w:leader=\"#{allowed_value}\"/>"
30
+ end
29
31
  end
30
32
 
31
33
  with_value(:somethingElse) do
@@ -33,11 +35,15 @@ describe OpenXml::Docx::Elements::AbsolutePositionTab do
33
35
  end
34
36
  end
35
37
 
36
- for_attribute(:relativeTo, with_namespace: :w) do
37
- allowed = %i(indent margin)
38
- with_values(allowed) do
38
+ for_attribute(:relative_to) do
39
+ with_value(:indent) do
40
+ it_should_assign_successfully
41
+ it_should_output "<w:ptab w:relativeTo=\"indent\"/>"
42
+ end
43
+
44
+ with_value(:margin) do
39
45
  it_should_assign_successfully
40
- it_should_output_regular_xml
46
+ it_should_output "<w:ptab w:relativeTo=\"margin\"/>"
41
47
  end
42
48
 
43
49
  with_value(:somethingElse) do
@@ -45,7 +51,7 @@ describe OpenXml::Docx::Elements::AbsolutePositionTab do
45
51
  end
46
52
  end
47
53
 
48
- with_these_attributes_set(alignment: :center, relativeTo: :margin) do
54
+ with_these_attributes_set(alignment: :center, relative_to: :margin) do
49
55
  it_should_output "<w:ptab w:alignment=\"center\" w:relativeTo=\"margin\"/>", assign: false
50
56
  end
51
57
 
@@ -0,0 +1,52 @@
1
+ require "spec_helper"
2
+
3
+ describe OpenXml::Docx::Elements::Background do
4
+ include ElementTestMacros
5
+
6
+ it_should_use tag: :background, name: "background"
7
+
8
+ for_attribute(:color) do
9
+ with_value("FF00AA") do
10
+ it_should_assign_successfully
11
+ it_should_output "<w:background w:color=\"FF00AA\"/>"
12
+ end
13
+
14
+ with_values([:blue, "1ff0aa"]) do
15
+ it_should_raise_an_exception
16
+ end
17
+ end
18
+
19
+ for_attribute(:theme_color) do
20
+ with_value(:accent1) do
21
+ it_should_assign_successfully
22
+ it_should_output "<w:background w:themeColor=\"accent1\"/>"
23
+ end
24
+
25
+ with_value(:not_allowed) do
26
+ it_should_raise_an_exception
27
+ end
28
+ end
29
+
30
+ for_attribute(:theme_shade) do
31
+ with_value("0F") do
32
+ it_should_assign_successfully
33
+ it_should_output "<w:background w:themeShade=\"0F\"/>"
34
+ end
35
+
36
+ with_values([:red, "00FF", "0f"]) do
37
+ it_should_raise_an_exception
38
+ end
39
+ end
40
+
41
+ for_attribute(:theme_tint) do
42
+ with_value("0F") do
43
+ it_should_assign_successfully
44
+ it_should_output "<w:background w:themeTint=\"0F\"/>"
45
+ end
46
+
47
+ with_values([:red, "00FF", "0f"]) do
48
+ it_should_raise_an_exception
49
+ end
50
+ end
51
+
52
+ end
@@ -5,11 +5,19 @@ describe OpenXml::Docx::Elements::BidiEmbed do
5
5
 
6
6
  it_should_use tag: :dir, name: "bidi_embed"
7
7
 
8
- for_attribute(:direction, displays_as: :val, with_namespace: :w) do
9
- allowed = %i(rtl ltr)
10
- with_values(allowed) do
8
+ for_attribute(:direction) do
9
+ with_value(:rtl) do
11
10
  it_should_assign_successfully
12
- it_should_output_regular_xml
11
+ it_should_output "<w:dir w:val=\"rtl\"/>"
12
+ end
13
+
14
+ with_value(:ltr) do
15
+ it_should_assign_successfully
16
+ it_should_output "<w:dir w:val=\"ltr\"/>"
17
+ end
18
+
19
+ with_value(:not_allowed) do
20
+ it_should_raise_an_exception
13
21
  end
14
22
  end
15
23
 
@@ -5,11 +5,19 @@ describe OpenXml::Docx::Elements::BidiOverride do
5
5
 
6
6
  it_should_use tag: :bdo, name: "bidi_override"
7
7
 
8
- for_attribute(:direction, displays_as: :val, with_namespace: :w) do
9
- allowed = %i(rtl ltr)
10
- with_values(allowed) do
8
+ for_attribute(:direction) do
9
+ with_value(:rtl) do
11
10
  it_should_assign_successfully
12
- it_should_output_regular_xml
11
+ it_should_output "<w:bdo w:val=\"rtl\"/>"
12
+ end
13
+
14
+ with_value(:ltr) do
15
+ it_should_assign_successfully
16
+ it_should_output "<w:bdo w:val=\"ltr\"/>"
17
+ end
18
+
19
+ with_value(:not_allowed) do
20
+ it_should_raise_an_exception
13
21
  end
14
22
  end
15
23
 
@@ -5,11 +5,12 @@ describe OpenXml::Docx::Elements::Break do
5
5
 
6
6
  it_should_use tag: :br, name: "break"
7
7
 
8
- for_attribute(:clear, with_namespace: :w) do
9
- allowed = %i(all left none right)
10
- with_values(allowed) do
11
- it_should_assign_successfully
12
- it_should_output_regular_xml
8
+ for_attribute(:clear) do
9
+ %i(all left none right).each do |allowed_value|
10
+ with_value(allowed_value) do
11
+ it_should_assign_successfully
12
+ it_should_output "<w:br w:clear=\"#{allowed_value}\"/>"
13
+ end
13
14
  end
14
15
 
15
16
  with_value(:somethingElse) do
@@ -17,11 +18,12 @@ describe OpenXml::Docx::Elements::Break do
17
18
  end
18
19
  end
19
20
 
20
- for_attribute(:type, with_namespace: :w) do
21
- allowed = %i(column page textWrapping)
22
- with_values(allowed) do
23
- it_should_assign_successfully
24
- it_should_output_regular_xml
21
+ for_attribute(:type) do
22
+ %i(column page textWrapping).each do |allowed_value|
23
+ with_value(allowed_value) do
24
+ it_should_assign_successfully
25
+ it_should_output "<w:br w:type=\"#{allowed_value}\"/>"
26
+ end
25
27
  end
26
28
 
27
29
  with_value(:somethingElse) do
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+
3
+ describe OpenXml::Docx::Elements::CompatibilitySetting do
4
+ include ElementTestMacros
5
+
6
+ it_should_use tag: :compatSetting, name: "compatibility_setting"
7
+
8
+ for_attribute(:setting_name) do
9
+ with_value("A String") do
10
+ it_should_assign_successfully
11
+ it_should_output "<w:compatSetting w:name=\"A String\"/>"
12
+ end
13
+
14
+ with_values([0, :not_a_string]) do
15
+ it_should_raise_an_exception
16
+ end
17
+ end
18
+
19
+ for_attribute(:uri) do
20
+ with_value("A String") do
21
+ it_should_assign_successfully
22
+ it_should_output "<w:compatSetting w:uri=\"A String\"/>"
23
+ end
24
+
25
+ with_values([0, :not_a_string]) do
26
+ it_should_raise_an_exception
27
+ end
28
+ end
29
+
30
+ for_attribute(:value) do
31
+ with_value("A String") do
32
+ it_should_assign_successfully
33
+ it_should_output "<w:compatSetting w:val=\"A String\"/>"
34
+ end
35
+
36
+ with_values([0, :not_a_string]) do
37
+ it_should_raise_an_exception
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,8 @@
1
+ require "spec_helper"
2
+
3
+ describe OpenXml::Docx::Elements::CompatibilitySettings do
4
+ include ElementTestMacros
5
+
6
+ it_should_use tag: :compat, name: "compatibility_settings"
7
+
8
+ end
@@ -5,10 +5,10 @@ describe OpenXml::Docx::Elements::ContentPart do
5
5
 
6
6
  it_should_use tag: :contentPart, name: "content_part"
7
7
 
8
- for_attribute(:id, with_namespace: :r) do
8
+ for_attribute(:id) do
9
9
  with_value("rId8") do
10
10
  it_should_assign_successfully
11
- it_should_output_regular_xml
11
+ it_should_output "<w:contentPart r:id=\"rId8\"/>"
12
12
  end
13
13
 
14
14
  with_value("") do
@@ -5,10 +5,10 @@ describe OpenXml::Docx::Elements::Control do
5
5
 
6
6
  it_should_use tag: :control, name: "control"
7
7
 
8
- for_attribute(:id, with_namespace: :r) do
8
+ for_attribute(:id) do
9
9
  with_value("rId5") do
10
10
  it_should_assign_successfully
11
- it_should_output_regular_xml
11
+ it_should_output "<w:control r:id=\"rId5\"/>"
12
12
  end
13
13
 
14
14
  with_value("") do
@@ -16,10 +16,10 @@ describe OpenXml::Docx::Elements::Control do
16
16
  end
17
17
  end
18
18
 
19
- for_attribute(:unique_name, displays_as: :name, with_namespace: :w) do
19
+ for_attribute(:unique_name) do
20
20
  with_value("CheckBox1") do
21
21
  it_should_assign_successfully
22
- it_should_output_regular_xml
22
+ it_should_output "<w:control w:name=\"CheckBox1\"/>"
23
23
  end
24
24
 
25
25
  with_value("") do
@@ -30,7 +30,7 @@ describe OpenXml::Docx::Elements::Control do
30
30
  for_attribute(:shape_id, displays_as: :shapeid, with_namespace: :w) do
31
31
  with_value("_x0000_s1027") do
32
32
  it_should_assign_successfully
33
- it_should_output_regular_xml
33
+ it_should_output "<w:control w:shapeid=\"_x0000_s1027\"/>"
34
34
  end
35
35
 
36
36
  with_value("") do
@@ -5,7 +5,7 @@ describe OpenXml::Docx::Elements::DeletedText do
5
5
 
6
6
  it_should_use tag: :del, name: "deleted_text"
7
7
 
8
- for_attribute(:space, with_namespace: :xml) do
8
+ for_attribute(:space) do
9
9
  with_value(nil) do
10
10
  it_should_assign_successfully
11
11
  it_should_output "<w:del/>"
@@ -13,7 +13,7 @@ describe OpenXml::Docx::Elements::DeletedText do
13
13
 
14
14
  with_value(:preserve) do
15
15
  it_should_assign_successfully
16
- it_should_output_regular_xml
16
+ it_should_output "<w:del xml:space=\"preserve\"/>"
17
17
  end
18
18
 
19
19
  with_value(:the_final_frontier) do
@@ -6,12 +6,17 @@ describe OpenXml::DrawingML::Elements::BlipFill do
6
6
  it_should_use tag: :blipFill, name: "blip_fill"
7
7
 
8
8
  for_attribute(:dpi) do
9
- with_values([1, -1]) do
9
+ with_value(1) do
10
10
  it_should_assign_successfully
11
- it_should_output_regular_xml
11
+ it_should_output "<pic:blipFill dpi=\"1\"/>"
12
12
  end
13
13
 
14
- with_value(:not_a_number) do
14
+ with_value(-1) do
15
+ it_should_assign_successfully
16
+ it_should_output "<pic:blipFill dpi=\"-1\"/>"
17
+ end
18
+
19
+ with_values([:not_a_number, 12.34]) do
15
20
  it_should_raise_an_exception
16
21
  end
17
22
  end
@@ -7,10 +7,10 @@ describe OpenXml::DrawingML::Elements::Extents do
7
7
 
8
8
  attributes = { extent_length: :cx, extent_width: :cy }
9
9
 
10
- for_attribute(:extent_length, displays_as: :cx) do
10
+ for_attribute(:extent_length) do
11
11
  with_value(1) do
12
12
  it_should_assign_successfully
13
- it_should_output_regular_xml
13
+ it_should_output "<a:ext cx=\"1\"/>"
14
14
  end
15
15
 
16
16
  with_values([-1, 1.1, :not_a_number]) do
@@ -18,10 +18,10 @@ describe OpenXml::DrawingML::Elements::Extents do
18
18
  end
19
19
  end
20
20
 
21
- for_attribute(:extent_width, displays_as: :cy) do
21
+ for_attribute(:extent_width) do
22
22
  with_value(1) do
23
23
  it_should_assign_successfully
24
- it_should_output_regular_xml
24
+ it_should_output "<a:ext cy=\"1\"/>"
25
25
  end
26
26
 
27
27
  with_values([-1, 1.1, :not_a_number]) do
@@ -5,11 +5,12 @@ describe OpenXml::DrawingML::Elements::HeadEnd do
5
5
 
6
6
  it_should_use tag: :headEnd, name: "head_end"
7
7
 
8
- for_attribute(:length, displays_as: :len) do
9
- allowed = %i(lg med sm)
10
- with_values(allowed) do
11
- it_should_assign_successfully
12
- it_should_output_regular_xml
8
+ for_attribute(:length) do
9
+ %i(lg med sm).each do |allowed_value|
10
+ with_value(allowed_value) do
11
+ it_should_assign_successfully
12
+ it_should_output "<a:headEnd len=\"#{allowed_value}\"/>"
13
+ end
13
14
  end
14
15
 
15
16
  with_value(:bad_value) do
@@ -18,10 +19,11 @@ describe OpenXml::DrawingML::Elements::HeadEnd do
18
19
  end
19
20
 
20
21
  for_attribute(:type) do
21
- allowed = %i(arrow diamond none oval stealth triangle)
22
- with_values(allowed) do
23
- it_should_assign_successfully
24
- it_should_output_regular_xml
22
+ %i(arrow diamond none oval stealth triangle).each do |allowed_value|
23
+ with_value(allowed_value) do
24
+ it_should_assign_successfully
25
+ it_should_output "<a:headEnd type=\"#{allowed_value}\"/>"
26
+ end
25
27
  end
26
28
 
27
29
  with_value(:bad_value) do
@@ -30,10 +32,11 @@ describe OpenXml::DrawingML::Elements::HeadEnd do
30
32
  end
31
33
 
32
34
  for_attribute(:width, displays_as: :w) do
33
- allowed = %i(lg med sm)
34
- with_values(allowed) do
35
- it_should_assign_successfully
36
- it_should_output_regular_xml
35
+ %i(lg med sm).each do |allowed_value|
36
+ with_value(allowed_value) do
37
+ it_should_assign_successfully
38
+ it_should_output "<a:headEnd w=\"#{allowed_value}\"/>"
39
+ end
37
40
  end
38
41
 
39
42
  with_value(:bad_value) do
@@ -0,0 +1,8 @@
1
+ require "spec_helper"
2
+
3
+ describe OpenXml::DrawingML::Elements::NoAutofit do
4
+ include ElementTestMacros
5
+
6
+ it_should_use tag: :noAutofit, name: "no_autofit"
7
+
8
+ end
@@ -5,10 +5,10 @@ describe OpenXml::DrawingML::Elements::NonVisualDrawingProperties do
5
5
 
6
6
  it_should_use tag: :cNvPr, name: "non_visual_drawing_properties"
7
7
 
8
- for_attribute(:description, displays_as: :descr) do
8
+ for_attribute(:description) do
9
9
  with_value("string") do
10
10
  it_should_assign_successfully
11
- it_should_output_regular_xml
11
+ it_should_output "<pic:cNvPr descr=\"string\"/>"
12
12
  end
13
13
 
14
14
  with_value(:not_a_string) do
@@ -35,7 +35,7 @@ describe OpenXml::DrawingML::Elements::NonVisualDrawingProperties do
35
35
  for_attribute(:id) do
36
36
  with_value(123) do
37
37
  it_should_assign_successfully
38
- it_should_output_regular_xml
38
+ it_should_output "<pic:cNvPr id=\"123\"/>"
39
39
  end
40
40
 
41
41
  with_values([-123, :not_a_number]) do
@@ -43,10 +43,10 @@ describe OpenXml::DrawingML::Elements::NonVisualDrawingProperties do
43
43
  end
44
44
  end
45
45
 
46
- for_attribute(:picture_name, displays_as: :name) do
46
+ for_attribute(:picture_name) do
47
47
  with_value("string") do
48
48
  it_should_assign_successfully
49
- it_should_output_regular_xml
49
+ it_should_output "<pic:cNvPr name=\"string\"/>"
50
50
  end
51
51
 
52
52
  with_value(:not_a_string) do
@@ -57,7 +57,7 @@ describe OpenXml::DrawingML::Elements::NonVisualDrawingProperties do
57
57
  for_attribute(:title) do
58
58
  with_value("string") do
59
59
  it_should_assign_successfully
60
- it_should_output_regular_xml
60
+ it_should_output "<pic:cNvPr title=\"string\"/>"
61
61
  end
62
62
 
63
63
  with_value(:not_a_string) do