diff --git a/spec/helpers/calculators/calculators_helper_spec.rb b/spec/helpers/calculators/calculators_helper_spec.rb new file mode 100644 index 000000000..cc5df60af --- /dev/null +++ b/spec/helpers/calculators/calculators_helper_spec.rb @@ -0,0 +1,43 @@ +require "rails_helper" + +RSpec.describe ApplicationHelper, type: :helper do + describe "#sanitized_notes" do + let(:valid_html) do + '
This is bold and italic. Link
' + end + + let(:invalid_html) do + 'This is safe content
' + end + + let(:mixed_html) do + 'This is bold and Link
' + end + + it "allows specific tags and attributes" do + result = helper.sanitized_notes(valid_html) + expect(result).to include('') + expect(result).to include('bold') + expect(result).to include('italic') + expect(result).to include('Link') + end + + it "removes disallowed tags" do + result = helper.sanitized_notes(invalid_html) + expect(result).not_to include('