Skip to content

Commit

Permalink
Add spec for iframe conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
xijo committed Oct 29, 2024
1 parent 97298f9 commit 999ecf7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.

## 3.0.0 - October 2024
- BREAKING: Dropped support for ruby 2.6.0 and lower
- Bugfix for missing newline behind `ol`, thanks @Kevinrob, see #104
- Add support for `iframe` tags, thanks @gagandeepsinghj, see #102

## 2.1.1 - October 2021
- Fixes unintentional newline characters within lists with paragraphs, thanks @diogoosorio, see #93
Expand Down
4 changes: 4 additions & 0 deletions spec/assets/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<h1>Welcome to My Page</h1>
<p>This is a sample paragraph before the iframe.</p>
<iframe src="https://www.example.com" width="600" height="400"></iframe>
<p>This is a sample paragraph after the iframe.</p>
2 changes: 0 additions & 2 deletions spec/components/from_the_wild_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

describe ReverseMarkdown do

let(:input) { File.read('spec/assets/from_the_wild.html') }
let(:document) { Nokogiri::HTML(input) }
subject { ReverseMarkdown.convert(input) }
Expand All @@ -13,5 +12,4 @@
it "should not over escape * or _" do
expect(subject).to include '[![](example.com/foo_bar.png) I\_AM\_HELPFUL](example.com/foo_bar)'
end

end
2 changes: 0 additions & 2 deletions spec/components/html_fragment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
require 'spec_helper'

describe ReverseMarkdown do

let(:input) { File.read('spec/assets/html_fragment.html') }
let(:document) { Nokogiri::HTML(input) }
subject { ReverseMarkdown.convert(input) }

it { is_expected.to eq("naked text 1\n\nparagraph text\n\nnaked text 2") }
end

22 changes: 22 additions & 0 deletions spec/components/iframe_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'spec_helper'

describe ReverseMarkdown do
let(:input) { File.read('spec/assets/iframe.html') }
let(:document) { Nokogiri::HTML(input) }
subject { ReverseMarkdown.convert(input) }

it do
expected = <<~MD
# Welcome to My Page
This is a sample paragraph before the iframe.
https://www.example.com
This is a sample paragraph after the iframe.
MD

expect(subject).to eq expected
end
end

0 comments on commit 999ecf7

Please sign in to comment.