mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
Remove html_safe and add spec
This commit is contained in:
committed by
Rob Harrington
parent
85fefcd946
commit
2f3f20e433
@@ -31,8 +31,7 @@ module Spree
|
||||
html_options = {class: "remove_fields #{options[:class]}", data: {action: 'remove'}, title: t(:remove)}
|
||||
html_options.merge!(options[:html]) if options.key? :html
|
||||
|
||||
link_to_with_icon('icon-trash', name, '#', html_options).gsub('href="#" ', '').html_safe +
|
||||
f.hidden_field(:_destroy)
|
||||
link_to_with_icon('icon-trash', name, '#', html_options).gsub('href="#" ', '') + f.hidden_field(:_destroy)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
15
spec/helpers/spree/admin/base_helper_spec.rb
Normal file
15
spec/helpers/spree/admin/base_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Spree::BaseHelper, type: :helper do
|
||||
describe "#link_to_remove_fields_without_url" do
|
||||
let(:name) { 'Hola' }
|
||||
let(:form) { double('form_for', hidden_field: '<input type="hidden" name="_method" value="destroy">') }
|
||||
let(:options) { {} }
|
||||
|
||||
subject { helper.link_to_remove_fields_without_url(name, form, options) }
|
||||
|
||||
it 'returns an `a` tag followed by a hidden `input` tag' do
|
||||
expect(subject).to eq("<a class=\"remove_fields icon_link with-tip icon-trash\" data-action=\"remove\" title=\"Remove\"><span class='text'>Hola</span></a><input type=\"hidden\" name=\"_method\" value=\"destroy\">")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user