Skip to content

Commit

Permalink
FIX: ensures ctrl+enter from textarea saves (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux authored Apr 24, 2024
1 parent 5a67a3e commit cbf3f3a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export default class EditTopicAssignments extends Component {
<template>
<DModal class="assign" @title={{this.title}} @closeModal={{@closeModal}}>
<:body>
<TopicAssignments @assignments={{this.assignments}} />
<TopicAssignments
@assignments={{this.assignments}}
@onSubmit={{this.submit}}
/>
</:body>
<:footer>
<DButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class TopicAssignments extends Component {
</div>
<Assignment
@assignment={{this.selectedAssignment}}
@onSubmit={{this.submit}}
@onSubmit={{this.args.onSubmit}}

Check failure on line 44 in assets/javascripts/discourse/components/topic-assignments.gjs

View workflow job for this annotation

GitHub Actions / ci / linting

Component templates should avoid "this.args.onSubmit" usage, try "@onsubmit" instead.
@showValidationErrors={{false}}
/>
</template>
Expand Down
14 changes: 14 additions & 0 deletions spec/system/assign_topic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
expect(page).to have_no_css("#topic .assigned-to")
end

it "can submit form with shortcut from texatea" do
visit "/t/#{topic.id}"

topic_page.click_assign_topic
assign_modal.assignee = staff_user

find("body").send_keys(:tab)
find("body").send_keys(:control, :enter)

expect(assign_modal).to be_closed
expect(topic_page).to have_assigned(user: staff_user, at_post: 2)
expect(find("#topic .assigned-to")).to have_content(staff_user.username)
end

context "when assigns are not public" do
before { SiteSetting.assigns_public = false }

Expand Down

0 comments on commit cbf3f3a

Please sign in to comment.