View Source HTMLTestIdentifiers (html_test_identifiers v0.2.2)

Provides the basic functionality to add data-testid attribute depending on configuration.

configuration

Configuration

Add the following to your config files if you want data-testid included in your release :

config :html_test_identifiers, provider: HTMLTestIdentifiers.TestID

Add the following to your config files if you don't want data_testid attribute to be included in your release :

config :html_test_identifiers, provider: HTMLTestIdentifiers.NoTestID

If there is no configuration, HTMLTestIdentifiers.NoTestID will be used by default

examples

Examples

with `config :html_test_identifiers, provider: HTMLTestIdentifiers.TestID`

HTMLTestIdentifiers.testid_attribute("hello")
# =>  %{"data-testid" => "hello"}

HTMLTestIdentifiers.testid_key("hello")
# => "hello"

with `config :html_test_identifiers, provider: HTMLTestIdentifiers.NoTestID`

HTMLTestIdentifiers.testid_attribute("hello")
# => nil

HTMLTestIdentifiers.testid_key("hello")
# => nil

Link to this section Summary

Link to this section Functions