1 require "application_system_test_case"
3 class CreateNoteTest < ApplicationSystemTestCase
4 test "can create note" do
5 visit new_note_path(:anchor => "map=18/0/0")
8 assert_button "Add Note", :disabled => true
10 fill_in "text", :with => "Some newly added note description"
13 assert_content "Unresolved note ##{Note.last.id}"
14 assert_content "Some newly added note description"
18 test "cannot create new note when zoomed out" do
19 visit new_note_path(:anchor => "map=12/0/0")
22 assert_no_content "Zoom in to add a note"
23 assert_button "Add Note", :disabled => true
25 fill_in "text", :with => "Some newly added note description"
27 assert_no_content "Zoom in to add a note"
28 assert_button "Add Note", :disabled => false
31 find(".control-button.zoomout").click
34 assert_content "Zoom in to add a note"
35 assert_button "Add Note", :disabled => true
38 find(".control-button.zoomin").click
41 assert_no_content "Zoom in to add a note"
42 assert_button "Add Note", :disabled => false
46 assert_content "Unresolved note ##{Note.last.id}"
47 assert_content "Some newly added note description"
51 test "can open new note page when zoomed out" do
52 visit new_note_path(:anchor => "map=11/0/0")
55 assert_content "Zoom in to add a note"
56 assert_button "Add Note", :disabled => true
58 fill_in "text", :with => "Some newly added note description"
60 assert_content "Zoom in to add a note"
61 assert_button "Add Note", :disabled => true
64 find(".control-button.zoomin").click
67 assert_no_content "Zoom in to add a note"
68 assert_button "Add Note", :disabled => false
72 test "cannot create note when api is readonly" do
73 with_settings(:status => "api_readonly") do
74 visit new_note_path(:anchor => "map=18/0/0")
77 assert_no_button "Add Note", :disabled => true