Compare commits

...

8 Commits

Author SHA1 Message Date
Dawa Ometto 869292ed1e Expect error related to mathjax.conf 2022-09-22 11:40:10 +02:00
Dawa Ometto 5ed777834d Fix locale location 2022-09-22 11:40:10 +02:00
Dawa Ometto 0098e9187a Only require uglifier when precompiling 2022-09-22 11:40:10 +02:00
Dawa Ometto e7b324f9ff Make gollum executable 2022-09-22 11:40:10 +02:00
Dawa Ometto c48c7dab0b Run capybara tests against dockerized instance 2022-09-22 11:40:10 +02:00
benjamin wil aac6c9da70 Remove dead link from Markdown help pane
In the editor, the help text for "Emoji" included a dead link. This
changes the link to a non-dead link.

After changing the JS, assets needed to be recompiled.

Resolves #1775.
2022-09-21 19:19:07 -07:00
benjamin wil af570a97e3 Test the help panel's "Emoji" section
This test is passing. I wrote it so I can safely change this panel in a
subsequent commit.
2022-09-21 19:19:07 -07:00
benjamin wil 193f449058 Make help button more accessible
Using an `aria-label` for buttons without text is a good practice.

This lets users who use screenreaders better understand what this button
is for.
2022-09-21 19:19:07 -07:00
19 changed files with 113 additions and 13 deletions
+19 -2
View File
@@ -34,5 +34,22 @@ jobs:
run: echo ${{ steps.docker_build.outputs.digest }}
- name: docker state
run: docker image ls
- name: Run gollum as test
run: docker run -e CI=true ${{ env.CI_IMAGE }} --irb
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
bundler-cache: true
- name: Install Chromedriver
uses: nanasess/setup-chromedriver@v1
- run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Run gollum from Docker
run: |
git clone test/examples/lotr.git /tmp/lotr.git
RUNNER_TRACKING_ID="" docker run --rm -p 4567:4567 -v /tmp/lotr.git:/wiki -e CI=true ${{ env.CI_IMAGE }} --mathjax --mermaid &
sleep 10
netstat -lt
- name: Run capybara tests against Dockerized instance
run: "GOLLUM_CAPYBARA_URL=http://127.0.0.1:4567 bundle exec rake test:capybara"
+7
View File
@@ -248,6 +248,13 @@ task :precompile do
"It's possible that you just need to install `yarn` on your system."
end
require 'uglifier'
module Precious
module Assets
JS_COMPRESSOR = ::Uglifier.new(harmony: true)
end
end
require './lib/gollum/app.rb'
# Next, configure the Sprockets asset pipeline and precompile production-
Regular → Executable
View File
+1 -1
View File
@@ -17,7 +17,7 @@ module Gollum
KEYBINDINGS = ['default', 'vim', 'emacs']
::I18n.available_locales = [:en]
::I18n.load_path = Dir[::File.expand_path("lib/gollum/locales") + "/*.yml"]
::I18n.load_path = Dir[::File.expand_path("../gollum/locales", __FILE__) + "/*.yml"]
def self.assets_path
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
+2 -2
View File
@@ -1,10 +1,10 @@
require 'octicons'
require 'uglifier'
module Precious
module Assets
MANIFEST = %w(app.js editor.js mermaid.js app.css criticmarkup.css fileview.css ie7.css print.css *.png *.jpg *.svg *.eot *.ttf)
ASSET_URL = 'gollum/assets'
JS_COMPRESSOR = :uglify unless defined?(JS_COMPRESSOR)
def self.sprockets(dir = File.dirname(File.expand_path(__FILE__)))
env = Sprockets::Environment.new
@@ -17,7 +17,7 @@ module Precious
env.append_path ::File.join(dir, 'public/gollum/images')
env.append_path ::File.join(dir, 'public/gollum/fonts')
env.js_compressor = ::Uglifier.new(harmony: true) unless Precious::App.development?
env.js_compressor = Precious::Assets::JS_COMPRESSOR unless Precious::App.development?
env.css_compressor = :scss
env.context_class.class_eval do
+3
View File
@@ -1,4 +1,7 @@
en:
editor:
function_bar:
help: Help
pagination:
aria:
label: Pagination
@@ -1 +1 @@
{"files":{"app-04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef.js":{"logical_path":"app.js","mtime":"2022-09-13T11:01:08+02:00","size":189238,"digest":"04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef","integrity":"sha256-BNQLwsWVrts+BfOoEG8a4yvyusSnDtmX3n8XRQjuqe8="},"editor-dc74774f8906c154167c88ecda9f96b554b6f8a35d13065b4588e33e702c157f.js":{"logical_path":"editor.js","mtime":"2022-09-13T10:48:33+02:00","size":745698,"digest":"dc74774f8906c154167c88ecda9f96b554b6f8a35d13065b4588e33e702c157f","integrity":"sha256-3HR3T4kGwVQWfIjs2p+WtVS2+KNdEwZbRYjjPnAsFX8="},"mermaid-7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a.js":{"logical_path":"mermaid.js","mtime":"2022-09-13T11:01:07+02:00","size":1215628,"digest":"7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a","integrity":"sha256-czfV5QVg5hKz4gfEDDAu1AZ04Tq/K0t9VHbOVpzFRFo="},"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css":{"logical_path":"app.css","mtime":"2022-09-13T11:01:08+02:00","size":396731,"digest":"309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5","integrity":"sha256-MJvgMjlueDsTpH31jzibfI4RwrLUJkBWC4dPZ3wl9uU="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2020-03-29T22:28:51+02:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2020-03-30T11:12:22+02:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="}},"assets":{"app.js":"app-04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef.js","editor.js":"editor-dc74774f8906c154167c88ecda9f96b554b6f8a35d13065b4588e33e702c157f.js","mermaid.js":"mermaid-7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a.js","app.css":"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
{"files":{"app-04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef.js":{"logical_path":"app.js","mtime":"2022-09-21T19:09:39-07:00","size":189238,"digest":"04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef","integrity":"sha256-BNQLwsWVrts+BfOoEG8a4yvyusSnDtmX3n8XRQjuqe8="},"editor-1cd95508a4e4a6c5b9f11a785ab42e56ef01a6e5c4238bb909559abdf8ac12b7.js":{"logical_path":"editor.js","mtime":"2022-09-21T19:09:39-07:00","size":745699,"digest":"1cd95508a4e4a6c5b9f11a785ab42e56ef01a6e5c4238bb909559abdf8ac12b7","integrity":"sha256-HNlVCKTkpsW58Rp4WrQuVu8BpuXEI4u5CVWavfisErc="},"mermaid-7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a.js":{"logical_path":"mermaid.js","mtime":"2022-09-21T19:09:39-07:00","size":1215628,"digest":"7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a","integrity":"sha256-czfV5QVg5hKz4gfEDDAu1AZ04Tq/K0t9VHbOVpzFRFo="},"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css":{"logical_path":"app.css","mtime":"2022-09-21T19:09:39-07:00","size":396731,"digest":"309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5","integrity":"sha256-MJvgMjlueDsTpH31jzibfI4RwrLUJkBWC4dPZ3wl9uU="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2021-02-24T23:16:14-08:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2021-02-24T23:16:14-08:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="}},"assets":{"app.js":"app-04d40bc2c595aedb3e05f3a8106f1ae32bf2bac4a70ed997de7f174508eea9ef.js","editor.js":"editor-1cd95508a4e4a6c5b9f11a785ab42e56ef01a6e5c4238bb909559abdf8ac12b7.js","mermaid.js":"mermaid-7337d5e50560e612b3e207c40c302ed40674e13abf2b4b7d5476ce569cc5445a.js","app.css":"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
@@ -108,7 +108,7 @@ var MarkDownHelp = [
{
menuName: 'Emoji',
data: '<p>See the <a href="http://emojione.com/demo/" target="_blank">EmojiOne demo</a> for all available emoji. To include one, wrap the emoji name in colons and use underscores instead of spaces (e.g. :heart: or :point_up:).'
data: '<p>Gollum uses <a href="https://joypixels.com/emoji/v4" target="_blank">JoyPixels 4</a> for its emoji. To include one, wrap the emoji name in colons and use underscores instead of spaces (e.g. :heart: or :point_up:).</p>'
}
]
}
+10 -2
View File
@@ -41,11 +41,19 @@
<span class="pr-2"></span>
{{#critic_markup}}
<button class="btn btn-sm function-button" id="function-critic-accept" title="Accept Selected CriticMarkup">{{#octicon}}plus{{/octicon}}</button>
<button class="btn btn-sm function-button" id="function-critic-reject" title="Reject Selected CriticMarkup">{{#octicon}}dash{{/octicon}}</button>
<button class="btn btn-sm function-button" id="function-critic-reject" title="Reject Selected CriticMarkup">{{#octicon}}dash{{/octicon}}</button>
<span class="pr-2"></span>
{{/critic_markup}}
<button class="btn btn-sm function-button" id="function-text-direction" title="Reverse Text Direction">{{#octicon}}arrow-both{{/octicon}}</button>
<button class="btn btn-sm function-button" id="function-help" title="Help">{{#octicon}}question{{/octicon}}</button>
<button
aria-label="{{tt.editor.function_bar.help}}"
class="btn btn-sm function-button"
data-help-text="{{help_text}}"
id="function-help"
title="{{tt.editor.function_bar.help}}"
>
{{#octicon}}question{{/octicon}}
</button>
</div>
<div id="gollum-editor-format-selector">
+9 -1
View File
@@ -14,7 +14,15 @@ CAPYBARA_DRIVER =
Capybara.default_driver = CAPYBARA_DRIVER
Capybara.enable_aria_label = true
Capybara.server = :webrick
if ENV['GOLLUM_CAPYBARA_URL']
Capybara.configure do |config|
config.run_server = false
config.app_host = ENV['GOLLUM_CAPYBARA_URL']
end
else
Capybara.server = :webrick
end
def console_log(page, level = :severe)
page.driver.browser.logs.get(:browser).select { |log| log.level == level.to_s.upcase }
+52
View File
@@ -0,0 +1,52 @@
require_relative "../capybara_helper"
context "editor interface" do
include Capybara::DSL
setup do
@path = cloned_testpath "examples/lotr.git"
@wiki = Gollum::Wiki.new @path
Precious::App.set :gollum_path, @path
Precious::App.set :wiki_options, {}
Capybara.app = Precious::App
end
teardown do
@path = nil
@wiki = nil
Capybara.reset_sessions!
Capybara.use_default_driver
end
test "editor renders help panel" do
visit "/create/new-article"
in_editor_toolbar do
click_on "Help"
end
help_widget = find "#gollum-editor-help"
within help_widget do
click_on "Miscellaneous"
click_on "Emoji"
assert_includes page.text,
"Gollum uses JoyPixels 4 for its emoji. To include one, wrap the " \
"emoji name in colons and use underscores instead of spaces (e.g. " \
":heart: or :point_up:)."
end
end
def in_editor_toolbar &block
return unless block_given?
within "#gollum-editor-function-bar" do
yield
end
end
end
+7 -2
View File
@@ -6,7 +6,8 @@ end
def expected_errors
Regexp.union([
%r{Refused to apply style from 'http:.*/gollum/create/custom.css'}
%r{Refused to apply style from 'http:.*/gollum/create/custom.css'},
%r{.*/gollum/create/mathjax.config.js - Failed to load resource: the server responded with a status of 403}
])
end
@@ -21,7 +22,11 @@ context 'Frontend with mathjax and mermaid' do
@path = cloned_testpath("examples/lotr.git")
@wiki = Gollum::Wiki.new(@path)
Precious::App.set(:gollum_path, @path)
Precious::App.set(:wiki_options, {mathjax: true, mermaid: true})
Precious::App.set(:wiki_options, {
mathjax: true,
mermaid: true,
mathjax_config: 'mathjax.config.js'
})
Capybara.app = Precious::App
end