chore(deadcode): drop deadcode

This commit is contained in:
Martin 2023-02-22 10:54:22 +01:00 committed by mfo
parent c00c4936b2
commit a584279020
7 changed files with 0 additions and 83 deletions

View file

@ -5,8 +5,6 @@ $procedure-context-breakpoint: $two-columns-breakpoint;
$procedure-description-line-height: 22px;
.procedure-preview {
font-size: 24px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@ -74,17 +72,6 @@ $procedure-description-line-height: 22px;
border-bottom: 1px dotted $blue-france-500;
}
.procedure-description {
font-size: 16px;
p:not(:last-of-type) {
// Space the paragraphs by exactly one line height,
// so that the text always is truncated in the middle of a line,
// regarless of the number of paragraphs.
margin-bottom: 3 * $default-spacer;
}
}
.read-more-button {
display: none;
}

View file

@ -1,6 +1,4 @@
class EditableChamp::ChampLabelComponent < ApplicationComponent
include StringToHtmlHelper
def initialize(form:, champ:, seen_at: nil)
@form, @champ, @seen_at = form, champ, seen_at
end

View file

@ -1,6 +1,4 @@
class EditableChamp::EditableChampComponent < ApplicationComponent
include StringToHtmlHelper
def initialize(form:, champ:, seen_at: nil)
@form, @champ, @seen_at = form, champ, seen_at
end

View file

@ -1,3 +1,2 @@
class EditableChamp::ExplicationComponent < EditableChamp::EditableChampBaseComponent
include StringToHtmlHelper
end

View file

@ -1,3 +1,2 @@
class EditableChamp::LinkedDropDownListComponent < EditableChamp::EditableChampBaseComponent
include StringToHtmlHelper
end

View file

@ -1,15 +0,0 @@
module StringToHtmlHelper
def string_to_html(str, wrapper_tag = 'p', allow_a: false)
return nil if str.blank?
html_formatted = simple_format(str, {}, { wrapper_tag: wrapper_tag })
with_links = Anchored::Linker.auto_link(html_formatted, target: '_blank', rel: 'noopener')
tags = if allow_a
Rails.configuration.action_view.sanitized_allowed_tags + ['a']
else
Rails.configuration.action_view.sanitized_allowed_tags
end
sanitize(with_links, tags:, attributes: ['target', 'rel', 'href'])
end
end

View file

@ -1,49 +0,0 @@
RSpec.describe StringToHtmlHelper, type: :helper do
describe "#string_to_html" do
let(:allow_a) { false }
subject { string_to_html(description, allow_a:) }
context "with some simple texte" do
let(:description) { "1er ligne \n 2ieme ligne" }
it { is_expected.to eq("<p>1er ligne \n<br> 2ieme ligne</p>") }
end
context "with a link" do
context "using an authorized scheme" do
let(:description) { "Cliquez sur https://d-s.fr pour continuer." }
context 'with a tag authorized' do
let(:allow_a) { true }
it { is_expected.to eq("<p>Cliquez sur <a href=\"https://d-s.fr\" target=\"_blank\" rel=\"noopener\">https://d-s.fr</a> pour continuer.</p>") }
end
context 'without a tag' do
it { is_expected.to eq("<p>Cliquez sur https://d-s.fr pour continuer.</p>") }
end
end
context "using a non-authorized scheme" do
let(:description) { "Cliquez sur file://etc/password pour continuer." }
it { is_expected.to eq("<p>Cliquez sur file://etc/password pour continuer.</p>") }
end
context "not actually an URL" do
let(:description) { "Pour info: il ne devrait y avoir aucun lien." }
it { is_expected.to eq("<p>Pour info: il ne devrait y avoir aucun lien.</p>") }
end
end
context "with empty decription" do
let(:description) { nil }
it { is_expected.to eq nil }
end
context "with a bad script" do
let(:description) { '<script>bad</script>' }
it { is_expected.to eq('<p>bad</p>') }
end
end
end