Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q&Aを削除する際に表示する確認ダイアログの文言を変更 #4981

Merged
merged 3 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/javascript/question-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
// - 確認ダイアログとDELETE methodのリンクを実装する
a.js-delete.card-main-actions__muted-action(
:href='`/questions/${question.id}`',
data-confirm='本当によろしいですか?',
data-confirm='自己解決した場合は削除せずに回答を書き込んでください。本当に削除しますか?',
data-method='delete'
)
| 削除する
Expand Down
6 changes: 6 additions & 0 deletions test/system/questions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,10 @@ class QuestionsTest < ApplicationSystemTestCase
end
assert_link 'Linuxのファイル操作の基礎を覚える'
end

test 'show confirm dialog before delete' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これってassertがひとつもないような感じなのですが、それだとチェックになってないかもです〜

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほどです。
私もassertが0なのは気になったのですが、確認ダイアログが空文字だったり、文言が異なっていると下記のようにエラーでテストが落ちるので、dismiss_confirmでテスト出来ていると考えたのですが、assertを使ったテストの方が良いでしょうか。

スクリーンショット 2022-06-16 11 51 57

スクリーンショット 2022-06-16 11 52 55

visit_with_auth question_path(questions(:question8)), 'kimura'
confirm_dialog = dismiss_confirm { click_link '削除する' }
assert_equal '自己解決した場合は削除せずに回答を書き込んでください。本当に削除しますか?', confirm_dialog
end
end