Sha256: d3094cf1300c0e4712fa48d6885695a214d2773c905044058f6b1e76be34785b
Contents?: true
Size: 558 Bytes
Versions: 2
Compression:
Stored size: 558 Bytes
Contents
# frozen_string_literal: true module Yattho # 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yattho_view_components-0.1.1 | app/lib/yattho/test_selector_helper.rb |
yattho_view_components-0.0.1 | app/lib/yattho/test_selector_helper.rb |