Skip to content

Allow noscript fallback to be disabled #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 1, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
benbalter committed Nov 30, 2015
commit d0230206f28688cffaf8a7e48c17266c766d23f8
29 changes: 20 additions & 9 deletions spec/gist_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
it "produces the correct script tag" do
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
end
it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end
Expand All @@ -30,7 +30,7 @@
it "produces the correct script tag" do
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
end
it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end
Expand All @@ -42,7 +42,7 @@
it "produces the correct script tag" do
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
end
it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end
Expand All @@ -56,7 +56,7 @@
it "produces the correct script tag" do
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js\?file=#{filename}">\s<\/script>/)
end
it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end
Expand All @@ -74,7 +74,7 @@
it "produces the correct script tag" do
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{doc.data['gist_id']}.js">\s<\/script>/)
end
it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end
Expand All @@ -97,12 +97,12 @@
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{doc.data['gist_id']}.js\?file=#{doc.data['gist_filename']}">\s<\/script>/)
end

it "produces the correct noscript tag" do
it "produces the correct noscript tag" do
expect(output).to match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end
end

context "with valid gist id and invalid filename" do
context "with valid gist id and invalid filename" do
before { stub_request(:get, "https://gist.githubusercontent.com/#{gist_id}/raw/#{gist_filename}").to_return(status: 404) }
let(:gist_id) { "mattr-/24081a1d93d2898ecf0f" }
let(:gist_filename) { "myfile.ext" }
Expand All @@ -112,14 +112,25 @@
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist_id}.js\?file=#{gist_filename}">\s<\/script>/)
end

it "does not produce the noscript tag" do
it "does not produce the noscript tag" do
expect(output).to_not match(/<noscript><pre>&lt;test&gt;true&lt;\/test&gt;<\/pre><\/noscript>\n/)
end

end

end
context "with noscript disabled" do
let(:doc) { doc_with_content(content, { "gist" => { "noscript" => false } }) }
let(:output) do
doc.content = content
doc.output = Jekyll::Renderer.new(doc.site, doc).run
end

it "does not produce the noscript tag" do
expect(output).to_not match(/<noscript>/)
end
end

end

context "invalid gist" do

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def dest_dir(*files)
end

def doc_with_content(content, opts = {})
my_site = site
my_site = site(opts)
Jekyll::Document.new(source_dir('_test/doc.md'), {site: my_site, collection: collection(my_site)})
end

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy