Skip to content

Commit 30fb530

Browse files
committed
modify test
1 parent e396f4d commit 30fb530

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,3 @@ end
209209
# =============================================================================
210210
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
211211
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
212-
213-
gem "avo-icons", "~> 0.1.2"

Gemfile.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ DEPENDENCIES
817817
annotate
818818
appraisal
819819
avo!
820-
avo-icons (~> 0.1.2)
821820
avo-money_field
822821
avo-record_link_field
823822
aws-sdk-s3

spec/features/avo/action_icon_and_divider_spec.rb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
require "rails_helper"
22

33
RSpec.describe "action icon and divider", type: :feature do
4+
def icon_path_fragment(icon_filename, take: 20)
5+
pathname = Avo::Icons::SvgFinder.find_asset("#{icon_filename}.svg").pathname
6+
svg = File.read(pathname)
7+
8+
# Grab the first real icon <path> (skip the "stroke='none'" reset path).
9+
d_values = svg.scan(/\sd="([^"]+)"/).flatten
10+
d = d_values.find { |value| !value.start_with?("M0 0h24v24H0z") } || d_values.first
11+
12+
d.to_s[0, take]
13+
end
14+
415
describe "icon and divider" do
516
it "Viewing actions with icon and divider" do
617
visit "admin/resources/users"
718

819
expect(page).to have_css("button[data-action='click->toggle#togglePanel']")
920

10-
# Stroke caps live on the root <svg>, not on each <path> — match by path data only.
11-
expect(page).to have_css("path[d*='M20 8h-2a2']", visible: false) # Tabler world-map (ToggleInactive action)
12-
expect(page).to have_css("path[d*='M5 12l6 6']", visible: false) # Tabler arrow-left (DownloadFile action)
21+
world_map_d = icon_path_fragment("tabler/outline/world-map")
22+
arrow_left_d = icon_path_fragment("tabler/outline/arrow-left")
23+
24+
click_on "Actions"
25+
26+
# Assert the rendered icon uses the same SVG paths as our icon pack (avo-icons).
27+
expect(page).to have_css("path[d*='#{world_map_d}']", visible: false)
28+
expect(page).to have_css("path[d*='#{arrow_left_d}']", visible: false)
29+
1330
expect(page).to have_css("[data-component-name='avo/divider_component']", visible: false)
1431
end
1532
end

0 commit comments

Comments
 (0)