File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,14 @@ def first
211
211
`self.length ? self.first() : nil`
212
212
end
213
213
214
- def html
215
- `self.html() || ""`
214
+ def html ( content = undefined )
Has conversations. Original line has conversations.
215
+ %x{
216
+ if (content != null) {
217
+ return self.html(content);
218
+ }
219
+
220
+ return self.html() || '';
221
+ }
216
222
end
217
223
218
224
def id
Original file line number Diff line number Diff line change 184
184
end
185
185
end
186
186
end
187
+
188
+ describe "Element#html" do
189
+ html <<-HTML
190
+ < div id ="foo "> bar</ div >
191
+ HTML
192
+
193
+ it "retrieves the inner html content for the element" do
194
+ expect ( Element . id ( 'foo' ) . html ) . to include ( 'bar' )
195
+ end
196
+
197
+ it "can be used to set inner html of element by passing string" do
198
+ foo = Element . id 'foo'
199
+ foo . html "different content"
200
+
201
+ expect ( foo . html ) . to_not include ( 'bar' )
202
+ expect ( foo . html ) . to include ( 'different content' )
203
+ end
204
+ end
You can’t perform that action at this time.