TestSelector (test_selector v0.3.2) View Source

TestSelector module to import in test files.

Link to this section Summary

Functions

The test function will return both the HTML attribute and it's value.

The test function will return both the HTML attribute and it's value.

Generates a unique code for an HTML element.

Generates a unique code by appending a custom name for an HTML element.

Returns the a hash of the module.

Link to this section Functions

The test function will return both the HTML attribute and it's value.

Examples

iex> UserCell.test()
"test-selector="user-45e6f""

In the user show template:

<a href="#" <%= test() %>>

# results in
<a href="#" test-selector="user-45e6f">
Link to this function

test(name, value \\ nil)

View Source

The test function will return both the HTML attribute and it's value.

Examples

With just a name:

iex> UserCell.test("avatar")
"test-selector="user-45e6f-avatar""

With both a name and value

iex> UserCell.test("id", 13)
"test-selector="user-45e6f-id" test-value="13""

In the user show template:

<a href="#" <%= test("foo") %>>
<a href="#" <%= test("foo", "bar") %>>

<a href="#" test-selector="<%= test_selector("foo") %>">
<a href="#" test-selector="<%= test_selector("foo") %> test-value="bar">

Generates a unique code for an HTML element.

Examples

iex> UserView.test_selector()
"user-45e6f"

Generates a unique code by appending a custom name for an HTML element.

Examples

iex> UserCell.test_selector("avatar")
"user-45e6f-avatar"

Returns the a hash of the module.