Skip to content

Commit

Permalink
Add a test with a custom collator for territory sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Jun 23, 2021
1 parent 897c99c commit 5bd35ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ defmodule Cldr.Html.MixProject do
{:phoenix_html, "~> 1.2 or ~> 2.0"},
{:ex_cldr_currencies, "~> 2.8", optional: true},
{:ex_cldr_territories, "~> 2.2", optional: true},
{:ex_cldr_collation, "~> 0.5", optional: true},
{:ex_money, "~> 5.0", optional: true},
{:ex_cldr_units, "~> 3.5", optional: true},
{:jason, "~> 1.0", optional: true},
Expand Down
2 changes: 2 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"earmark": {:hex, :earmark, "1.3.6", "ce1d0675e10a5bb46b007549362bd3f5f08908843957687d8484fe7f37466b19", [:mix], [], "hexpm", "1476378df80982302d5a7857b6a11dd0230865057dec6d16544afecc6bc6b4c2"},
"earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"},
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_cldr": {:hex, :ex_cldr, "2.22.1", "adda9f44eac88090c6b00ec1cd24861ea1888dc4907dd8b68356ff6b6adb8e84", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:cldr_utils, "~> 2.15", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.13", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "03744395245fa669d08802370c917d0ac4396045e31c3a51f8224c2e2eabb6af"},
"ex_cldr_collation": {:hex, :ex_cldr_collation, "0.5.0", "31b424e22d2799e5d913dfccb8ffe116a096253048623fb71e07337d38b82130", [:mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "45f8c8f97db46a7c457d39845e103d37b68dcb4ba43eac7b80ab7fe355b91109"},
"ex_cldr_currencies": {:hex, :ex_cldr_currencies, "2.9.1", "692d9d8262bd9c423d601d5ce6ae294df85f8652664e723e2cfd68d97bd72a10", [:mix], [{:ex_cldr, "~> 2.20", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "1bc6f9eabef1e79e98cb9f8b14dc5657c17ddcbea31e800440fd52a6e45e20ac"},
"ex_cldr_lists": {:hex, :ex_cldr_lists, "2.8.0", "373d8574d28590fdbc475436cc1590d37200867b4116f69a51e6e57cb0e62ee6", [:mix], [{:ex_cldr_numbers, "~> 2.17", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "455406d488452d6eb0b044e23a918e015418787ffc87791d81e7320742269483"},
"ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.18.1", "3d133f8ca2ab1123f1c894f2714ebf27d89b6574acb4891389bd0bd246084294", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.21", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.9", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:ex_doc, "~> 0.18", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "0cf211a3c92190639e60849f4fbd12357112697bcbfa827e360f227fea45f8c8"},
Expand Down
19 changes: 19 additions & 0 deletions test/cldr_html_territory_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,24 @@ defmodule Cldr.HTML.Territory.Test do
~s(<option value="IT" selected>🇮🇹 อิตาลี</option>) <>
~s(</select>)
end

test "with locale and case insensitive unicode collator" do
string = safe_to_string(
Cldr.HTML.Territory.select(
:my_form,
:territory,
territories: [:US, :AU],
selected: :IT,
locale: "th",
collator: &(Cldr.Collation.sort(&1, casing: :insensitive))
)
)
assert string ==
~s(<select id="my_form_territory" name="my_form[territory]">) <>
~s(<option value="IT" selected>🇮🇹 อิตาลี</option>) <>
~s(<option value="US">🇺🇸 สหรัฐอเมริกา</option>) <>
~s(<option value="AU">🇦🇺 ออสเตรเลีย</option>) <>
~s(</select>)
end
end
end

0 comments on commit 5bd35ff

Please sign in to comment.