velvetkit 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +149 -2
- data/lib/velvetkit/version.rb +1 -1
- data/registry/app/components/ui/carousel.html.erb +7 -0
- data/registry/app/components/ui/carousel.rb +60 -0
- data/registry/app/components/ui/chart.html.erb +3 -3
- data/registry/app/components/ui/chart.rb +18 -10
- data/registry/app/components/ui/checkbox.html.erb +6 -0
- data/registry/app/components/ui/checkbox.rb +9 -2
- data/registry/app/components/ui/fieldset.html.erb +6 -0
- data/registry/app/components/ui/fieldset.rb +76 -0
- data/registry/app/components/ui/gallery/image.rb +14 -1
- data/registry/app/components/ui/gallery.html.erb +32 -3
- data/registry/app/components/ui/gallery.rb +44 -5
- data/registry/app/components/ui/radio_group/item.html.erb +1 -1
- data/registry/app/components/ui/radio_group/item.rb +4 -0
- data/registry/app/components/ui/radio_group.html.erb +1 -1
- data/registry/app/components/ui/radio_group.rb +42 -2
- data/registry/app/components/ui/scrubber.html.erb +18 -0
- data/registry/app/components/ui/scrubber.rb +62 -0
- data/registry/app/components/ui/select.html.erb +1 -1
- data/registry/app/components/ui/select.rb +16 -1
- data/registry/app/components/ui/selection_bar.html.erb +7 -0
- data/registry/app/components/ui/selection_bar.rb +75 -0
- data/registry/app/components/ui/sidebar/inset.rb +5 -2
- data/registry/app/components/ui/sidebar/menu_button.rb +24 -9
- data/registry/app/components/ui/sidebar/menu_item.html.erb +1 -1
- data/registry/app/components/ui/sidebar/menu_item.rb +31 -5
- data/registry/app/components/ui/sidebar/menu_sub.rb +59 -0
- data/registry/app/components/ui/sidebar.html.erb +3 -3
- data/registry/app/components/ui/sidebar.rb +91 -13
- data/registry/app/components/ui/table/column.html.erb +1 -1
- data/registry/app/components/ui/table/column.rb +26 -2
- data/registry/app/components/ui/table/head.html.erb +1 -1
- data/registry/app/components/ui/table/head.rb +15 -2
- data/registry/app/components/ui/table/row.html.erb +1 -1
- data/registry/app/components/ui/table/row.rb +19 -5
- data/registry/app/components/ui/table.html.erb +2 -2
- data/registry/app/components/ui/table.rb +29 -4
- data/registry/app/components/ui/toggle_group.html.erb +1 -1
- data/registry/app/components/ui/toggle_group.rb +26 -3
- data/registry/app/javascript/controllers/ui/carousel_controller.ts +63 -0
- data/registry/app/javascript/controllers/ui/file_field_controller.ts +1 -1
- data/registry/app/javascript/controllers/ui/gallery_controller.ts +52 -14
- data/registry/app/javascript/controllers/ui/scrubber_controller.ts +188 -0
- data/registry/app/javascript/controllers/ui/selection_bar_controller.ts +122 -0
- data/registry/app/javascript/controllers/ui/sidebar_controller.ts +102 -32
- data/registry/components.yml +11 -3
- data/registry/config/locales/velvetkit.en.yml +16 -0
- data/registry/icons/lucide/arrow-down.svg +16 -0
- data/registry/icons/lucide/arrow-up.svg +16 -0
- data/registry/icons/lucide/image.svg +17 -0
- data/registry/icons/lucide/star.svg +15 -0
- data/registry/icons/phosphor/arrow-down.svg +2 -0
- data/registry/icons/phosphor/arrow-up.svg +2 -0
- data/registry/icons/phosphor/image.svg +2 -0
- data/registry/icons/phosphor/star.svg +2 -0
- data/registry/icons/tabler/arrow-down.svg +18 -0
- data/registry/icons/tabler/arrow-up.svg +18 -0
- data/registry/icons/tabler/photo.svg +19 -0
- data/registry/icons/tabler/star.svg +16 -0
- data/registry/icons.yml +4 -0
- data/registry/test/components/previews/ui/carousel_preview/highlights.html.erb +17 -0
- data/registry/test/components/previews/ui/carousel_preview.rb +22 -0
- data/registry/test/components/previews/ui/chart_preview/whole_dollars.html.erb +19 -0
- data/registry/test/components/previews/ui/chart_preview.rb +7 -1
- data/registry/test/components/previews/ui/checkbox_preview/in_form.html.erb +2 -3
- data/registry/test/components/previews/ui/fieldset_preview/block_of_fields.html.erb +18 -0
- data/registry/test/components/previews/ui/fieldset_preview/groups.html.erb +14 -0
- data/registry/test/components/previews/ui/fieldset_preview/model_errors.html.erb +22 -0
- data/registry/test/components/previews/ui/fieldset_preview/playground.html.erb +5 -0
- data/registry/test/components/previews/ui/fieldset_preview.rb +24 -0
- data/registry/test/components/previews/ui/gallery_preview/grid.html.erb +25 -0
- data/registry/test/components/previews/ui/gallery_preview.rb +3 -0
- data/registry/test/components/previews/ui/scrubber_preview/default.html.erb +24 -0
- data/registry/test/components/previews/ui/scrubber_preview.rb +6 -0
- data/registry/test/components/previews/ui/selection_bar_preview/floating.html.erb +16 -0
- data/registry/test/components/previews/ui/selection_bar_preview/table.html.erb +26 -0
- data/registry/test/components/previews/ui/selection_bar_preview.rb +9 -0
- data/registry/test/components/previews/ui/sidebar_preview/_shell.html.erb +5 -4
- data/registry/test/components/previews/ui/sidebar_preview/pill_links.html.erb +52 -0
- data/registry/test/components/previews/ui/sidebar_preview.rb +3 -0
- data/registry/test/components/previews/ui/table_preview/selectable.html.erb +26 -0
- data/registry/test/components/previews/ui/table_preview/sortable.html.erb +20 -0
- data/registry/test/components/previews/ui/table_preview/sticky_header.html.erb +13 -0
- data/registry/test/components/previews/ui/table_preview.rb +9 -0
- data/registry/test/components/ui/base_test.rb +27 -0
- data/registry/test/components/ui/carousel_test.rb +38 -0
- data/registry/test/components/ui/chart_test.rb +20 -0
- data/registry/test/components/ui/checkbox_test.rb +11 -2
- data/registry/test/components/ui/confirm_dialog_test.rb +3 -0
- data/registry/test/components/ui/fieldset_test.rb +119 -0
- data/registry/test/components/ui/gallery_test.rb +36 -1
- data/registry/test/components/ui/radio_group_test.rb +106 -0
- data/registry/test/components/ui/scrubber_test.rb +43 -0
- data/registry/test/components/ui/select_test.rb +21 -0
- data/registry/test/components/ui/selection_bar_test.rb +46 -0
- data/registry/test/components/ui/sidebar/menu_button_test.rb +9 -0
- data/registry/test/components/ui/sidebar_test.rb +79 -1
- data/registry/test/components/ui/toggle_group_test.rb +45 -0
- metadata +47 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class UI::CarouselTest < ViewComponent::TestCase
|
|
6
|
+
def setup_fixtures(*); end
|
|
7
|
+
def teardown_fixtures(*); end
|
|
8
|
+
|
|
9
|
+
def render_carousel(**opts)
|
|
10
|
+
render_inline(UI::Carousel.new(label: "Highlights", **opts)) do |carousel|
|
|
11
|
+
carousel.with_item { "Coast" }
|
|
12
|
+
carousel.with_item { "Garden" }
|
|
13
|
+
carousel.with_item { "City" }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_a_named_region_of_snapping_items
|
|
18
|
+
render_carousel(item_class: "w-64")
|
|
19
|
+
region = page.find("[role=region][aria-roledescription=carousel][aria-label=Highlights][data-controller='ui--carousel']")
|
|
20
|
+
assert_includes region.find("ul")[:class], "snap-x"
|
|
21
|
+
assert_equal %w[Coast Garden City], page.all("ul li").map(&:text)
|
|
22
|
+
assert_includes page.all("ul li").first[:class], "w-64"
|
|
23
|
+
assert_includes page.all("ul li").first[:class], "snap-start"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_buttons_start_hidden_and_control_the_strip
|
|
27
|
+
render_carousel
|
|
28
|
+
track = page.find("ul")[:id]
|
|
29
|
+
assert_selector "button[aria-label=Previous][hidden][aria-controls='#{track}'][data-action='ui--carousel#previous']", visible: :all
|
|
30
|
+
assert_selector "button[aria-label=Next][hidden][aria-controls='#{track}'] svg[data-icon='chevron-right']", visible: :all
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_gap_class_and_attributes
|
|
34
|
+
render_carousel(gap: 6, class: "mt-4", id: "highlights")
|
|
35
|
+
assert_selector "#highlights.mt-4"
|
|
36
|
+
assert_includes page.find("ul")[:class], "gap-6"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -96,6 +96,26 @@ class UI::ChartTest < ViewComponent::TestCase
|
|
|
96
96
|
assert_selector "td", text: "41.5%", visible: :all
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
def test_precision_sets_the_decimals
|
|
100
|
+
render_chart(format: :currency, precision: 0)
|
|
101
|
+
assert_equal [ "$1,200", "$1,501", "$900" ], config["series"].first["text"]
|
|
102
|
+
render_chart(precision: 1, series: [ { name: "Load", data: [ 1234.56, 2, 3 ] } ])
|
|
103
|
+
assert_selector "td", text: "1,234.6", visible: :all
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_show_data_false_keeps_the_table_for_screen_readers
|
|
107
|
+
render_chart(show_data: false)
|
|
108
|
+
assert_no_selector "details", visible: :all
|
|
109
|
+
assert_no_selector "summary", visible: :all
|
|
110
|
+
assert_selector "div.sr-only table td", text: "1,200", visible: :all
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_a_pie_sits_beside_its_legend_by_its_own_width
|
|
114
|
+
render_chart(type: :donut, series: [ { name: "Plan", data: [ 1, 2, 3 ] } ])
|
|
115
|
+
assert_includes page.find("[data-slot='chart']")[:class], "@container"
|
|
116
|
+
assert_selector "div.\\@md\\:flex-row"
|
|
117
|
+
end
|
|
118
|
+
|
|
99
119
|
def test_missing_values_leave_a_gap
|
|
100
120
|
render_chart(series: [ { name: "Sales", data: [ 1, nil, 3 ] } ])
|
|
101
121
|
assert_nil config["series"].first["data"][1]
|
|
@@ -77,7 +77,7 @@ class UI::CheckboxTest < ViewComponent::TestCase
|
|
|
77
77
|
def test_check_overlay_span_present_with_peer_checked_class
|
|
78
78
|
render_inline(UI::Checkbox.new(name: "test"))
|
|
79
79
|
wrapper = page.find(".relative.inline-flex")
|
|
80
|
-
overlay = wrapper.
|
|
80
|
+
overlay = wrapper.all("span.pointer-events-none").first
|
|
81
81
|
classes = overlay[:class].split
|
|
82
82
|
assert_includes classes, "peer-checked:opacity-100"
|
|
83
83
|
assert_includes classes, "opacity-0"
|
|
@@ -85,11 +85,20 @@ class UI::CheckboxTest < ViewComponent::TestCase
|
|
|
85
85
|
|
|
86
86
|
def test_check_icon_inside_overlay
|
|
87
87
|
render_inline(UI::Checkbox.new(name: "test"))
|
|
88
|
-
overlay = page.
|
|
88
|
+
overlay = page.all("span.pointer-events-none").first
|
|
89
89
|
icon = overlay.find("svg", visible: :all)
|
|
90
90
|
assert icon.matches_css?("[data-icon='check']")
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
# Script sets `indeterminate` on "select all" when some rows are chosen.
|
|
94
|
+
def test_a_partly_checked_box_shows_a_dash
|
|
95
|
+
render_inline(UI::Checkbox.new(name: "test"))
|
|
96
|
+
assert_includes page.find("input")[:class], "indeterminate:bg-primary"
|
|
97
|
+
dash = page.all("span.pointer-events-none").last
|
|
98
|
+
assert_includes dash[:class].split, "peer-indeterminate:opacity-100"
|
|
99
|
+
assert dash.find("svg", visible: :all).matches_css?("[data-icon='minus']")
|
|
100
|
+
end
|
|
101
|
+
|
|
93
102
|
def test_user_class_override_via_tailwind_merge
|
|
94
103
|
render_inline(UI::Checkbox.new(name: "test", class: "border-red-500"))
|
|
95
104
|
input = page.find("input[type='checkbox']")
|
|
@@ -49,6 +49,9 @@ class UI::ConfirmDialogTest < ViewComponent::TestCase
|
|
|
49
49
|
def test_labels_come_from_i18n
|
|
50
50
|
# Built from the dotted scope so the namespaced run stores it under its own scope.
|
|
51
51
|
labels = "ui.confirm_dialog".split(".").reverse.inject({ confirm: "OK", cancel: "Never mind" }) { |h, k| { k => h } }
|
|
52
|
+
# Load the locale files first: I18n loads them on its first lookup, which
|
|
53
|
+
# would put the kit's own labels back over these when this test runs first.
|
|
54
|
+
I18n.backend.eager_load!
|
|
52
55
|
I18n.backend.store_translations(:en, labels)
|
|
53
56
|
render_inline(UI::ConfirmDialog.new)
|
|
54
57
|
assert_equal "OK", dialog["data-ui--confirm-dialog-confirm-label-value"]
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class UI::FieldsetTest < ViewComponent::TestCase
|
|
6
|
+
def setup_fixtures(*); end
|
|
7
|
+
def teardown_fixtures(*); end
|
|
8
|
+
|
|
9
|
+
Settings = Struct.new(:channels) do
|
|
10
|
+
include ActiveModel::Validations
|
|
11
|
+
def self.model_name = ActiveModel::Name.new(self, nil, "Settings")
|
|
12
|
+
validates :channels, presence: true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def form_builder_for(record)
|
|
16
|
+
ActionView::Helpers::FormBuilder.new(:settings, record, vc_test_controller.view_context, {})
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_renders_a_fieldset_named_by_its_legend
|
|
20
|
+
render_inline(UI::Fieldset.new(legend: "Notifications", id: "notify")) { "controls" }
|
|
21
|
+
assert_selector "fieldset#notify[aria-labelledby='notify-legend']", text: "controls"
|
|
22
|
+
assert_selector "fieldset > legend#notify-legend:first-child", text: "Notifications"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_hint_and_error_describe_the_group
|
|
26
|
+
render_inline(UI::Fieldset.new(legend: "Plan", hint: "Change it any time.", error: "Choose a plan", id: "plan"))
|
|
27
|
+
assert_selector "fieldset[aria-describedby='plan-hint plan-error']"
|
|
28
|
+
assert_selector "p#plan-hint", text: "Change it any time."
|
|
29
|
+
assert_selector "p#plan-error.text-destructive", text: "Choose a plan"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_hint_comes_before_the_controls_and_the_error_after
|
|
33
|
+
render_inline(UI::Fieldset.new(legend: "Plan", hint: "Hint", error: "Error")) { "<span>controls</span>".html_safe }
|
|
34
|
+
assert_equal %w[legend p span p], page.all("fieldset > *").map(&:tag_name)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_makes_an_id_when_given_none
|
|
38
|
+
render_inline(UI::Fieldset.new(legend: "Plan", hint: "Hint"))
|
|
39
|
+
id = page.find("fieldset")[:id]
|
|
40
|
+
assert id.start_with?("ui-fieldset-")
|
|
41
|
+
assert_selector "legend##{id}-legend"
|
|
42
|
+
assert_selector "p##{id}-hint"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_nothing_to_describe_means_no_aria_describedby
|
|
46
|
+
render_inline(UI::Fieldset.new(legend: "Plan"))
|
|
47
|
+
assert_no_selector "fieldset[aria-describedby]"
|
|
48
|
+
assert_no_selector "p"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_required_marks_the_legend
|
|
52
|
+
render_inline(UI::Fieldset.new(legend: "Plan", required: true))
|
|
53
|
+
assert_selector "legend span.text-destructive", text: "*"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_disabled_disables_the_fieldset
|
|
57
|
+
render_inline(UI::Fieldset.new(legend: "Plan", disabled: true))
|
|
58
|
+
assert_selector "fieldset[disabled]"
|
|
59
|
+
assert_selector "legend.text-muted-foreground"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_a_plain_group_takes_no_required_or_invalid
|
|
63
|
+
render_inline(UI::Fieldset.new(legend: "Plan", required: true, error: "Choose one"))
|
|
64
|
+
assert_no_selector "fieldset[aria-required]"
|
|
65
|
+
assert_no_selector "fieldset[aria-invalid]"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_a_radiogroup_is_required_and_invalid
|
|
69
|
+
render_inline(UI::Fieldset.new(legend: "Plan", required: true, error: true, role: "radiogroup"))
|
|
70
|
+
assert_selector "fieldset[role='radiogroup'][aria-required='true'][aria-invalid='true']"
|
|
71
|
+
assert_no_selector "p.text-destructive"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_wrap_only_with_something_to_show
|
|
75
|
+
assert UI::Fieldset.new(legend: "Plan").wrap?
|
|
76
|
+
assert UI::Fieldset.new(legend: false, hint: "Hint").wrap?
|
|
77
|
+
assert UI::Fieldset.new(legend: false, error: "Error").wrap?
|
|
78
|
+
refute UI::Fieldset.new(legend: false).wrap?
|
|
79
|
+
refute UI::Fieldset.new.wrap?
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def test_form_binding_names_it_and_shows_the_models_errors
|
|
83
|
+
render_inline(UI::Fieldset.new(form: form_builder_for(Settings.new([]).tap(&:validate)), field: :channels, id: "ch"))
|
|
84
|
+
assert_selector "legend", text: "Channels"
|
|
85
|
+
assert_selector "p#ch-error", text: "Channels can't be blank"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def test_legend_overrides_the_attribute_name_and_false_drops_it
|
|
89
|
+
form = form_builder_for(Settings.new([]))
|
|
90
|
+
render_inline(UI::Fieldset.new(form: form, field: :channels, legend: "Where to notify you"))
|
|
91
|
+
assert_selector "legend", text: "Where to notify you"
|
|
92
|
+
render_inline(UI::Fieldset.new(form: form, field: :channels, legend: false))
|
|
93
|
+
assert_no_selector "legend"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_user_class_and_attrs_pass_through
|
|
97
|
+
render_inline(UI::Fieldset.new(legend: "Plan", class: "gap-6", data: { testid: "plan" }, aria: { label: "Billing plan" }))
|
|
98
|
+
fieldset = page.find("fieldset[data-testid='plan'][aria-label='Billing plan']")
|
|
99
|
+
assert_includes fieldset[:class].split, "gap-6"
|
|
100
|
+
refute_includes fieldset[:class].split, "gap-3"
|
|
101
|
+
assert fieldset[:"aria-labelledby"].present?
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_never_an_empty_legend
|
|
105
|
+
render_inline(UI::Fieldset.new(legend: true)) { "x" }
|
|
106
|
+
assert_no_selector "legend"
|
|
107
|
+
assert_no_selector "fieldset[aria-labelledby]"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def test_your_aria_describedby_adds_to_the_hint_and_error
|
|
111
|
+
render_inline(UI::Fieldset.new(legend: "Plan", hint: "Hint", id: "plan", aria: { describedby: "terms" }))
|
|
112
|
+
assert_selector "fieldset[aria-describedby='plan-hint terms']"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_a_long_legend_has_room_to_wrap
|
|
116
|
+
render_inline(UI::Fieldset.new(legend: "Plan"))
|
|
117
|
+
assert_includes page.find("legend")[:class].split, "leading-snug"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -95,7 +95,7 @@ class UI::GalleryTest < ViewComponent::TestCase
|
|
|
95
95
|
render_gallery
|
|
96
96
|
assert_selector "dialog .start-4.top-4 button[aria-label='Zoom in']", visible: :all
|
|
97
97
|
assert_selector "dialog .start-4.top-4 button[aria-label='Zoom out']", visible: :all
|
|
98
|
-
assert_selector "dialog
|
|
98
|
+
assert_selector "dialog .end-4.top-4 button[aria-label='Close']", visible: :all
|
|
99
99
|
assert_selector "dialog button.start-4.top-1\\/2[aria-label='Previous image']", visible: :all
|
|
100
100
|
assert_selector "dialog button.end-4.top-1\\/2[aria-label='Next image']", visible: :all
|
|
101
101
|
end
|
|
@@ -189,4 +189,39 @@ class UI::GalleryTest < ViewComponent::TestCase
|
|
|
189
189
|
render_gallery(class: "max-w-md", id: "photos", data: { foo: "bar" })
|
|
190
190
|
assert_selector "#photos.max-w-md[data-foo='bar'][data-controller='ui--gallery']"
|
|
191
191
|
end
|
|
192
|
+
|
|
193
|
+
def render_grid
|
|
194
|
+
render_inline(UI::Gallery.new(strip: false, label: "Photos")) do |gallery|
|
|
195
|
+
gallery.with_image(src: "/coast.jpg", alt: "Coast", zoom_src: "/coast-big.jpg") do |image|
|
|
196
|
+
image.with_info { "Taken in May" }
|
|
197
|
+
image.with_action { "<button>Favourite</button>".html_safe }
|
|
198
|
+
end
|
|
199
|
+
gallery.with_image(src: "/garden.jpg", alt: "Garden")
|
|
200
|
+
gallery.trigger(0, class: "aspect-square") { "<img src='/coast-sm.jpg' alt=''>".html_safe } +
|
|
201
|
+
gallery.trigger(1) { "<img src='/garden-sm.jpg' alt=''>".html_safe }
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def test_without_a_strip_the_page_opens_each_image
|
|
206
|
+
render_grid
|
|
207
|
+
assert_no_selector "[data-ui--gallery-target='track']", visible: :all
|
|
208
|
+
assert_no_selector "button[aria-label='Show image 1']", visible: :all
|
|
209
|
+
assert_selector "button.aspect-square[aria-label='Open Coast'][aria-haspopup=dialog][data-action='ui--gallery#open'][data-ui--gallery-index-param='0'][data-ui--gallery-target=trigger] img"
|
|
210
|
+
assert_selector "button[aria-label='Open Garden'][data-ui--gallery-index-param='1']"
|
|
211
|
+
assert_selector "li[data-ui--gallery-target=slide][data-zoom-src='/coast-big.jpg'][data-alt=Coast]", visible: :all
|
|
212
|
+
assert_selector "dialog button[aria-label='Next image']", visible: :all
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_info_and_actions_show_in_the_overlay_for_their_image
|
|
216
|
+
render_grid
|
|
217
|
+
toggle = page.find("dialog button[aria-label=Info][aria-expanded=false][data-action='ui--gallery#toggleInfo']", visible: :all)
|
|
218
|
+
panel = page.find("dialog aside##{toggle[:"aria-controls"]}[hidden]", visible: :all)
|
|
219
|
+
assert_equal "Taken in May", panel.find("[data-ui--gallery-target=perImage][data-index='0']", visible: :all).text(:all)
|
|
220
|
+
assert_selector "dialog [data-ui--gallery-target=perImage][data-index='0'] button", text: "Favourite", visible: :all
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def test_no_info_button_when_no_image_has_info
|
|
224
|
+
render_gallery
|
|
225
|
+
assert_no_selector "button[aria-label=Info]", visible: :all
|
|
226
|
+
end
|
|
192
227
|
end
|
|
@@ -136,4 +136,110 @@ class UI::RadioGroupTest < ViewComponent::TestCase
|
|
|
136
136
|
assert_includes classes, "peer"
|
|
137
137
|
assert_includes classes, "appearance-none"
|
|
138
138
|
end
|
|
139
|
+
|
|
140
|
+
Account = Struct.new(:plan, :seats) do
|
|
141
|
+
include ActiveModel::Validations
|
|
142
|
+
def self.model_name = ActiveModel::Name.new(self, nil, "Account")
|
|
143
|
+
validates :plan, presence: true
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def form_builder_for(record)
|
|
147
|
+
ActionView::Helpers::FormBuilder.new(:account, record, vc_test_controller.view_context, {})
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def test_a_legend_makes_the_fieldset_the_radiogroup
|
|
151
|
+
render_inline(UI::RadioGroup.new(name: "plan", legend: "Plan", hint: "Change it any time.", required: true)) do |rg|
|
|
152
|
+
rg.with_item(value: "free", label: "Free")
|
|
153
|
+
end
|
|
154
|
+
fieldset = page.find("fieldset[role='radiogroup'][aria-required='true']")
|
|
155
|
+
assert_equal "#{fieldset[:id]}-legend", fieldset[:"aria-labelledby"]
|
|
156
|
+
assert_equal "#{fieldset[:id]}-hint", fieldset[:"aria-describedby"]
|
|
157
|
+
assert_selector "legend", text: "Plan"
|
|
158
|
+
assert_selector "[role='radiogroup']", count: 1
|
|
159
|
+
assert_selector "fieldset > div.flex-col input[type='radio'][name='plan'][required]"
|
|
160
|
+
assert_selector "span.text-destructive", text: "*", count: 1
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_without_a_legend_hint_or_error_it_is_unchanged
|
|
164
|
+
render_inline(UI::RadioGroup.new(name: "plan")) { |rg| rg.with_item(value: "free") }
|
|
165
|
+
assert_no_selector "fieldset"
|
|
166
|
+
assert_selector "div[role='radiogroup']"
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def test_error_marks_the_group_invalid
|
|
170
|
+
render_inline(UI::RadioGroup.new(name: "plan", legend: "Plan", error: "Choose a plan")) { |rg| rg.with_item(value: "free") }
|
|
171
|
+
fieldset = page.find("fieldset[aria-invalid='true']")
|
|
172
|
+
assert_selector "p##{fieldset[:id]}-error", text: "Choose a plan"
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def test_class_and_attrs_stay_on_the_radios_container
|
|
176
|
+
render_inline(UI::RadioGroup.new(name: "plan", legend: "Plan", id: "plans", class: "flex-row", data: { testid: "plans" })) do |rg|
|
|
177
|
+
rg.with_item(value: "free")
|
|
178
|
+
end
|
|
179
|
+
assert_selector "fieldset > div#plans.flex-row[data-testid='plans']"
|
|
180
|
+
assert_no_selector "fieldset[data-testid]"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def test_form_builder_names_and_values
|
|
184
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new("pro")), field: :plan)) do |rg|
|
|
185
|
+
rg.with_item(value: "free", label: "Free")
|
|
186
|
+
rg.with_item(value: "pro", label: "Pro")
|
|
187
|
+
end
|
|
188
|
+
assert_selector "input[name='account[plan]']", count: 2
|
|
189
|
+
assert page.find("input[value='pro']").checked?
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def test_values_compare_as_strings
|
|
193
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new(nil, 5)), field: :seats)) do |rg|
|
|
194
|
+
rg.with_item(value: 5, label: "Five")
|
|
195
|
+
end
|
|
196
|
+
assert page.find("input[value='5']").checked?
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def test_a_bound_group_shows_the_models_error_without_growing_a_legend
|
|
200
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new(nil).tap(&:validate)), field: :plan)) do |rg|
|
|
201
|
+
rg.with_item(value: "free", label: "Free")
|
|
202
|
+
end
|
|
203
|
+
assert_selector "fieldset[role='radiogroup'][aria-invalid='true']"
|
|
204
|
+
assert_selector "p.text-destructive", text: "Plan can't be blank"
|
|
205
|
+
assert_no_selector "legend"
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def test_renders_no_whitespace_around_itself
|
|
209
|
+
render_inline(UI::RadioGroup.new(name: "plan")) { |rg| rg.with_item(value: "free") }
|
|
210
|
+
assert rendered_content.start_with?("<div"), rendered_content[0, 20].inspect
|
|
211
|
+
render_inline(UI::RadioGroup.new(name: "plan", legend: "Plan")) { |rg| rg.with_item(value: "free") }
|
|
212
|
+
assert rendered_content.start_with?("<fieldset"), rendered_content[0, 20].inspect
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_a_blank_legend_is_no_legend
|
|
216
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new("pro")), field: :plan, legend: "")) do |rg|
|
|
217
|
+
rg.with_item(value: "free")
|
|
218
|
+
end
|
|
219
|
+
assert_no_selector "fieldset"
|
|
220
|
+
assert_no_selector "legend"
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def test_legend_true_uses_the_attribute_name
|
|
224
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new("pro")), field: :plan, legend: true)) do |rg|
|
|
225
|
+
rg.with_item(value: "free")
|
|
226
|
+
end
|
|
227
|
+
assert_selector "legend", text: "Plan"
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def test_your_aria_attributes_move_to_the_fieldset
|
|
231
|
+
render_inline(UI::RadioGroup.new(name: "plan", hint: "Change it any time.", aria: { label: "Billing plan" })) do |rg|
|
|
232
|
+
rg.with_item(value: "free")
|
|
233
|
+
end
|
|
234
|
+
assert_selector "fieldset[role='radiogroup'][aria-label='Billing plan']"
|
|
235
|
+
assert_no_selector "div[aria-label]"
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def test_error_false_hides_the_models_error
|
|
239
|
+
render_inline(UI::RadioGroup.new(form: form_builder_for(Account.new(nil).tap(&:validate)), field: :plan, error: false)) do |rg|
|
|
240
|
+
rg.with_item(value: "free")
|
|
241
|
+
end
|
|
242
|
+
assert_no_selector "fieldset"
|
|
243
|
+
assert_selector "div[role='radiogroup']"
|
|
244
|
+
end
|
|
139
245
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class UI::ScrubberTest < ViewComponent::TestCase
|
|
6
|
+
def setup_fixtures(*); end
|
|
7
|
+
def teardown_fixtures(*); end
|
|
8
|
+
|
|
9
|
+
def render_scrubber(**opts)
|
|
10
|
+
render_inline(UI::Scrubber.new(label: "Jump to a date", for: "library", **opts)) do |scrubber|
|
|
11
|
+
scrubber.with_mark(href: "#2026-03", label: "March 2026", major: "2026")
|
|
12
|
+
scrubber.with_mark(href: "#2026-02", label: "February 2026")
|
|
13
|
+
scrubber.with_mark(href: "#2025-12", label: "December 2025", major: "2025")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_a_named_nav_watching_what_scrolls
|
|
18
|
+
render_scrubber
|
|
19
|
+
nav = page.find("nav[aria-label='Jump to a date'][data-controller='ui--scrubber']")
|
|
20
|
+
assert_equal "library", nav[:"data-ui--scrubber-for-value"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_each_mark_links_to_its_heading_and_only_one_is_a_tab_stop
|
|
24
|
+
render_scrubber
|
|
25
|
+
marks = page.all("a[data-ui--scrubber-target=mark]", visible: :all)
|
|
26
|
+
assert_equal %w[#2026-03 #2026-02 #2025-12], marks.map { |mark| mark[:href] }
|
|
27
|
+
assert_equal [ "March 2026", "February 2026", "December 2025" ], marks.map { |mark| mark[:"aria-label"] }
|
|
28
|
+
assert_equal %w[0 -1 -1], marks.map { |mark| mark[:tabindex] }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_majors_show_their_text_and_the_rest_are_dots
|
|
32
|
+
render_scrubber
|
|
33
|
+
assert_selector "a[data-major=true]", text: "2026", visible: :all
|
|
34
|
+
assert_selector "a[data-major=false] span.rounded-full", visible: :all
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_the_rail_drags_and_the_tip_and_line_are_hidden_from_screen_readers
|
|
38
|
+
render_scrubber(class: "fixed end-0")
|
|
39
|
+
assert_selector "nav.fixed.end-0 [data-ui--scrubber-target=rail][data-action*='pointerdown->ui--scrubber#grab']"
|
|
40
|
+
assert_selector "[data-ui--scrubber-target=thumb][aria-hidden=true]", visible: :all
|
|
41
|
+
assert_selector "[data-ui--scrubber-target=tip][aria-hidden=true]", visible: :all
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -90,6 +90,27 @@ class UI::SelectTest < ViewComponent::TestCase
|
|
|
90
90
|
|
|
91
91
|
# --- label, states, sizes ---------------------------------------------
|
|
92
92
|
|
|
93
|
+
def test_aria_label_names_the_visible_button_not_the_hidden_select
|
|
94
|
+
render_inline(UI::Select.new(name: "sort", options: TEAMS, "aria-label": "Sort by"))
|
|
95
|
+
assert_equal "Sort by", trigger["aria-label"]
|
|
96
|
+
assert_equal trigger[:id], listbox["aria-labelledby"]
|
|
97
|
+
assert_nil native["aria-label"]
|
|
98
|
+
assert_equal "true", native["aria-hidden"]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def test_the_aria_hash_names_the_button_too
|
|
102
|
+
render_inline(UI::Select.new(name: "sort", options: TEAMS, aria: { label: "Sort by" }))
|
|
103
|
+
assert_equal "Sort by", trigger["aria-label"]
|
|
104
|
+
render_inline(UI::Select.new(name: "sort", options: TEAMS, "aria-labelledby": "heading"))
|
|
105
|
+
assert_equal "heading", trigger["aria-labelledby"]
|
|
106
|
+
assert_nil native["aria-labelledby"]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_other_attributes_still_reach_the_native_select
|
|
110
|
+
render_inline(UI::Select.new(name: "sort", options: TEAMS, "aria-label": "Sort by", data: { testid: "s" }))
|
|
111
|
+
assert_equal "s", native["data-testid"]
|
|
112
|
+
end
|
|
113
|
+
|
|
93
114
|
def test_label_is_associated_with_the_trigger
|
|
94
115
|
render_inline(UI::Select.new(name: "section", options: TEAMS, label: "Team"))
|
|
95
116
|
assert_equal trigger[:id], page.find("label")[:for]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class UI::SelectionBarTest < ViewComponent::TestCase
|
|
6
|
+
def setup_fixtures(*); end
|
|
7
|
+
def teardown_fixtures(*); end
|
|
8
|
+
|
|
9
|
+
def test_starts_hidden_and_watches_the_list_it_names
|
|
10
|
+
render_inline(UI::SelectionBar.new(for: "customers"))
|
|
11
|
+
bar = page.find("[data-slot=selection-bar][role=region][aria-label='Selection']", visible: :all)
|
|
12
|
+
assert bar[:hidden]
|
|
13
|
+
assert_equal "ui--selection-bar", bar[:"data-controller"]
|
|
14
|
+
assert_equal "customers", bar[:"data-ui--selection-bar-for-value"]
|
|
15
|
+
assert_equal "%{count} selected", bar[:"data-ui--selection-bar-other-value"]
|
|
16
|
+
assert_includes bar[:class], "sticky"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_clear_button_and_live_count
|
|
20
|
+
render_inline(UI::SelectionBar.new(for: "photos"))
|
|
21
|
+
assert_selector "button[aria-label='Clear selection'][data-action='ui--selection-bar#clear'] svg[data-icon='x']", visible: :all
|
|
22
|
+
assert_selector "p[aria-live=polite][data-ui--selection-bar-target=count]", visible: :all
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_actions_and_placement
|
|
26
|
+
render_inline(UI::SelectionBar.new(for: "photos", placement: :floating, label: "Chosen photos", class: "bottom-8")) do |bar|
|
|
27
|
+
bar.with_action { "<button>Archive</button>".html_safe }
|
|
28
|
+
bar.with_action { "<button>Delete</button>".html_safe }
|
|
29
|
+
end
|
|
30
|
+
bar = page.find("[data-slot=selection-bar]", visible: :all)
|
|
31
|
+
assert_equal "Chosen photos", bar[:"aria-label"]
|
|
32
|
+
assert_equal "floating", bar[:"data-placement"]
|
|
33
|
+
assert_includes bar[:class], "rounded-full"
|
|
34
|
+
assert_includes bar[:class], "bottom-8"
|
|
35
|
+
assert_equal %w[Archive Delete], bar.all("div button", visible: :all).map { |b| b.text(:all) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_checkbox_for_any_list
|
|
39
|
+
render_inline(UI::SelectionBar.checkbox(:item, name: "ids[]", value: "cat-2", form: "selection", label: "Select Curled up", class: "rounded-full"))
|
|
40
|
+
box = page.find("input[type=checkbox]")
|
|
41
|
+
assert_equal "item", box[:"data-selection"]
|
|
42
|
+
assert_equal "selection", box[:form]
|
|
43
|
+
assert_equal "Select Curled up", box[:"aria-label"]
|
|
44
|
+
assert_includes box[:class], "rounded-full"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -23,6 +23,15 @@ class UI::Sidebar::MenuButtonTest < ViewComponent::TestCase
|
|
|
23
23
|
assert_includes classes, "hover:bg-sidebar-accent"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
def test_pill_shape_fills_the_current_page
|
|
27
|
+
render_inline(UI::Sidebar::MenuButton.new("#", active: true, shape: :pill)) { "Photos" }
|
|
28
|
+
link = page.find("a", text: "Photos")
|
|
29
|
+
assert_equal "pill", link[:"data-shape"]
|
|
30
|
+
assert_includes link[:class], "rounded-full"
|
|
31
|
+
assert_includes link[:class], "h-10"
|
|
32
|
+
refute_includes link[:class].split, "bg-accent"
|
|
33
|
+
end
|
|
34
|
+
|
|
26
35
|
def test_allows_aria_current
|
|
27
36
|
render_inline(UI::Sidebar::MenuButton.new("#", current: "page")) { "Dashboard" }
|
|
28
37
|
link = page.find("a", text: "Dashboard")
|
|
@@ -26,7 +26,69 @@ class UI::SidebarTest < ViewComponent::TestCase
|
|
|
26
26
|
render_sidebar
|
|
27
27
|
aside = page.find("aside[data-ui--sidebar-target='sidebar']")
|
|
28
28
|
assert_equal "expanded", aside[:"data-state"]
|
|
29
|
-
|
|
29
|
+
# Empty while open: the collapsed styles hang off "icon" and "offcanvas".
|
|
30
|
+
assert_equal "", aside[:"data-collapsible"]
|
|
31
|
+
assert_equal "icon", aside[:"data-collapsible-mode"]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_collapsed_says_how
|
|
35
|
+
render_sidebar(collapsible: :offcanvas, state: :collapsed)
|
|
36
|
+
aside = page.find("aside")
|
|
37
|
+
assert_equal "collapsed", aside[:"data-state"]
|
|
38
|
+
assert_equal "offcanvas", aside[:"data-collapsible"]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_a_sidebar_that_cannot_collapse_stays_open
|
|
42
|
+
render_sidebar(collapsible: :none, state: :collapsed)
|
|
43
|
+
assert_equal "expanded", page.find("aside")[:"data-state"]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_starts_as_the_reader_last_left_it
|
|
47
|
+
vc_test_request.set_header("HTTP_COOKIE", "ui_sidebar_main_sidebar=collapsed")
|
|
48
|
+
render_sidebar(id: "main-sidebar")
|
|
49
|
+
aside = page.find("aside#main-sidebar")
|
|
50
|
+
assert_equal "collapsed", aside[:"data-state"]
|
|
51
|
+
assert_equal "ui_sidebar_main_sidebar", aside[:"data-cookie"]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_a_drawer_with_a_backdrop_on_phones
|
|
55
|
+
render_sidebar
|
|
56
|
+
assert_selector "[data-slot=sidebar-backdrop][data-action='click->ui--sidebar#close']", visible: :all
|
|
57
|
+
container = page.find("[data-slot=sidebar-container]")
|
|
58
|
+
assert_includes container[:class], "group-data-[mobile=open]:translate-x-0"
|
|
59
|
+
assert_includes container[:class], "md:sticky"
|
|
60
|
+
assert_includes container[:class], "md:max-h-full"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_sub_menu_opens_for_its_current_page
|
|
64
|
+
render_inline(UI::Sidebar.new) do |sidebar|
|
|
65
|
+
sidebar.with_sidebar_content do |content|
|
|
66
|
+
content.with_sidebar_group do |group|
|
|
67
|
+
group.with_menu do |menu|
|
|
68
|
+
menu.with_menu_item do |item|
|
|
69
|
+
item.with_menu_button("/albums", shape: :pill) { "Albums" }
|
|
70
|
+
item.with_sub_menu(name: "Albums") do |sub|
|
|
71
|
+
sub.with_item("/albums/1") { "Coast" }
|
|
72
|
+
sub.with_item("/albums/2", active: true) { "Garden" }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
menu.with_menu_item do |item|
|
|
76
|
+
item.with_menu_button("/places") { "Places" }
|
|
77
|
+
item.with_sub_menu(name: "Places") { |sub| sub.with_item("/places/1") { "Lisbon" } }
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
toggles = page.all("button[data-action='ui--sidebar#toggleSub']")
|
|
85
|
+
assert_equal %w[true false], toggles.map { |toggle| toggle[:"aria-expanded"] }
|
|
86
|
+
assert_equal "Show the links under Albums", toggles.first[:"aria-label"]
|
|
87
|
+
albums = page.find("ul##{toggles.first[:"aria-controls"]}")
|
|
88
|
+
assert_selector "a[href='/albums/2'][aria-current=page]", text: "Garden"
|
|
89
|
+
assert_nil albums[:hidden]
|
|
90
|
+
assert page.find("ul##{toggles.last[:"aria-controls"]}", visible: :all)[:hidden]
|
|
91
|
+
assert_selector "a[data-shape=pill]", text: "Albums"
|
|
30
92
|
end
|
|
31
93
|
|
|
32
94
|
def test_custom_id_preserved
|
|
@@ -40,4 +102,20 @@ class UI::SidebarTest < ViewComponent::TestCase
|
|
|
40
102
|
assert_includes classes, "custom-sidebar"
|
|
41
103
|
assert_includes classes, "peer"
|
|
42
104
|
end
|
|
105
|
+
|
|
106
|
+
def test_inset_classes_replace_the_ones_they_clash_with
|
|
107
|
+
render_inline(UI::Sidebar::Inset.new(class: "bg-transparent md:peer-data-[variant=inset]:shadow-none")) { "Main" }
|
|
108
|
+
classes = page.find("main")[:class].split
|
|
109
|
+
assert_includes classes, "bg-transparent"
|
|
110
|
+
refute_includes classes, "bg-background"
|
|
111
|
+
refute_includes classes, "md:peer-data-[variant=inset]:shadow-sm"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# An inset or floating sidebar pads its panel, so collapsed it's that much wider.
|
|
115
|
+
def test_a_padded_sidebar_keeps_room_for_its_icons_when_collapsed
|
|
116
|
+
render_sidebar(variant: :inset, state: :collapsed)
|
|
117
|
+
assert_includes page.find("aside")[:class], "md:data-[variant=inset]:data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]"
|
|
118
|
+
assert_includes page.find("[data-slot=sidebar-container]")[:class],
|
|
119
|
+
"md:group-data-[variant=inset]:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]"
|
|
120
|
+
end
|
|
43
121
|
end
|