contentstack_utils 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,309 +1,316 @@
1
- require 'spec_helper'
2
-
3
- def getMetadata(itemType=nil, styleType=nil, linkText=nil)
4
- html = "<test type='#{itemType || 'entry'}' sys-style-type='#{styleType || 'block'}'>#{linkText || ''}</test>";
5
- element = getElement(html, '//test')[0]
6
- ContentstackUtils::Model::Metadata.new(element)
7
- end
8
- RSpec.describe ContentstackUtils::Model::Options do
9
- subject {described_class.new({})}
10
- linkText = "Text To set Link"
11
- describe 'Custom Raise Render' do
12
- it 'Custom render without render implementation should fail' do
13
- expect{ ContentstackUtilsTest::CustomRaiseOption.new.render_option(ENTRY_CONTENT_BLANK, getMetadata()) }.to raise_error(NotImplementedError, "Implement this method in a child class")
14
- end
15
- end
16
-
17
- describe 'Default Option' do
18
- it 'Embedded Content Type Entry' do
19
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata())).
20
- to eq "<div><p>uid</p><p>Content type: <span>content_type_uid</span></p></div>"
21
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'inline'))).
22
- to eq "<span>uid</span>"
23
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'link'))).
24
- to eq "<a href='uid'>uid</a>"
25
- end
26
-
27
- it 'Embedded Entry' do
28
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata())).
29
- to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
30
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'inline'))).
31
- to eq "<span>title</span>"
32
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'link'))).
33
- to eq "<a href='title'>title</a>"
34
- end
35
-
36
- it 'Embedded Entry URL' do
37
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata())).
38
- to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
39
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'inline'))).
40
- to eq "<span>title</span>"
41
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'link'))).
42
- to eq "<a href='url'>title</a>"
43
- end
44
-
45
- it 'Embedded Asset' do
46
- expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('asset', 'display'))).
47
- to eq "<img src='url' alt='title' />"
48
- expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('entry', 'download'))).
49
- to eq "<a href='url'>title</a>"
50
- end
51
-
52
- it 'Embedded Content Type Entry with text' do
53
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'block', linkText))).
54
- to eq "<div><p>uid</p><p>Content type: <span>content_type_uid</span></p></div>"
55
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'inline', linkText))).
56
- to eq "<span>uid</span>"
57
- expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'link', linkText))).
58
- to eq "<a href='uid'>#{linkText}</a>"
59
- end
60
-
61
- it 'Embedded Entry with text' do
62
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'block', linkText))).
63
- to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
64
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'inline', linkText))).
65
- to eq "<span>title</span>"
66
- expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'link', linkText))).
67
- to eq "<a href='title'>#{linkText}</a>"
68
- end
69
-
70
- it 'Embedded Entry URL with text' do
71
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'block', linkText))).
72
- to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
73
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'inline', linkText))).
74
- to eq "<span>title</span>"
75
- expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'link', linkText))).
76
- to eq "<a href='url'>#{linkText}</a>"
77
- end
78
-
79
- it 'Embedded Asset with text' do
80
- expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('asset', 'display', linkText))).
81
- to eq "<img src='url' alt='title' />"
82
- expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('entry', 'download', linkText))).
83
- to eq "<a href='url'>#{linkText}</a>"
84
- end
85
-
86
- it 'Should return Mark text html' do
87
- expect(subject.render_mark('bold', linkText)).
88
- to eq "<strong>#{linkText}</strong>"
89
- expect(subject.render_mark('italic', linkText)).
90
- to eq "<em>#{linkText}</em>"
91
- expect(subject.render_mark('underline', linkText)).
92
- to eq "<u>#{linkText}</u>"
93
- expect(subject.render_mark('strikethrough', linkText)).
94
- to eq "<strike>#{linkText}</strike>"
95
- expect(subject.render_mark('inlineCode', linkText)).
96
- to eq "<span>#{linkText}</span>"
97
- expect(subject.render_mark('subscript', linkText)).
98
- to eq "<sub>#{linkText}</sub>"
99
- expect(subject.render_mark('superscript', linkText)).
100
- to eq "<sup>#{linkText}</sup>"
101
- expect(subject.render_mark('', linkText)).
102
- to eq linkText
103
- end
104
-
105
- it 'Should return blank string for doc node type' do
106
- doc = getJson(BlankDocument)
107
-
108
- result = subject.render_node('doc', doc, linkText)
109
- expect(result).to eq ""
110
- end
111
-
112
- it 'Should return paragraph string for paragrpah node type' do
113
- doc = getJson(BlankDocument)
114
-
115
- result = subject.render_node('p', doc, linkText)
116
- expect(result).to eq "<p>#{linkText}</p>"
117
- end
118
-
119
- it 'Should return link string with blank href for link node type' do
120
- doc = getJson(BlankDocument)
121
-
122
- result = subject.render_node('a', doc, linkText)
123
- expect(result).to eq "<a href=''>#{linkText}</a>"
124
- end
125
-
126
- it 'Should return link string for link node type' do
127
- doc = getJson(LinkInPJson)["children"][0]
128
-
129
- result = subject.render_node('a', doc, linkText)
130
- expect(result).to eq "<a href='#{doc["attrs"]["href"]}'>#{linkText}</a>"
131
- end
132
-
133
- it 'Should return image string with blank src for image node type' do
134
- doc = getJson(BlankDocument)
135
-
136
- result = subject.render_node('img', doc, linkText)
137
- expect(result).to eq "<img src='' />#{linkText}"
138
- end
139
-
140
- it 'Should return link string for link node type' do
141
- doc = getJson(ImgJson)["children"][0]
142
-
143
- result = subject.render_node('img', doc, linkText)
144
- expect(result).to eq "<img src='#{doc["attrs"]["src"]}' />#{linkText}"
145
- end
146
-
147
- it 'Should return link string for link node type' do
148
- doc = getJson(ImgJsonURL)["children"][0]
149
-
150
- result = subject.render_node('img', doc, linkText)
151
- expect(result).to eq "<img src='#{doc["attrs"]["url"]}' />#{linkText}"
152
- end
153
-
154
- it 'Should return embed string with blank src for embed node type' do
155
- doc = getJson(BlankDocument)
156
-
157
- result = subject.render_node('embed', doc, linkText)
158
- expect(result).to eq "<iframe src=''></iframe>"
159
- end
160
-
161
- it 'Should return embed string for embed node type' do
162
- doc = getJson(EmbedJson)["children"][0]
163
-
164
- result = subject.render_node('embed', doc, linkText)
165
- expect(result).to eq "<iframe src='#{doc["attrs"]["src"]}'></iframe>"
166
- end
167
-
168
- it 'Should return Heading 1 string for Heading 1 node type' do
169
- doc = getJson(BlankDocument)
170
-
171
- result = subject.render_node('h1', doc, linkText)
172
- expect(result).to eq "<h1>#{linkText}</h1>"
173
- end
174
-
175
- it 'Should return Heading 2 string for Heading 2 node type' do
176
- doc = getJson(BlankDocument)
177
-
178
- result = subject.render_node('h2', doc, linkText)
179
- expect(result).to eq "<h2>#{linkText}</h2>"
180
- end
181
-
182
- it 'Should return Heading 3 string for Heading 3 node type' do
183
- doc = getJson(BlankDocument)
184
-
185
- result = subject.render_node('h3', doc, linkText)
186
- expect(result).to eq "<h3>#{linkText}</h3>"
187
- end
188
-
189
- it 'Should return Heading 4 string for Heading 4 node type' do
190
- doc = getJson(BlankDocument)
191
-
192
- result = subject.render_node('h4', doc, linkText)
193
- expect(result).to eq "<h4>#{linkText}</h4>"
194
- end
195
-
196
- it 'Should return Heading 5 string for Heading 5 node type' do
197
- doc = getJson(BlankDocument)
198
-
199
- result = subject.render_node('h5', doc, linkText)
200
- expect(result).to eq "<h5>#{linkText}</h5>"
201
- end
202
-
203
- it 'Should return Heading 6 string for Heading 6 node type' do
204
- doc = getJson(BlankDocument)
205
-
206
- result = subject.render_node('h6', doc, linkText)
207
- expect(result).to eq "<h6>#{linkText}</h6>"
208
- end
209
-
210
- it 'Should return Hr string for Hr node type' do
211
- doc = getJson(BlankDocument)
212
-
213
- result = subject.render_node('hr', doc, linkText)
214
- expect(result).to eq "<hr />"
215
- end
216
-
217
- it 'Should return order list string for order list node type' do
218
- doc = getJson(BlankDocument)
219
-
220
- result = subject.render_node('ol', doc, linkText)
221
- expect(result).to eq "<ol>#{linkText}</ol>"
222
- end
223
-
224
- it 'Should return Unorder list string for Unorder list node type' do
225
- doc = getJson(BlankDocument)
226
-
227
- result = subject.render_node('ul', doc, linkText)
228
- expect(result).to eq "<ul>#{linkText}</ul>"
229
- end
230
-
231
- it 'Should return list item string for list item node type' do
232
- doc = getJson(BlankDocument)
233
-
234
- result = subject.render_node('li', doc, linkText)
235
- expect(result).to eq "<li>#{linkText}</li>"
236
- end
237
-
238
- it 'Should return table string for table node type' do
239
- doc = getJson(BlankDocument)
240
-
241
- result = subject.render_node('table', doc, linkText)
242
- expect(result).to eq "<table>#{linkText}</table>"
243
- end
244
-
245
- it 'Should return thead string for thead node type' do
246
- doc = getJson(BlankDocument)
247
-
248
- result = subject.render_node('thead', doc, linkText)
249
- expect(result).to eq "<thead>#{linkText}</thead>"
250
- end
251
-
252
- it 'Should return tfoot string for tfoot node type' do
253
- doc = getJson(BlankDocument)
254
-
255
- result = subject.render_node('tfoot', doc, linkText)
256
- expect(result).to eq "<tfoot>#{linkText}</tfoot>"
257
- end
258
-
259
- it 'Should return tbody string fortbody node type' do
260
- doc = getJson(BlankDocument)
261
-
262
- result = subject.render_node('tbody', doc, linkText)
263
- expect(result).to eq "<tbody>#{linkText}</tbody>"
264
- end
265
-
266
- it 'Should return table row string for table row node type' do
267
- doc = getJson(BlankDocument)
268
-
269
- result = subject.render_node('tr', doc, linkText)
270
- expect(result).to eq "<tr>#{linkText}</tr>"
271
- end
272
-
273
- it 'Should return table head string for table head node type' do
274
- doc = getJson(BlankDocument)
275
-
276
- result = subject.render_node('th', doc, linkText)
277
- expect(result).to eq "<th>#{linkText}</th>"
278
- end
279
-
280
- it 'Should return table data string for table data node type' do
281
- doc = getJson(BlankDocument)
282
-
283
- result = subject.render_node('td', doc, linkText)
284
- expect(result).to eq "<td>#{linkText}</td>"
285
- end
286
-
287
- it 'Should return blockquote string for blockquote node type' do
288
- doc = getJson(BlankDocument)
289
-
290
- result = subject.render_node('blockquote', doc, linkText)
291
- expect(result).to eq "<blockquote>#{linkText}</blockquote>"
292
- end
293
-
294
- it 'Should return code string for code node type' do
295
- doc = getJson(BlankDocument)
296
-
297
- result = subject.render_node('code', doc, linkText)
298
- expect(result).to eq "<code>#{linkText}</code>"
299
- end
300
-
301
- it 'Should return blank string for reference node type' do
302
- doc = getJson(BlankDocument)
303
-
304
- result = subject.render_node('reference', doc, linkText)
305
- expect(result).to eq ""
306
- end
307
-
308
- end
309
- end
1
+ require 'spec_helper'
2
+
3
+ def getMetadata(itemType=nil, styleType=nil, linkText=nil)
4
+ html = "<test type='#{itemType || 'entry'}' sys-style-type='#{styleType || 'block'}'>#{linkText || ''}</test>";
5
+ element = getElement(html, '//test')[0]
6
+ ContentstackUtils::Model::Metadata.new(element)
7
+ end
8
+ RSpec.describe ContentstackUtils::Model::Options do
9
+ subject {described_class.new({})}
10
+ linkText = "Text To set Link"
11
+ describe 'Custom Raise Render' do
12
+ it 'Custom render without render implementation should fail' do
13
+ expect{ ContentstackUtilsTest::CustomRaiseOption.new.render_option(ENTRY_CONTENT_BLANK, getMetadata()) }.to raise_error(NotImplementedError, "Implement this method in a child class")
14
+ end
15
+ end
16
+
17
+ describe 'Default Option' do
18
+ it 'Embedded Content Type Entry' do
19
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata())).
20
+ to eq "<div><p>uid</p><p>Content type: <span>content_type_uid</span></p></div>"
21
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'inline'))).
22
+ to eq "<span>uid</span>"
23
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'link'))).
24
+ to eq "<a href='uid'>uid</a>"
25
+ end
26
+
27
+ it 'Embedded Entry' do
28
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata())).
29
+ to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
30
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'inline'))).
31
+ to eq "<span>title</span>"
32
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'link'))).
33
+ to eq "<a href='title'>title</a>"
34
+ end
35
+
36
+ it 'Embedded Entry URL' do
37
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata())).
38
+ to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
39
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'inline'))).
40
+ to eq "<span>title</span>"
41
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'link'))).
42
+ to eq "<a href='url'>title</a>"
43
+ end
44
+
45
+ it 'Embedded Asset' do
46
+ expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('asset', 'display'))).
47
+ to eq "<img src='url' alt='title' />"
48
+ expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('entry', 'download'))).
49
+ to eq "<a href='url'>title</a>"
50
+ end
51
+
52
+ it 'Embedded Content Type Entry with text' do
53
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'block', linkText))).
54
+ to eq "<div><p>uid</p><p>Content type: <span>content_type_uid</span></p></div>"
55
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'inline', linkText))).
56
+ to eq "<span>uid</span>"
57
+ expect(subject.render_option(ENTRY_CONTENT_BLANK, getMetadata('entry', 'link', linkText))).
58
+ to eq "<a href='uid'>#{linkText}</a>"
59
+ end
60
+
61
+ it 'Embedded Entry with text' do
62
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'block', linkText))).
63
+ to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
64
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'inline', linkText))).
65
+ to eq "<span>title</span>"
66
+ expect(subject.render_option(ENTRY_CONTENT_TITLE, getMetadata('entry', 'link', linkText))).
67
+ to eq "<a href='title'>#{linkText}</a>"
68
+ end
69
+
70
+ it 'Embedded Entry URL with text' do
71
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'block', linkText))).
72
+ to eq "<div><p>title</p><p>Content type: <span>content_type_uid</span></p></div>"
73
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'inline', linkText))).
74
+ to eq "<span>title</span>"
75
+ expect(subject.render_option(ENTRY_CONTENT_TITLE_URL, getMetadata('entry', 'link', linkText))).
76
+ to eq "<a href='url'>#{linkText}</a>"
77
+ end
78
+
79
+ it 'Embedded Asset with text' do
80
+ expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('asset', 'display', linkText))).
81
+ to eq "<img src='url' alt='title' />"
82
+ expect(subject.render_option(ASSET_CONTENT_URL, getMetadata('entry', 'download', linkText))).
83
+ to eq "<a href='url'>#{linkText}</a>"
84
+ end
85
+
86
+ it 'Should return Mark text html' do
87
+ expect(subject.render_mark('bold', linkText)).
88
+ to eq "<strong>#{linkText}</strong>"
89
+ expect(subject.render_mark('italic', linkText)).
90
+ to eq "<em>#{linkText}</em>"
91
+ expect(subject.render_mark('underline', linkText)).
92
+ to eq "<u>#{linkText}</u>"
93
+ expect(subject.render_mark('strikethrough', linkText)).
94
+ to eq "<strike>#{linkText}</strike>"
95
+ expect(subject.render_mark('inlineCode', linkText)).
96
+ to eq "<span>#{linkText}</span>"
97
+ expect(subject.render_mark('subscript', linkText)).
98
+ to eq "<sub>#{linkText}</sub>"
99
+ expect(subject.render_mark('superscript', linkText)).
100
+ to eq "<sup>#{linkText}</sup>"
101
+ expect(subject.render_mark('', linkText)).
102
+ to eq linkText
103
+ end
104
+
105
+ it 'Should return blank string for doc node type' do
106
+ doc = getJson(BlankDocument)
107
+
108
+ result = subject.render_node('doc', doc, linkText)
109
+ expect(result).to eq ""
110
+ end
111
+
112
+ it 'Should return paragraph string for paragrpah node type' do
113
+ doc = getJson(BlankDocument)
114
+
115
+ result = subject.render_node('p', doc, linkText)
116
+ expect(result).to eq "<p>#{linkText}</p>"
117
+ end
118
+
119
+ it 'Should return link string with blank href for link node type' do
120
+ doc = getJson(BlankDocument)
121
+
122
+ result = subject.render_node('a', doc, linkText)
123
+ expect(result).to eq "<a href=''>#{linkText}</a>"
124
+ end
125
+
126
+ it 'Should return link string for link node type' do
127
+ doc = getJson(LinkInPJson)["children"][0]
128
+
129
+ result = subject.render_node('a', doc, linkText)
130
+ expect(result).to eq "<a href='#{doc["attrs"]["href"]}'>#{linkText}</a>"
131
+ end
132
+
133
+ it 'Should return image string with blank src for image node type' do
134
+ doc = getJson(BlankDocument)
135
+
136
+ result = subject.render_node('img', doc, linkText)
137
+ expect(result).to eq "<img src='' />#{linkText}"
138
+ end
139
+
140
+ it 'Should return link string for link node type' do
141
+ doc = getJson(ImgJson)["children"][0]
142
+
143
+ result = subject.render_node('img', doc, linkText)
144
+ expect(result).to eq "<img src='#{doc["attrs"]["src"]}' />#{linkText}"
145
+ end
146
+
147
+ it 'Should return link string for link node type' do
148
+ doc = getJson(ImgJsonURL)["children"][0]
149
+
150
+ result = subject.render_node('img', doc, linkText)
151
+ expect(result).to eq "<img src='#{doc["attrs"]["url"]}' />#{linkText}"
152
+ end
153
+
154
+ it 'Should return embed string with blank src for embed node type' do
155
+ doc = getJson(BlankDocument)
156
+
157
+ result = subject.render_node('embed', doc, linkText)
158
+ expect(result).to eq "<iframe src=''></iframe>"
159
+ end
160
+
161
+ it 'Should return embed string for embed node type' do
162
+ doc = getJson(EmbedJson)["children"][0]
163
+
164
+ result = subject.render_node('embed', doc, linkText)
165
+ expect(result).to eq "<iframe src='#{doc["attrs"]["src"]}'></iframe>"
166
+ end
167
+
168
+ it 'Should return Heading 1 string for Heading 1 node type' do
169
+ doc = getJson(BlankDocument)
170
+
171
+ result = subject.render_node('h1', doc, linkText)
172
+ expect(result).to eq "<h1>#{linkText}</h1>"
173
+ end
174
+
175
+ it 'Should return Heading 2 string for Heading 2 node type' do
176
+ doc = getJson(BlankDocument)
177
+
178
+ result = subject.render_node('h2', doc, linkText)
179
+ expect(result).to eq "<h2>#{linkText}</h2>"
180
+ end
181
+
182
+ it 'Should return Heading 3 string for Heading 3 node type' do
183
+ doc = getJson(BlankDocument)
184
+
185
+ result = subject.render_node('h3', doc, linkText)
186
+ expect(result).to eq "<h3>#{linkText}</h3>"
187
+ end
188
+
189
+ it 'Should return Heading 4 string for Heading 4 node type' do
190
+ doc = getJson(BlankDocument)
191
+
192
+ result = subject.render_node('h4', doc, linkText)
193
+ expect(result).to eq "<h4>#{linkText}</h4>"
194
+ end
195
+
196
+ it 'Should return Heading 5 string for Heading 5 node type' do
197
+ doc = getJson(BlankDocument)
198
+
199
+ result = subject.render_node('h5', doc, linkText)
200
+ expect(result).to eq "<h5>#{linkText}</h5>"
201
+ end
202
+
203
+ it 'Should return Heading 6 string for Heading 6 node type' do
204
+ doc = getJson(BlankDocument)
205
+
206
+ result = subject.render_node('h6', doc, linkText)
207
+ expect(result).to eq "<h6>#{linkText}</h6>"
208
+ end
209
+
210
+ it 'Should return Hr string for Hr node type' do
211
+ doc = getJson(BlankDocument)
212
+
213
+ result = subject.render_node('hr', doc, linkText)
214
+ expect(result).to eq "<hr />"
215
+ end
216
+
217
+ it 'Should return order list string for order list node type' do
218
+ doc = getJson(BlankDocument)
219
+
220
+ result = subject.render_node('ol', doc, linkText)
221
+ expect(result).to eq "<ol>#{linkText}</ol>"
222
+ end
223
+
224
+ it 'Should return Unorder list string for Unorder list node type' do
225
+ doc = getJson(BlankDocument)
226
+
227
+ result = subject.render_node('ul', doc, linkText)
228
+ expect(result).to eq "<ul>#{linkText}</ul>"
229
+ end
230
+
231
+ it 'Should return list item string for list item node type' do
232
+ doc = getJson(BlankDocument)
233
+
234
+ result = subject.render_node('li', doc, linkText)
235
+ expect(result).to eq "<li>#{linkText}</li>"
236
+ end
237
+
238
+ it 'Should return table string for table node type' do
239
+ doc = getJson(BlankDocument)
240
+
241
+ result = subject.render_node('table', doc, linkText)
242
+ expect(result).to eq "<table>#{linkText}</table>"
243
+ end
244
+
245
+ it 'Should return thead string for thead node type' do
246
+ doc = getJson(BlankDocument)
247
+
248
+ result = subject.render_node('thead', doc, linkText)
249
+ expect(result).to eq "<thead>#{linkText}</thead>"
250
+ end
251
+
252
+ it 'Should return tfoot string for tfoot node type' do
253
+ doc = getJson(BlankDocument)
254
+
255
+ result = subject.render_node('tfoot', doc, linkText)
256
+ expect(result).to eq "<tfoot>#{linkText}</tfoot>"
257
+ end
258
+
259
+ it 'Should return tbody string fortbody node type' do
260
+ doc = getJson(BlankDocument)
261
+
262
+ result = subject.render_node('tbody', doc, linkText)
263
+ expect(result).to eq "<tbody>#{linkText}</tbody>"
264
+ end
265
+
266
+ it 'Should return table row string for table row node type' do
267
+ doc = getJson(BlankDocument)
268
+
269
+ result = subject.render_node('tr', doc, linkText)
270
+ expect(result).to eq "<tr>#{linkText}</tr>"
271
+ end
272
+
273
+ it 'Should return table head string for table head node type' do
274
+ doc = getJson(BlankDocument)
275
+
276
+ result = subject.render_node('th', doc, linkText)
277
+ expect(result).to eq "<th>#{linkText}</th>"
278
+ end
279
+
280
+ it 'Should return table data string for table data node type' do
281
+ doc = getJson(BlankDocument)
282
+
283
+ result = subject.render_node('td', doc, linkText)
284
+ expect(result).to eq "<td>#{linkText}</td>"
285
+ end
286
+
287
+ it 'Should return blockquote string for blockquote node type' do
288
+ doc = getJson(BlankDocument)
289
+
290
+ result = subject.render_node('blockquote', doc, linkText)
291
+ expect(result).to eq "<blockquote>#{linkText}</blockquote>"
292
+ end
293
+
294
+ it 'Should return code string for code node type' do
295
+ doc = getJson(BlankDocument)
296
+
297
+ result = subject.render_node('code', doc, linkText)
298
+ expect(result).to eq "<code>#{linkText}</code>"
299
+ end
300
+
301
+ it 'Should return blank string for reference node type' do
302
+ doc = getJson(BlankDocument)
303
+
304
+ result = subject.render_node('reference', doc, linkText)
305
+ expect(result).to eq ""
306
+ end
307
+
308
+ it 'Should return span string for span node type' do
309
+ doc = getJson(BlankDocument)
310
+
311
+ result = subject.render_node('span', doc, linkText)
312
+ expect(result).to eq "<span>#{linkText}</span>"
313
+ end
314
+
315
+ end
316
+ end