test/components/forms/checkbox_test.rb in express_templates-0.9.8 vs test/components/forms/checkbox_test.rb in express_templates-0.10.1
- old
+ new
@@ -1,14 +1,27 @@
require 'test_helper'
+class Account
+end
+
class CheckboxTest < ActiveSupport::TestCase
+
def assigns
- {resource: resource}
+ {account: resource}
end
+ def helpers
+ mock_action_view do
+ def accounts_path
+ '/accounts'
+ end
+ end
+ end
+
+
test "checkbox places the label before the input" do
- html = arbre {
+ html = arbre(account: resource) {
express_form(:account) {
checkbox :eula
}
}
label = '<label for="account_eula"'
@@ -19,10 +32,10 @@
field_idx = html.index(field.gsub('\\', ''))
assert (field_idx > label_idx), "label must come first"
end
test "checkbox respects label_after: true " do
- html = arbre {
+ html = arbre(account: resource) {
express_form(:account) {
checkbox :eula, label_after: true
}
}
label = '<label for="account_eula"'