Skip to content

Commit

Permalink
Update lib/rubocop/cop/rspec/mixin/css_selector.rb
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Quorning <22333+bquorning@users.noreply.github.com>
  • Loading branch information
ydah and bquorning committed Sep 4, 2022
1 parent 2fa8f2a commit ab6b45b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/rubocop/cop/rspec/mixin/css_selector.rb
Expand Up @@ -65,10 +65,8 @@ def pseudo_classes(selector)
# will also be picked up as pseudo classes.
# "a:not([href='http://example.com']):enabled" => "a:not():enabled"
ignored_attribute = selector.gsub(/\[.*?\]/, '')
# "a:not():enabled" => [["not():enabled"]]
pseudo_class = ignored_attribute.scan(/:(.*)/)
# [["not():enabled"]] => ["not()", "enabled"]
pseudo_class.flatten.join.split(':')
# "a:not():enabled" => ["not()", "enabled"]
ignored_attribute.scan(/:([^:]*)/).flatten
end

# @param selector [String]
Expand Down

0 comments on commit ab6b45b

Please sign in to comment.