contentstack_utils 1.1.3.2 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,316 +1,318 @@
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
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('break', linkText)).
102
+ to eq "<br />"
103
+ expect(subject.render_mark('', linkText)).
104
+ to eq linkText
105
+ end
106
+
107
+ it 'Should return blank string for doc node type' do
108
+ doc = getJson(BlankDocument)
109
+
110
+ result = subject.render_node('doc', doc, linkText)
111
+ expect(result).to eq ""
112
+ end
113
+
114
+ it 'Should return paragraph string for paragrpah node type' do
115
+ doc = getJson(BlankDocument)
116
+
117
+ result = subject.render_node('p', doc, linkText)
118
+ expect(result).to eq "<p>#{linkText}</p>"
119
+ end
120
+
121
+ it 'Should return link string with blank href for link node type' do
122
+ doc = getJson(BlankDocument)
123
+
124
+ result = subject.render_node('a', doc, linkText)
125
+ expect(result).to eq "<a href=''>#{linkText}</a>"
126
+ end
127
+
128
+ it 'Should return link string for link node type' do
129
+ doc = getJson(LinkInPJson)["children"][0]
130
+
131
+ result = subject.render_node('a', doc, linkText)
132
+ expect(result).to eq "<a href='#{doc["attrs"]["href"]}'>#{linkText}</a>"
133
+ end
134
+
135
+ it 'Should return image string with blank src for image node type' do
136
+ doc = getJson(BlankDocument)
137
+
138
+ result = subject.render_node('img', doc, linkText)
139
+ expect(result).to eq "<img src='' />#{linkText}"
140
+ end
141
+
142
+ it 'Should return link string for link node type' do
143
+ doc = getJson(ImgJson)["children"][0]
144
+
145
+ result = subject.render_node('img', doc, linkText)
146
+ expect(result).to eq "<img src='#{doc["attrs"]["src"]}' />#{linkText}"
147
+ end
148
+
149
+ it 'Should return link string for link node type' do
150
+ doc = getJson(ImgJsonURL)["children"][0]
151
+
152
+ result = subject.render_node('img', doc, linkText)
153
+ expect(result).to eq "<img src='#{doc["attrs"]["url"]}' />#{linkText}"
154
+ end
155
+
156
+ it 'Should return embed string with blank src for embed node type' do
157
+ doc = getJson(BlankDocument)
158
+
159
+ result = subject.render_node('embed', doc, linkText)
160
+ expect(result).to eq "<iframe src=''></iframe>"
161
+ end
162
+
163
+ it 'Should return embed string for embed node type' do
164
+ doc = getJson(EmbedJson)["children"][0]
165
+
166
+ result = subject.render_node('embed', doc, linkText)
167
+ expect(result).to eq "<iframe src='#{doc["attrs"]["src"]}'></iframe>"
168
+ end
169
+
170
+ it 'Should return Heading 1 string for Heading 1 node type' do
171
+ doc = getJson(BlankDocument)
172
+
173
+ result = subject.render_node('h1', doc, linkText)
174
+ expect(result).to eq "<h1>#{linkText}</h1>"
175
+ end
176
+
177
+ it 'Should return Heading 2 string for Heading 2 node type' do
178
+ doc = getJson(BlankDocument)
179
+
180
+ result = subject.render_node('h2', doc, linkText)
181
+ expect(result).to eq "<h2>#{linkText}</h2>"
182
+ end
183
+
184
+ it 'Should return Heading 3 string for Heading 3 node type' do
185
+ doc = getJson(BlankDocument)
186
+
187
+ result = subject.render_node('h3', doc, linkText)
188
+ expect(result).to eq "<h3>#{linkText}</h3>"
189
+ end
190
+
191
+ it 'Should return Heading 4 string for Heading 4 node type' do
192
+ doc = getJson(BlankDocument)
193
+
194
+ result = subject.render_node('h4', doc, linkText)
195
+ expect(result).to eq "<h4>#{linkText}</h4>"
196
+ end
197
+
198
+ it 'Should return Heading 5 string for Heading 5 node type' do
199
+ doc = getJson(BlankDocument)
200
+
201
+ result = subject.render_node('h5', doc, linkText)
202
+ expect(result).to eq "<h5>#{linkText}</h5>"
203
+ end
204
+
205
+ it 'Should return Heading 6 string for Heading 6 node type' do
206
+ doc = getJson(BlankDocument)
207
+
208
+ result = subject.render_node('h6', doc, linkText)
209
+ expect(result).to eq "<h6>#{linkText}</h6>"
210
+ end
211
+
212
+ it 'Should return Hr string for Hr node type' do
213
+ doc = getJson(BlankDocument)
214
+
215
+ result = subject.render_node('hr', doc, linkText)
216
+ expect(result).to eq "<hr />"
217
+ end
218
+
219
+ it 'Should return order list string for order list node type' do
220
+ doc = getJson(BlankDocument)
221
+
222
+ result = subject.render_node('ol', doc, linkText)
223
+ expect(result).to eq "<ol>#{linkText}</ol>"
224
+ end
225
+
226
+ it 'Should return Unorder list string for Unorder list node type' do
227
+ doc = getJson(BlankDocument)
228
+
229
+ result = subject.render_node('ul', doc, linkText)
230
+ expect(result).to eq "<ul>#{linkText}</ul>"
231
+ end
232
+
233
+ it 'Should return list item string for list item node type' do
234
+ doc = getJson(BlankDocument)
235
+
236
+ result = subject.render_node('li', doc, linkText)
237
+ expect(result).to eq "<li>#{linkText}</li>"
238
+ end
239
+
240
+ it 'Should return table string for table node type' do
241
+ doc = getJson(BlankDocument)
242
+
243
+ result = subject.render_node('table', doc, linkText)
244
+ expect(result).to eq "<table>#{linkText}</table>"
245
+ end
246
+
247
+ it 'Should return thead string for thead node type' do
248
+ doc = getJson(BlankDocument)
249
+
250
+ result = subject.render_node('thead', doc, linkText)
251
+ expect(result).to eq "<thead>#{linkText}</thead>"
252
+ end
253
+
254
+ it 'Should return tfoot string for tfoot node type' do
255
+ doc = getJson(BlankDocument)
256
+
257
+ result = subject.render_node('tfoot', doc, linkText)
258
+ expect(result).to eq "<tfoot>#{linkText}</tfoot>"
259
+ end
260
+
261
+ it 'Should return tbody string fortbody node type' do
262
+ doc = getJson(BlankDocument)
263
+
264
+ result = subject.render_node('tbody', doc, linkText)
265
+ expect(result).to eq "<tbody>#{linkText}</tbody>"
266
+ end
267
+
268
+ it 'Should return table row string for table row node type' do
269
+ doc = getJson(BlankDocument)
270
+
271
+ result = subject.render_node('tr', doc, linkText)
272
+ expect(result).to eq "<tr>#{linkText}</tr>"
273
+ end
274
+
275
+ it 'Should return table head string for table head node type' do
276
+ doc = getJson(BlankDocument)
277
+
278
+ result = subject.render_node('th', doc, linkText)
279
+ expect(result).to eq "<th>#{linkText}</th>"
280
+ end
281
+
282
+ it 'Should return table data string for table data node type' do
283
+ doc = getJson(BlankDocument)
284
+
285
+ result = subject.render_node('td', doc, linkText)
286
+ expect(result).to eq "<td>#{linkText}</td>"
287
+ end
288
+
289
+ it 'Should return blockquote string for blockquote node type' do
290
+ doc = getJson(BlankDocument)
291
+
292
+ result = subject.render_node('blockquote', doc, linkText)
293
+ expect(result).to eq "<blockquote>#{linkText}</blockquote>"
294
+ end
295
+
296
+ it 'Should return code string for code node type' do
297
+ doc = getJson(BlankDocument)
298
+
299
+ result = subject.render_node('code', doc, linkText)
300
+ expect(result).to eq "<code>#{linkText}</code>"
301
+ end
302
+
303
+ it 'Should return blank string for reference node type' do
304
+ doc = getJson(BlankDocument)
305
+
306
+ result = subject.render_node('reference', doc, linkText)
307
+ expect(result).to eq ""
308
+ end
309
+
310
+ it 'Should return span string for span node type' do
311
+ doc = getJson(BlankDocument)
312
+
313
+ result = subject.render_node('span', doc, linkText)
314
+ expect(result).to eq "<span>#{linkText}</span>"
315
+ end
316
+
317
+ end
318
+ end