2012-09-10 11:35:03 -04:00
|
|
|
module SharedNote
|
|
|
|
include Spinach::DSL
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I delete a comment' do
|
2013-04-11 03:45:18 -04:00
|
|
|
find('.note').hover
|
|
|
|
find(".js-note-delete").click
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I haven\'t written any comment text' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
fill_in "note[note]", with: ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I leave a comment like "XML attached"' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
fill_in "note[note]", with: "XML attached"
|
|
|
|
click_button "Add Comment"
|
2013-01-15 06:37:20 -05:00
|
|
|
sleep 0.05
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I preview a comment text like "Bug fixed :smile:"' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
fill_in "note[note]", with: "Bug fixed :smile:"
|
|
|
|
find(".js-note-preview-button").trigger("click")
|
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I submit the comment' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
click_button "Add Comment"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I write a comment like "Nice"' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
fill_in "note[note]", with: "Nice"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see a comment saying "XML attached"' do
|
2013-01-14 17:55:02 -05:00
|
|
|
page.should_not have_css(".note")
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the cancel comment button' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
should_not have_link("Cancel")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the comment preview' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_css(".js-note-preview", visible: false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the comment preview button' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_css(".js-note-preview-button", visible: false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the comment text field' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_css(".js-note-text", visible: false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see a comment saying "XML attached"' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".note") do
|
|
|
|
page.should have_content("XML attached")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see an empty comment text field' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_field("note[note]", with: "")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the comment edit button' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
2014-05-24 07:41:13 -04:00
|
|
|
page.should have_css(".js-note-write-button", visible: true)
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the comment preview' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_css(".js-note-preview", visible: true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the comment preview button' do
|
2013-01-14 17:55:02 -05:00
|
|
|
within(".js-main-target-form") do
|
|
|
|
page.should have_css(".js-note-preview-button", visible: true)
|
|
|
|
end
|
|
|
|
end
|
2013-03-19 11:53:21 -04:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see comment "XML attached"' do
|
2013-03-19 11:53:21 -04:00
|
|
|
within(".note") do
|
|
|
|
page.should have_content("XML attached")
|
|
|
|
end
|
|
|
|
end
|
2014-02-04 02:48:33 -05:00
|
|
|
|
|
|
|
# Markdown
|
|
|
|
|
|
|
|
step 'I leave a comment with a header containing "Comment with a header"' do
|
|
|
|
within(".js-main-target-form") do
|
|
|
|
fill_in "note[note]", with: "# Comment with a header"
|
|
|
|
click_button "Add Comment"
|
|
|
|
sleep 0.05
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'The comment with the header should not have an ID' do
|
|
|
|
within(".note-text") do
|
|
|
|
page.should have_content("Comment with a header")
|
|
|
|
page.should_not have_css("#comment-with-a-header")
|
|
|
|
end
|
|
|
|
end
|
2014-10-06 02:59:03 -04:00
|
|
|
|
|
|
|
step 'I leave a comment with task markdown' do
|
|
|
|
within('.js-main-target-form') do
|
|
|
|
fill_in 'note[note]', with: '* [x] Task item'
|
|
|
|
click_button 'Add Comment'
|
|
|
|
sleep 0.05
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see task checkboxes in the comment' do
|
|
|
|
expect(page).not_to have_selector(
|
|
|
|
'li.note div.timeline-content input[type="checkbox"]'
|
|
|
|
)
|
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|