test_selector v0.0.1 TestSelector

Link to this section Summary

Functions

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

Examples

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

Examples

Generates a unique code for an html element

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)

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">
Link to this function test_selector()

Generates a unique code for an html element

Examples

iex(1)> UserView.test_selector()
"user-45e6f"
Link to this function test_selector(name)

Example

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