Skip to content

Usage in App

Matthijs Kuiper edited this page Jul 17, 2017 · 2 revisions

Available functions:

test_selector()
test_selector(name)
test()
test(name)
test(name, value)

Examples:

test_selector()

UserCell.test_selector()
# user-45e6f

UserCell.test_selector("avatar")
# user-45e6f-avatar

test()

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

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

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

These examples have the same result:

<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">

Use with Phoenix HTML helpers:

link to: "#",
     test_selector: test_selector("foo"),
     test_value: "bar"
Clone this wiki locally