var form = e.target.form;
if ($(e.target).val() === "") {
- $(form.close).val(I18n.t("javascripts.notes.show.resolve"));
+ $(form.close).val($(form.close).data("defaultActionText"));
$(form.comment).prop("disabled", true);
} else {
- $(form.close).val(I18n.t("javascripts.notes.show.comment_and_resolve"));
+ $(form.close).val($(form.close).data("commentActionText"));
$(form.comment).prop("disabled", false);
}
});
<% if current_user.moderator? -%>
<input type="submit" name="hide" value="<%= t("javascripts.notes.show.hide") %>" class="btn btn-light" data-method="DELETE" data-url="<%= api_note_url(@note, "json") %>">
<% end -%>
- <input type="submit" name="close" value="<%= t("javascripts.notes.show.resolve") %>" class="btn btn-primary" data-method="POST" data-url="<%= close_api_note_url(@note, "json") %>">
+ <input type="submit" name="close" value="<%= t("javascripts.notes.show.resolve") %>" class="btn btn-primary"
+ data-method="POST" data-url="<%= close_api_note_url(@note, "json") %>"
+ data-default-action-text="<%= t("javascripts.notes.show.resolve") %>"
+ data-comment-action-text="<%= t("javascripts.notes.show.comment_and_resolve") %>">
<input type="submit" name="comment" value="<%= t("javascripts.notes.show.comment") %>" class="btn btn-primary" data-method="POST" data-url="<%= comment_api_note_url(@note, "json") %>" disabled="1">
</div>
</form>
--- /dev/null
+require "application_system_test_case"
+
+class NoteCommentsTest < ApplicationSystemTestCase
+ def test_action_text
+ note = create(:note_with_comments)
+ sign_in_as(create(:user))
+ visit note_path(note)
+
+ assert_button "Resolve"
+ assert_button "Comment", :disabled => true
+
+ fill_in "text", :with => "Some text"
+
+ assert_button "Comment & Resolve"
+ assert_button "Comment"
+ end
+end