Major CSS/styling overhaul with Primer.css.

This commit is contained in:
Bart Kamphorst
2019-08-13 22:10:10 +02:00
parent af344c1d25
commit aa16f6ba2a
50 changed files with 691 additions and 1713 deletions
+4 -4
View File
@@ -36,17 +36,17 @@ context "Precious::Views::Editing" do
assert_match /Rename/, last_response.body, "'Rename' link is blocked in page template"
assert_match /Edit/, last_response.body, "'Edit' link is blocked in page template"
get '/gollum/pages'
get '/gollum/overview'
assert_match /New/, last_response.body, "'New' link is blocked in pages template"
get '/gollum/history/A'
assert_match /Edit/, last_response.body, "'Edit' link is blocked in history template"
assert_no_match /Edit/, last_response.body, "'Edit' link is not blocked in history template"
get '/gollum/compare/A/fc66539528eb96f21b2bbdbf557788fe8a1196ac..b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f'
assert_match /Edit Page/, last_response.body, "'Edit Page' link is blocked in compare template"
assert_no_match /Edit Page/, last_response.body, "'Edit Page' link is not blocked in compare template"
assert_match /Revert Changes/, last_response.body, "'Revert Changes' link is blocked in compare template"
end
@@ -60,7 +60,7 @@ context "Precious::Views::Editing" do
assert_no_match /Rename/, last_response.body, "'Rename' link not blocked in page template"
assert_no_match /Edit/, last_response.body, "'Edit' link not blocked in page template"
get '/gollum/pages'
get '/gollum/overview'
assert_no_match /New/, last_response.body, "'New' link not blocked in pages template"
+15 -14
View File
@@ -605,34 +605,35 @@ context "Frontend with lotr" do
# │   ├── eye.jpg
# │   └── todo.txt
# ├── My-Precious.md
# ├── roast-mutton.md
# ├── Samwise\ Gamgee.mediawiki
# ├── _Footer.md
# ├── _Header.md
# └── _Sidebar.md
#
# ├── Zamin.md
test "/pages" do
get "/gollum/pages"
test "/overview" do
get "/gollum/overview"
assert last_response.ok?
body = last_response.body
assert body.include?("Bilbo-Baggins"), "/pages should include the page 'Bilbo Baggins'"
assert body.include?("Gondor"), "/pages should include the folder 'Gondor'"
assert !body.include?("Boromir"), "/pages should NOT include the page 'Boromir'"
assert body.include?("Mordor"), "/pages should include the folder 'Mordor'"
assert !body.include?("Eye-Of-Sauron"), "/pages should NOT include the page 'Eye Of Sauron'"
assert !body.match(/(Zamin).+(roast\-mutton)/m), "/pages should be sorted alphabetically"
assert body.include?("Bilbo-Baggins"), "/overview should include the page 'Bilbo Baggins'"
assert body.include?("Gondor"), "/overview should include the folder 'Gondor'"
assert !body.include?("Boromir"), "/overview should NOT include the page 'Boromir'"
assert body.include?("Mordor"), "/overview should include the folder 'Mordor'"
assert !body.include?("Eye-Of-Sauron"), "/overview should NOT include the page 'Eye Of Sauron'"
assert !body.match(/(Zamin).+(Bilbo\-Baggins)/m), "/overview should be sorted alphabetically"
end
test "/gollum/pages/Mordor/" do
get "/gollum/pages/Mordor/"
assert last_response.ok?, "/pages/Mordor/ did not respond ok"
test "/gollum/overview/Mordor/" do
get "/gollum/overview/Mordor/"
assert last_response.ok?, "/overview/Mordor/ did not respond ok"
body = last_response.body
assert !body.include?("Bilbo-Baggins"), "/pages/Mordor/ should NOT include the page 'Bilbo Baggins'"
assert body.include?("Eye-Of-Sauron"), "/pages/Mordor/ should include the page 'Eye Of Sauron'"
assert !body.include?("Bilbo-Baggins"), "/overview/Mordor/ should NOT include the page 'Bilbo Baggins'"
assert body.include?("Eye-Of-Sauron"), "/overview/Mordor/ should include the page 'Eye Of Sauron'"
end
test "symbolic link pages" do
+2 -2
View File
@@ -19,8 +19,8 @@ context "Precious::Views::LatestChanges" do
test "displays_latest_changes" do
get('/gollum/latest_changes')
body = last_response.body
assert body.include?('<span class="username">Charles Pence</span>'), "/latest_changes should include the Author Charles Pence"
assert body.include?("<span class=\"float-left col-2\"><a href=\"javascript:void(0)\">\n Charles Pence\n</a>\n</span>"), "/latest_changes should include Author Charles Pence"
assert body.include?('1db89eb'), "/latest_changes should include the :latest_changes_count commit"
assert !body.include?('a8ad3c0'), "/latest_changes should not include more than latest_changes_count commits"
assert body.include?('<a href="Data-Two.csv/874f597a5659b4c3b153674ea04e406ff393975e">Data-Two.csv</a>'), "/latest_changes include links to modified files in #{body}"
@@ -1,6 +1,6 @@
# ~*~ encoding: utf-8 ~*~
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
require File.expand_path '../../lib/gollum/views/pages', __FILE__
require File.expand_path '../../lib/gollum/views/overview', __FILE__
FakePageResult = Struct.new(:path) do
def name
@@ -33,15 +33,15 @@ FakeFileResult = Struct.new(:path) do
end
end
context "Precious::Views::Pages" do
context "Precious::Views::Overview" do
setup do
@page = Precious::Views::Pages.new
@page = Precious::Views::Overview.new
end
test "breadcrumb" do
@page.instance_variable_set("@path", "Mordor/Eye-Of-Sauron/Saruman")
@page.instance_variable_set("@base_url", "")
assert_equal '<a href="/gollum/pages">Home</a> / <a href="/gollum/pages/Mordor/">Mordor</a> / <a href="/gollum/pages/Mordor/Eye-Of-Sauron/">Eye-Of-Sauron</a> / Saruman', @page.breadcrumb
assert_equal '<a href="/gollum/overview">Home</a> / <a href="/gollum/overview/Mordor/">Mordor</a> / <a href="/gollum/overview/Mordor/Eye-Of-Sauron/">Eye-Of-Sauron</a> / Saruman', @page.breadcrumb
end
test "breadcrumb with no path" do
@@ -52,7 +52,11 @@ context "Precious::Views::Pages" do
@page.instance_variable_set("@base_url", "")
results = [FakePageResult.new("Gondor/Bromir.md"), FakePageResult.new("Hobbit.md"), FakePageResult.new("Home.md"), FakePageResult.new("Mordor/Eye-Of-Sauron.md"), FakePageResult.new("Mordor/todo.md"), FakePageResult.new("Rivendell/Elrond.md"), FakePageResult.new("My-Precious.md"), FakePageResult.new("Zamin.md"), FakePageResult.new("Samwise-Gamgee.md"), FakePageResult.new("roast-mutton.md"), FakePageResult.new("Bilbo-Baggins.md")]
@page.instance_variable_set("@results", results)
assert_equal %{<li><a href="/gollum/pages/Gondor/" class="folder">Gondor</a></li>\n<li><a href="/gollum/pages/Mordor/" class="folder">Mordor</a></li>\n<li><a href="/gollum/pages/Rivendell/" class="folder">Rivendell</a></li>\n<li><a href="/Bilbo-Baggins" class="page">Bilbo Baggins</a></li>\n<li><a href="/Hobbit" class="page">Hobbit</a></li>\n<li><a href="/Home" class="page">Home</a></li>\n<li><a href="/My-Precious" class="page">My Precious</a></li>\n<li><a href="/roast-mutton" class="page">roast mutton</a></li>\n<li><a href="/Samwise-Gamgee" class="page">Samwise Gamgee</a></li>\n<li><a href="/Zamin" class="page">Zamin</a></li>}, @page.files_folders
files = 0
folders = 0
results = @page.files_folders
results[0..2].each { |r| assert r[:type] == 'dir' }
results[3..-1].each { |r| assert r[:type] == 'file' }
end
test "files_folders from subdir" do
@@ -60,7 +64,12 @@ context "Precious::Views::Pages" do
@page.instance_variable_set("@base_url", "")
results = [FakePageResult.new("Mordor/Eye-Of-Sauron.md"), FakeFileResult.new("Mordor/Aragorn.pdf"), FakePageResult.new("Mordor/Orc/Saruman.md"), FakeFileResult.new("Mordor/.gitkeep")]
@page.instance_variable_set("@results", results)
assert_equal %{<li><a href="/gollum/pages/Mordor/Orc/" class="folder">Orc</a></li>\n<li><a href="/Mordor/Aragorn.pdf" class="file">Aragorn.pdf</a></li>\n<li><a href="/Mordor/Eye-Of-Sauron" class="page">Eye Of Sauron</a></li>}, @page.files_folders
result = @page.files_folders.first
assert_equal result[:icon].start_with?('<svg class="octicon octicon-file-directory'), true
assert_equal result[:type], 'dir'
assert_equal result[:url], '/gollum/overview/Mordor/Orc/'
assert_equal result[:is_file], false
assert_equal result[:name], 'Orc'
end
test "base url" do
@@ -69,6 +78,6 @@ context "Precious::Views::Pages" do
@page.instance_variable_set("@base_url", "/wiki")
results = [FakePageResult.new("Mordor/Eye-Of-Sauron.md"), FakeFileResult.new("Mordor/Aragorn.pdf"), FakePageResult.new("Mordor/Orc/Saruman.md"), FakePageResult.new("Mordor/.gitkeep")]
@page.instance_variable_set("@results", results)
assert_equal %{<li><a href="/wiki/gollum/pages/Mordor/Orc/" class="folder">Orc</a></li>\n<li><a href="/wiki/Mordor/Aragorn.pdf" class="file">Aragorn.pdf</a></li>\n<li><a href="/wiki/Mordor/Eye-Of-Sauron" class="page">Eye Of Sauron</a></li>}, @page.files_folders
assert_equal @page.files_folders.first[:url], '/wiki/gollum/overview/Mordor/Orc/'
end
end