-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Labels
Description
Description
The generated label for
attribute value does not respect the scope_id_false:
option on TextField
.
Reproduction
include Primer::ComponentTestHelpers
class NoModelScopeForm < ApplicationForm
form do |no_model_scope_form|
no_model_scope_form.text_field(
name: :ultimate_answer,
label: "Ultimate answer",
scope_name_to_model: false,
scope_id_to_model: false,
**(@id ? { id: @id } : {})
)
end
def initialize(id: nil)
@id = id
end
end
model = DeepThought.new(42)
render_in_view_context do
primer_form_with(model: model, url: "/foo") do |f|
render(NoModelScopeForm.new(f))
end
end
puts rendered_content
Expected value
<primer-text-field class="FormControl width-full FormControl--fullWidth">
<label for="ultimate_answer" class="FormControl-label">
Ultimate answer
</label>
<div class="FormControl-input-wrap">
<input name="ultimate_answer" id="ultimate_answer" aria-describedby="validation-8aef820b-8020-427a-a0e4-7fdefa498ac3"
data-target="primer-text-field.inputElement " class="FormControl-input FormControl-medium" type="text" value="42" />
</div>
<!-- ... -->
</primer-text-field>
Actual value
<primer-text-field class="FormControl width-full FormControl--fullWidth">
<label class="FormControl-label" for="deep_thought_ultimate_answer">
Ultimate answer
</label>
<div class="FormControl-input-wrap">
<input name="ultimate_answer" id="ultimate_answer" aria-describedby="validation-e5d33a6f-6e21-4ab2-a6fb-3f09b61f940c"
data-target="primer-text-field.inputElement " class="FormControl-input FormControl-medium" type="text" value="42" />
</div>
<!-- ... -->
</primer-text-field>