Let page.load proceed when zoomed out, disabling submit

Note that addNoteButton.hasClass("active") check in page.load is useless because page.unload removes this class.
This commit is contained in:
Anton Khorev 2024-12-26 00:43:40 +03:00
parent 17ab002c04
commit feb7af2020
4 changed files with 78 additions and 11 deletions

View file

@ -15,6 +15,60 @@ class CreateNoteTest < ApplicationSystemTestCase
end
end
test "cannot create new note when zoomed out" do
visit new_note_path(:anchor => "map=12/0/0")
within_sidebar do
assert_no_content "Zoom in to add a note"
assert_button "Add Note", :disabled => true
fill_in "text", :with => "Some newly added note description"
assert_no_content "Zoom in to add a note"
assert_button "Add Note", :disabled => false
end
find(".control-button.zoomout").click
within_sidebar do
assert_content "Zoom in to add a note"
assert_button "Add Note", :disabled => true
end
find(".control-button.zoomin").click
within_sidebar do
assert_no_content "Zoom in to add a note"
assert_button "Add Note", :disabled => false
click_on "Add Note"
assert_content "Unresolved note ##{Note.last.id}"
assert_content "Some newly added note description"
end
end
test "can open new note page when zoomed out" do
visit new_note_path(:anchor => "map=11/0/0")
within_sidebar do
assert_content "Zoom in to add a note"
assert_button "Add Note", :disabled => true
fill_in "text", :with => "Some newly added note description"
assert_content "Zoom in to add a note"
assert_button "Add Note", :disabled => true
end
find(".control-button.zoomin").click
within_sidebar do
assert_no_content "Zoom in to add a note"
assert_button "Add Note", :disabled => false
end
end
test "cannot create note when api is readonly" do
with_settings(:status => "api_readonly") do
visit new_note_path(:anchor => "map=18/0/0")