mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix word case. html
-> HTML
This commit is contained in:
parent
e5288b2760
commit
2f699c51ce
20 changed files with 38 additions and 38 deletions
|
@ -213,7 +213,7 @@ module ActionMailer
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# You can also send attachments with html template, in this case you need to add body, attachments,
|
# You can also send attachments with HTML template, in this case you need to add body, attachments,
|
||||||
# and custom content type like this:
|
# and custom content type like this:
|
||||||
#
|
#
|
||||||
# class NotifierMailer < ApplicationMailer
|
# class NotifierMailer < ApplicationMailer
|
||||||
|
|
|
@ -165,14 +165,14 @@ module RenderHtml
|
||||||
assert_status 200
|
assert_status 200
|
||||||
end
|
end
|
||||||
|
|
||||||
test "rendering html should escape the string if it is not html safe" do
|
test "rendering HTML should escape the string if it is not HTML safe" do
|
||||||
get "/render_html/with_layout/with_unsafe_html_tag"
|
get "/render_html/with_layout/with_unsafe_html_tag"
|
||||||
|
|
||||||
assert_body "<p>hello world</p>"
|
assert_body "<p>hello world</p>"
|
||||||
assert_status 200
|
assert_status 200
|
||||||
end
|
end
|
||||||
|
|
||||||
test "rendering html should not escape the string if it is html safe" do
|
test "rendering HTML should not escape the string if it is HTML safe" do
|
||||||
get "/render_html/with_layout/with_safe_html_tag"
|
get "/render_html/with_layout/with_safe_html_tag"
|
||||||
|
|
||||||
assert_body "<p>hello world</p>"
|
assert_body "<p>hello world</p>"
|
||||||
|
|
|
@ -10,7 +10,7 @@ module RenderTemplate
|
||||||
"locals.html.erb" => "The secret is <%= secret %>",
|
"locals.html.erb" => "The secret is <%= secret %>",
|
||||||
"xml_template.xml.builder" => "xml.html do\n xml.p 'Hello'\nend",
|
"xml_template.xml.builder" => "xml.html do\n xml.p 'Hello'\nend",
|
||||||
"with_raw.html.erb" => "Hello <%=raw '<strong>this is raw</strong>' %>",
|
"with_raw.html.erb" => "Hello <%=raw '<strong>this is raw</strong>' %>",
|
||||||
"with_implicit_raw.html.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in an html template",
|
"with_implicit_raw.html.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in an HTML template",
|
||||||
"with_implicit_raw.text.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in a text template",
|
"with_implicit_raw.text.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in a text template",
|
||||||
"test/with_json.html.erb" => "<%= render template: 'test/with_json', formats: [:json] %>",
|
"test/with_json.html.erb" => "<%= render template: 'test/with_json', formats: [:json] %>",
|
||||||
"test/with_json.json.erb" => "<%= render template: 'test/final', formats: [:json] %>",
|
"test/with_json.json.erb" => "<%= render template: 'test/final', formats: [:json] %>",
|
||||||
|
@ -123,7 +123,7 @@ module RenderTemplate
|
||||||
|
|
||||||
get :with_implicit_raw
|
get :with_implicit_raw
|
||||||
|
|
||||||
assert_body "Hello <strong>this is also raw</strong> in an html template"
|
assert_body "Hello <strong>this is also raw</strong> in an HTML template"
|
||||||
assert_status 200
|
assert_status 200
|
||||||
|
|
||||||
get :with_implicit_raw, params: { format: "text" }
|
get :with_implicit_raw, params: { format: "text" }
|
||||||
|
|
|
@ -170,7 +170,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
|
||||||
routing_table = body[/route_table.*<.table>/m]
|
routing_table = body[/route_table.*<.table>/m]
|
||||||
assert_match "/:controller(/:action)(.:format)", routing_table
|
assert_match "/:controller(/:action)(.:format)", routing_table
|
||||||
assert_match ":controller#:action", routing_table
|
assert_match ":controller#:action", routing_table
|
||||||
assert_no_match "<|>", routing_table, "there should not be escaped html in the output"
|
assert_no_match "<|>", routing_table, "there should not be escaped HTML in the output"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "displays request and response info when a RoutingError occurs" do
|
test "displays request and response info when a RoutingError occurs" do
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<test>passed formatted html erb</test>
|
<test>passed formatted HTML erb</test>
|
|
@ -45,7 +45,7 @@ const disableElement = (e) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace element's html with the 'data-disable-with' after storing original html
|
// Replace element's HTML with the 'data-disable-with' after storing original html
|
||||||
// and prevent clicking on it
|
// and prevent clicking on it
|
||||||
var disableLinkElement = function(element) {
|
var disableLinkElement = function(element) {
|
||||||
if (getData(element, "ujs:disabled")) { return }
|
if (getData(element, "ujs:disabled")) { return }
|
||||||
|
|
|
@ -31,7 +31,7 @@ const serializeElement = (element, additionalParam) => {
|
||||||
|
|
||||||
// Helper function that returns form elements that match the specified CSS selector
|
// Helper function that returns form elements that match the specified CSS selector
|
||||||
// If form is actually a "form" element this will return associated elements outside the from that have
|
// If form is actually a "form" element this will return associated elements outside the from that have
|
||||||
// the html form attribute set
|
// the HTML form attribute set
|
||||||
const formElements = (form, selector) => {
|
const formElements = (form, selector) => {
|
||||||
if (matches(form, "form")) {
|
if (matches(form, "form")) {
|
||||||
return toArray(form.elements).filter(el => matches(el, selector))
|
return toArray(form.elements).filter(el => matches(el, selector))
|
||||||
|
|
|
@ -1074,24 +1074,24 @@ class RenderTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_should_render_formatted_template
|
def test_should_render_formatted_template
|
||||||
get :formatted_html_erb
|
get :formatted_html_erb
|
||||||
assert_equal "formatted html erb", @response.body
|
assert_equal "formatted HTML erb", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_render_formatted_html_erb_template
|
def test_should_render_formatted_html_erb_template
|
||||||
get :formatted_xml_erb
|
get :formatted_xml_erb
|
||||||
assert_equal "<test>passed formatted html erb</test>", @response.body
|
assert_equal "<test>passed formatted HTML erb</test>", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_render_formatted_html_erb_template_with_bad_accepts_header
|
def test_should_render_formatted_html_erb_template_with_bad_accepts_header
|
||||||
@request.env["HTTP_ACCEPT"] = "; a=dsf"
|
@request.env["HTTP_ACCEPT"] = "; a=dsf"
|
||||||
get :formatted_xml_erb
|
get :formatted_xml_erb
|
||||||
assert_equal "<test>passed formatted html erb</test>", @response.body
|
assert_equal "<test>passed formatted HTML erb</test>", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_render_formatted_html_erb_template_with_faulty_accepts_header
|
def test_should_render_formatted_html_erb_template_with_faulty_accepts_header
|
||||||
@request.accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*"
|
@request.accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*"
|
||||||
get :formatted_xml_erb
|
get :formatted_xml_erb
|
||||||
assert_equal "<test>passed formatted html erb</test>", @response.body
|
assert_equal "<test>passed formatted HTML erb</test>", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_layout_test_with_different_layout
|
def test_layout_test_with_different_layout
|
||||||
|
@ -1277,7 +1277,7 @@ class RenderTest < ActionController::TestCase
|
||||||
get :render_to_string_with_template_and_html_partial
|
get :render_to_string_with_template_and_html_partial
|
||||||
assert_equal "**only partial**\n", @controller.instance_variable_get(:@text)
|
assert_equal "**only partial**\n", @controller.instance_variable_get(:@text)
|
||||||
assert_equal "<strong>only partial</strong>\n", @controller.instance_variable_get(:@html)
|
assert_equal "<strong>only partial</strong>\n", @controller.instance_variable_get(:@html)
|
||||||
assert_equal "<strong>only html partial</strong>\n", @response.body
|
assert_equal "<strong>only HTML partial</strong>\n", @response.body
|
||||||
assert_equal "text/html", @response.media_type
|
assert_equal "text/html", @response.media_type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1290,7 +1290,7 @@ class RenderTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_render_template_within_a_template_with_other_format
|
def test_render_template_within_a_template_with_other_format
|
||||||
get :render_template_within_a_template_with_other_format
|
get :render_template_within_a_template_with_other_format
|
||||||
expected = "only html partial<p>This is grand!</p>"
|
expected = "only HTML partial<p>This is grand!</p>"
|
||||||
assert_equal expected, @response.body.strip
|
assert_equal expected, @response.body.strip
|
||||||
assert_equal "text/html", @response.media_type
|
assert_equal "text/html", @response.media_type
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
only html partial
|
only HTML partial
|
|
@ -1 +1 @@
|
||||||
formatted html erb
|
formatted HTML erb
|
|
@ -1 +1 @@
|
||||||
<test>passed formatted html erb</test>
|
<test>passed formatted HTML erb</test>
|
|
@ -1 +1 @@
|
||||||
partial with only html version
|
partial with only HTML version
|
|
@ -101,7 +101,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_no_select "input[type=radio][value=false][readonly=readonly]"
|
assert_no_select "input[type=radio][value=false][readonly=readonly]"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection radio accepts html options as input" do
|
test "collection radio accepts HTML options as input" do
|
||||||
collection = [[1, true], [0, false]]
|
collection = [[1, true], [0, false]]
|
||||||
with_collection_radio_buttons :user, :active, collection, :last, :first, {}, { class: "special-radio" }
|
with_collection_radio_buttons :user, :active, collection, :last, :first, {}, { class: "special-radio" }
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_select "input[type=radio][value=false].special-radio#user_active_false"
|
assert_select "input[type=radio][value=false].special-radio#user_active_false"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection radio accepts html options as the last element of array" do
|
test "collection radio accepts HTML options as the last element of array" do
|
||||||
collection = [[1, true, { class: "foo" }], [0, false, { class: "bar" }]]
|
collection = [[1, true, { class: "foo" }], [0, false, { class: "bar" }]]
|
||||||
with_collection_radio_buttons :user, :active, collection, :second, :first
|
with_collection_radio_buttons :user, :active, collection, :second, :first
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_select "label[for=user_active_false] + input#user_active_false[type=radio]"
|
assert_select "label[for=user_active_false] + input#user_active_false[type=radio]"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection radio with block helpers accept extra html options" do
|
test "collection radio with block helpers accept extra HTML options" do
|
||||||
with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b|
|
with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b|
|
||||||
b.label(class: "radio_button") + b.radio_button(class: "radio_button")
|
b.label(class: "radio_button") + b.radio_button(class: "radio_button")
|
||||||
end
|
end
|
||||||
|
@ -329,7 +329,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_select "label[for=user_title_господин]", "Господин"
|
assert_select "label[for=user_title_господин]", "Господин"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection check boxes accepts html options as the last element of array" do
|
test "collection check boxes accepts HTML options as the last element of array" do
|
||||||
collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]]
|
collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]]
|
||||||
with_collection_check_boxes :user, :active, collection, :first, :second
|
with_collection_check_boxes :user, :active, collection, :first, :second
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_no_select 'input[type=checkbox][value="2"][readonly=readonly]'
|
assert_no_select 'input[type=checkbox][value="2"][readonly=readonly]'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection check boxes accepts html options" do
|
test "collection check boxes accepts HTML options" do
|
||||||
collection = [[1, "Category 1"], [2, "Category 2"]]
|
collection = [[1, "Category 1"], [2, "Category 2"]]
|
||||||
with_collection_check_boxes :user, :category_ids, collection, :first, :last, {}, { class: "check" }
|
with_collection_check_boxes :user, :category_ids, collection, :first, :last, {}, { class: "check" }
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
|
||||||
assert_select "label[for=user_active_false] + input#user_active_false[type=checkbox]"
|
assert_select "label[for=user_active_false] + input#user_active_false[type=checkbox]"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "collection check boxes with block helpers accept extra html options" do
|
test "collection check boxes with block helpers accept extra HTML options" do
|
||||||
with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b|
|
with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b|
|
||||||
b.label(class: "check_box") + b.check_box(class: "check_box")
|
b.label(class: "check_box") + b.check_box(class: "check_box")
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,7 @@ class OutputSafetyHelperTest < ActionView::TestCase
|
||||||
assert_equal("&lt;script&gt;", to_sentence(["<script>"]))
|
assert_equal("&lt;script&gt;", to_sentence(["<script>"]))
|
||||||
end
|
end
|
||||||
|
|
||||||
test "to_sentence connector words are checked for html safety" do
|
test "to_sentence connector words are checked for HTML safety" do
|
||||||
assert_equal "one & two, and three", to_sentence(["one", "two", "three"], words_connector: " & ".html_safe)
|
assert_equal "one & two, and three", to_sentence(["one", "two", "three"], words_connector: " & ".html_safe)
|
||||||
assert_equal "one & two", to_sentence(["one", "two"], two_words_connector: " & ".html_safe)
|
assert_equal "one & two", to_sentence(["one", "two"], two_words_connector: " & ".html_safe)
|
||||||
assert_equal "one, two <script>alert(1)</script> three", to_sentence(["one", "two", "three"], last_word_connector: " <script>alert(1)</script> ")
|
assert_equal "one, two <script>alert(1)</script> three", to_sentence(["one", "two", "three"], last_word_connector: " <script>alert(1)</script> ")
|
||||||
|
|
|
@ -19,12 +19,12 @@ class TextHelperTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_simple_format_should_be_html_safe
|
def test_simple_format_should_be_html_safe
|
||||||
assert_predicate simple_format("<b> test with html tags </b>"), :html_safe?
|
assert_predicate simple_format("<b> test with HTML tags </b>"), :html_safe?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_simple_format_included_in_isolation
|
def test_simple_format_included_in_isolation
|
||||||
helper_klass = Class.new { include ActionView::Helpers::TextHelper }
|
helper_klass = Class.new { include ActionView::Helpers::TextHelper }
|
||||||
assert_predicate helper_klass.new.simple_format("<b> test with html tags </b>"), :html_safe?
|
assert_predicate helper_klass.new.simple_format("<b> test with HTML tags </b>"), :html_safe?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_simple_format
|
def test_simple_format
|
||||||
|
|
|
@ -2849,7 +2849,7 @@ var rootjQuery,
|
||||||
match = rquickExpr.exec( selector );
|
match = rquickExpr.exec( selector );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match html or make sure no context is specified for #id
|
// Match HTML or make sure no context is specified for #id
|
||||||
if ( match && ( match[ 1 ] || !context ) ) {
|
if ( match && ( match[ 1 ] || !context ) ) {
|
||||||
|
|
||||||
// HANDLE: $(html) -> $(array)
|
// HANDLE: $(html) -> $(array)
|
||||||
|
@ -4324,7 +4324,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
|
||||||
} else if ( !rhtml.test( elem ) ) {
|
} else if ( !rhtml.test( elem ) ) {
|
||||||
nodes.push( context.createTextNode( elem ) );
|
nodes.push( context.createTextNode( elem ) );
|
||||||
|
|
||||||
// Convert html into DOM nodes
|
// Convert HTML into DOM nodes
|
||||||
} else {
|
} else {
|
||||||
tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
|
tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
|
||||||
|
|
||||||
|
@ -8312,7 +8312,7 @@ jQuery.extend( {
|
||||||
// Convert anything to text
|
// Convert anything to text
|
||||||
"* text": String,
|
"* text": String,
|
||||||
|
|
||||||
// Text to html (true = no transformation)
|
// Text to HTML (true = no transformation)
|
||||||
"text html": true,
|
"text html": true,
|
||||||
|
|
||||||
// Evaluate text as a JSON expression
|
// Evaluate text as a JSON expression
|
||||||
|
@ -9365,7 +9365,7 @@ support.createHTMLDocument = ( function() {
|
||||||
// Argument "data" should be string of html
|
// Argument "data" should be string of html
|
||||||
// context (optional): If specified, the fragment will be created in this context,
|
// context (optional): If specified, the fragment will be created in this context,
|
||||||
// defaults to document
|
// defaults to document
|
||||||
// keepScripts (optional): If true, will include scripts passed in the html string
|
// keepScripts (optional): If true, will include scripts passed in the HTML string
|
||||||
jQuery.parseHTML = function( data, context, keepScripts ) {
|
jQuery.parseHTML = function( data, context, keepScripts ) {
|
||||||
if ( !data || typeof data !== "string" ) {
|
if ( !data || typeof data !== "string" ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -9637,7 +9637,7 @@ jQuery.fn.extend( {
|
||||||
// 1) For the element inside the iframe without offsetParent, this method will return
|
// 1) For the element inside the iframe without offsetParent, this method will return
|
||||||
// documentElement of the parent window
|
// documentElement of the parent window
|
||||||
// 2) For the hidden or detached element
|
// 2) For the hidden or detached element
|
||||||
// 3) For body or html element, i.e. in case of the html node - it will return itself
|
// 3) For body or HTML element, i.e. in case of the HTML node - it will return itself
|
||||||
//
|
//
|
||||||
// but those exceptions were never presented as a real life use-cases
|
// but those exceptions were never presented as a real life use-cases
|
||||||
// and might be considered as more preferable results.
|
// and might be considered as more preferable results.
|
||||||
|
|
2
actionview/test/ujs/public/vendor/qunit.js
vendored
2
actionview/test/ujs/public/vendor/qunit.js
vendored
|
@ -2103,7 +2103,7 @@ QUnit.jsDump = (function() {
|
||||||
key: quote,
|
key: quote,
|
||||||
// function calls it internally, it's the content of the function
|
// function calls it internally, it's the content of the function
|
||||||
functionCode: "[code]",
|
functionCode: "[code]",
|
||||||
// node calls it internally, it's an html attribute value
|
// node calls it internally, it's an HTML attribute value
|
||||||
attribute: quote,
|
attribute: quote,
|
||||||
string: quote,
|
string: quote,
|
||||||
date: quote,
|
date: quote,
|
||||||
|
|
|
@ -144,11 +144,11 @@ Active Storage, with its included JavaScript library, supports uploading directl
|
||||||
|
|
||||||
1. Include the Active Storage JavaScript in your application's JavaScript bundle or reference it directly.
|
1. Include the Active Storage JavaScript in your application's JavaScript bundle or reference it directly.
|
||||||
|
|
||||||
Requiring directly without bundling through the asset pipeline in the application html with autostart:
|
Requiring directly without bundling through the asset pipeline in the application HTML with autostart:
|
||||||
```html
|
```html
|
||||||
<%= javascript_include_tag "activestorage" %>
|
<%= javascript_include_tag "activestorage" %>
|
||||||
```
|
```
|
||||||
Requiring via importmap-rails without bundling through the asset pipeline in the application html without autostart as ESM:
|
Requiring via importmap-rails without bundling through the asset pipeline in the application HTML without autostart as ESM:
|
||||||
```ruby
|
```ruby
|
||||||
# config/importmap.rb
|
# config/importmap.rb
|
||||||
pin "@rails/activestorage", to: "activestorage.esm.js"
|
pin "@rails/activestorage", to: "activestorage.esm.js"
|
||||||
|
|
|
@ -179,7 +179,7 @@ module ActiveSupport # :nodoc:
|
||||||
# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers.
|
# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers.
|
||||||
class SafeConcatError < StandardError
|
class SafeConcatError < StandardError
|
||||||
def initialize
|
def initialize
|
||||||
super "Could not concatenate to the buffer because it is not html safe."
|
super "Could not concatenate to the buffer because it is not HTML safe."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -853,7 +853,7 @@ Safe strings on the other hand are interpolated verbatim.
|
||||||
|
|
||||||
NOTE: Automatic conversion to HTML safe translate text is only available from the `translate` (or `t`) helper method. This works in views and controllers.
|
NOTE: Automatic conversion to HTML safe translate text is only available from the `translate` (or `t`) helper method. This works in views and controllers.
|
||||||
|
|
||||||
![i18n demo html safe](images/i18n/demo_html_safe.png)
|
![i18n demo HTML safe](images/i18n/demo_html_safe.png)
|
||||||
|
|
||||||
### Translations for Active Record Models
|
### Translations for Active Record Models
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue