File tree Expand file tree Collapse file tree
lib/openxml/docx/elements Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ class OpenXml ::Docx ::Elements ::Hyperlink < OpenXml ::Docx ::Element
2+ include OpenXml ::HasChildren
3+
4+ tag :hyperlink
5+
6+ with_namespace :r do
7+ attribute :id
8+ end
9+ end
Original file line number Diff line number Diff line change 1+ require "spec_helper"
2+
3+ describe OpenXml ::Docx ::Elements ::Hyperlink do
4+ include ElementTestMacros
5+
6+ it_should_use tag : :hyperlink , name : "hyperlink"
7+
8+ with_no_attributes_set do
9+ it_should_output "<w:hyperlink/>" , assign : false
10+ end
11+
12+ for_attribute ( :id ) do
13+ with_value ( 23 ) do
14+ it_should_assign_successfully
15+ it_should_output "<w:hyperlink r:id=\" 23\" />"
16+ end
17+ end
18+
19+ context "with children" do
20+ before do
21+ @instance = described_class . new
22+ text = OpenXml ::Docx ::Elements ::Text . new ( "Smucker's Preserves" )
23+ run = OpenXml ::Docx ::Elements ::Run . new
24+ run << text
25+ instance << run
26+ instance . id = 7346
27+ end
28+
29+ it_should_output <<~XML . chomp , assign : false
30+ <w:hyperlink r:id="7346">
31+ <w:r>
32+ <w:t>Smucker's Preserves</w:t>
33+ </w:r>
34+ </w:hyperlink>
35+ XML
36+ end
37+ end
You can’t perform that action at this time.
0 commit comments