diff --git a/site/_docs/history.md b/site/_docs/history.md index 346dc131..98fb9bb8 100644 --- a/site/_docs/history.md +++ b/site/_docs/history.md @@ -191,6 +191,7 @@ permalink: "/docs/history/" - Allow Travis to 'parallelize' our tests ([#2859]({{ site.repository }}/issues/2859)) - Fix test for Liquid rendering in Sass ([#2856]({{ site.repository }}/issues/2856)) - Fixing "vertycal" typo in site template's `_base.scss` ([#2889]({{ site.repository }}/issues/2889)) +- Convert remaining textile test documents to markdown ([#3528]({{ site.repository }}/issues/3528)) ### Site Enhancements {: #site-enhancements-v2-4-0} diff --git a/site/_docs/plugins.md b/site/_docs/plugins.md index 9f4afb97..4958add3 100644 --- a/site/_docs/plugins.md +++ b/site/_docs/plugins.md @@ -42,12 +42,12 @@ You have 3 options for installing plugins:
- _plugins and gems + _plugins, _config.yml and Gemfile can be used simultaneously

- You may use both of the aforementioned plugin options simultaneously in the - same site if you so choose. Use of one does not restrict the use of the other + You may use any of the aforementioned plugin options simultaneously in the + same site if you so choose. Use of one does not restrict the use of the others.

diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 7e14a418..8de8ac29 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -42,12 +42,12 @@ class TestConfiguration < JekyllUnitTest assert_equal [source_dir("_config.yml")], @config.config_files(@no_override) end should "return .yaml if it exists but .yml does not" do - mock(File).exists?(source_dir("_config.yml")) { false } - mock(File).exists?(source_dir("_config.yaml")) { true } + mock(File).exist?(source_dir("_config.yml")) { false } + mock(File).exist?(source_dir("_config.yaml")) { true } assert_equal [source_dir("_config.yaml")], @config.config_files(@no_override) end should "return .yml if both .yml and .yaml exist" do - mock(File).exists?(source_dir("_config.yml")) { true } + mock(File).exist?(source_dir("_config.yml")) { true } assert_equal [source_dir("_config.yml")], @config.config_files(@no_override) end should "return the config if given one config file" do diff --git a/test/test_document.rb b/test/test_document.rb index 56d6a671..f8b9db66 100644 --- a/test/test_document.rb +++ b/test/test_document.rb @@ -219,7 +219,31 @@ class TestDocument < JekyllUnitTest assert_equal "/slides/test/example-slide-1", @document.url end - should "produce the right destination" do + should "produce the right destination file" do + assert_equal @dest_file, @document.destination(dest_dir) + end + end + + context "a document in a collection with pretty permalink style" do + setup do + @site = fixture_site({ + "collections" => { + "slides" => { + "output" => true, + } + }, + }) + @site.permalink_style = :pretty + @site.process + @document = @site.collections["slides"].docs[0] + @dest_file = dest_dir("slides/example-slide-1/index.html") + end + + should "produce the right URL" do + assert_equal "/slides/example-slide-1/", @document.url + end + + should "produce the right destination file" do assert_equal @dest_file, @document.destination(dest_dir) end end diff --git a/test/test_filters.rb b/test/test_filters.rb index eec08564..82d31922 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -280,6 +280,12 @@ class TestFilters < JekyllUnitTest end context "sort filter" do + should "raise Exception when input is nil" do + err = assert_raises ArgumentError do + @filter.sort(nil) + end + assert_equal "Cannot sort a null object.", err.message + end should "return sorted numbers" do assert_equal [1, 2, 2.2, 3], @filter.sort([3, 2.2, 2, 1]) end diff --git a/test/test_page.rb b/test/test_page.rb index 9918442f..1e4d3da6 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -46,7 +46,7 @@ class TestPage < JekyllUnitTest should "create index url based on filename" do @page = setup_page('/contacts', 'index.html') - assert_equal "/contacts/index.html", @page.url + assert_equal "/contacts/", @page.url end end @@ -129,6 +129,58 @@ class TestPage < JekyllUnitTest end end + context "with date permalink style" do + setup do + @site.permalink_style = :date + end + + should "return url and destination correctly" do + @page = setup_page('contacts.html') + @dest_file = dest_dir("contacts.html") + assert_equal '/contacts.html', @page.url + assert_equal @dest_file, @page.destination(dest_dir) + end + end + + context "with custom permalink style with trailing slash" do + setup do + @site.permalink_style = "/:title/" + end + + should "return url and destination correctly" do + @page = setup_page('contacts.html') + @dest_file = dest_dir("contacts/index.html") + assert_equal '/contacts/', @page.url + assert_equal @dest_file, @page.destination(dest_dir) + end + end + + context "with custom permalink style with file extension" do + setup do + @site.permalink_style = "/:title:output_ext" + end + + should "return url and destination correctly" do + @page = setup_page('contacts.html') + @dest_file = dest_dir("contacts.html") + assert_equal '/contacts.html', @page.url + assert_equal @dest_file, @page.destination(dest_dir) + end + end + + context "with custom permalink style with no extension" do + setup do + @site.permalink_style = "/:title" + end + + should "return url and destination correctly" do + @page = setup_page('contacts.html') + @dest_file = dest_dir("contacts.html") + assert_equal '/contacts', @page.url + assert_equal @dest_file, @page.destination(dest_dir) + end + end + context "with any other permalink style" do should "return dir correctly" do @site.permalink_style = nil diff --git a/test/test_site.rb b/test/test_site.rb index e77a5ad1..ce9cbc95 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -143,7 +143,7 @@ class TestSite < JekyllUnitTest # simulate destination file deletion File.unlink dest - refute File.exists?(dest) + refute File.exist?(dest) sleep 1 @site.process @@ -369,7 +369,7 @@ class TestSite < JekyllUnitTest site = Site.new(site_configuration) site.process - file_content = site.reader.read_data_file(source_dir('_data', 'members.yaml')) + file_content = DataReader.new(site).read_data_file(source_dir('_data', 'members.yaml')) assert_equal site.data['members'], file_content assert_equal site.site_payload['site']['data']['members'], file_content diff --git a/test/test_utils.rb b/test/test_utils.rb index ddb63d4b..9d4a5a4d 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -166,4 +166,18 @@ class TestUtils < JekyllUnitTest end end + context "The \`Utils.add_permalink_suffix\` method" do + should "handle built-in permalink styles" do + assert_equal "/:basename/", Utils.add_permalink_suffix("/:basename", :pretty) + assert_equal "/:basename:output_ext", Utils.add_permalink_suffix("/:basename", :date) + assert_equal "/:basename:output_ext", Utils.add_permalink_suffix("/:basename", :ordinal) + assert_equal "/:basename:output_ext", Utils.add_permalink_suffix("/:basename", :none) + end + + should "handle custom permalink styles" do + assert_equal "/:basename/", Utils.add_permalink_suffix("/:basename", "/:title/") + assert_equal "/:basename:output_ext", Utils.add_permalink_suffix("/:basename", "/:title:output_ext") + assert_equal "/:basename", Utils.add_permalink_suffix("/:basename", "/:title") + end + end end