Sha256: 2a5a40896a866b36d83ee395650ce1d24db6efa6d78e12095c30b81064738a91
Contents?: true
Size: 558 Bytes
Versions: 194
Compression:
Stored size: 558 Bytes
Contents
# frozen_string_literal: true module Primer # Module to allow components to deal with the `test_selector` argument. # It will only add the selector if env is not Production. # # test_selector: "foo" => data-test-selector="foo" module TestSelectorHelper TEST_SELECTOR_TAG = :test_selector def add_test_selector(args) if args.key?(TEST_SELECTOR_TAG) && !Rails.env.production? args[:data] ||= {} args[:data][TEST_SELECTOR_TAG] = args[TEST_SELECTOR_TAG] end args.except(TEST_SELECTOR_TAG) end end end
Version data entries
194 entries across 194 versions & 2 rubygems