@pablobm commented on this pull request.


> +  <%= content_tag :td,
+                  format_value(tag[0], tag[1]),
+                  :class => "py-1 border-secondary-subtle border-start",
+                  :dir => "auto",
+                  :lang => tag_language(tag[0]) %>

I think this should be made into a helper.

> @@ -109,6 +109,26 @@ def test_element_icon
     end
   end
 
+  def test_lang_attribute_for_localized_name_tags
+    tag = ["name:pt", "Nó teste"]
+
+    html = render :partial => "browse/tag", :locals => { :tag => tag }

After making the `content_tag` call into a helper, this should be converted to 
call the helper directly instead of using `render`.

> @@ -109,6 +109,26 @@ def test_element_icon
     end
   end
 
+  def test_lang_attribute_for_localized_name_tags
+    tag = ["name:pt", "Nó teste"]
+
+    html = render :partial => "browse/tag", :locals => { :tag => tag }
+
+    doc = 
Rails::Dom::Testing.html_document_fragment.parse("<table>#{html}</table>")
+
+    assert_dom doc, "td[lang='pt']"
+  end
+
+  def test_non_language_name_tags_do_not_get_lang_attribute
+    tag = ["name:etymology", "Origin"]
+
+    html = render :partial => "browse/tag", :locals => { :tag => tag }

Same here.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6854#pullrequestreview-3937708881
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6854/review/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to