refactor sidebar and finish migration of notes

This commit is contained in:
Reinier Balt 2010-11-24 22:01:23 +01:00
parent 94b5aa2346
commit ea1ca130f1
18 changed files with 138 additions and 97 deletions

View file

@ -63,26 +63,31 @@ Feature: Edit a project
When I try to edit the project name of "manage me" to "test"
Then I should see "Name already exists"
@selenium @wip
@selenium
Scenario: I can go to the note of a project
Given I have a project "test" with 2 note
Given I have a project "test" with 2 notes
When I visit the "test" project
Then I should see 2 notes
When I click on the first note icon
Then I should go to that note page
@selenium @wip
@selenium
Scenario: I can add a note to the project
Given I have a project "test"
Given I have a project called "test"
When I visit the "test" project
And I add a note "hello I'm testing"
Then I should see one note
And I add a note "hello I'm testing" to the project
Then I should see one note in the project
@selenium @wip
@selenium @focus
Scenario: Cancelling adding a note to the project will remove form
Given I have a project called "test"
When I visit the "test" project
And I cancel adding a note to the project
Then the form for adding a note should not be visible
@selenium
Scenario: Long notes in a project are shown cut off
Given I have a project "test"
Given I have a project called "test"
When I visit the "test" project
And I add a note "test 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234 TOO LONG"
And I add a note "test 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234 TOO LONG" to the project
Then I should not see "test 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234 TOO LONG"
And I should see "test 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234"
And I should see "test 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234"

View file

@ -86,7 +86,6 @@ When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_cu
When "I try to edit the project name to \"#{project_new_name}\""
end
When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name|
selenium.click "project_name"
fill_in "value", :with => new_project_name
@ -115,6 +114,42 @@ When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, st
end
end
When /^I add a note "([^"]*)" to the project$/ do |note_body|
click_link "Add a note"
fill_in "note[body]", :with => note_body
click_button "Add note"
end
When /^I click on the first note icon$/ do
@project.should_not be_nil
@note = @project.notes.first # assume first note is also first on screen
@note.should_not be_nil
click_link "link_note_#{@note.id}"
end
When /^I cancel adding a note to the project$/ do
click_link "Add a note"
fill_in "note[body]", :with => "will not save this"
click_link "neg_edit_form_note"
end
Then /^the form for adding a note should not be visible$/ do
wait_for do # wait for the form to go away
!selenium.is_visible("edit_form_note")
end
end
Then /^I should go to that note page$/ do
current_path = URI.parse(current_url).path
note_path = note_path(@note)
current_path.should == note_path
end
Then /^I should see one note in the project$/ do
selenium.wait_for_element("xpath=//div[@class='note_wrapper']")
end
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
xpath="//div[@class='project_description']/p/strong"

View file

@ -118,7 +118,6 @@ When /^I edit the dependency of "([^"]*)" to '([^'']*)'$/ do |todo_name, deps|
fill_in "predecessor_list_todo_#{todo.id}", :with => deps
# submit form
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
end
Then /^there should not be an error$/ do
@ -126,7 +125,6 @@ Then /^there should not be an error$/ do
selenium.is_visible("edit_todo_#{@dep_todo.id}").should == false
end
Then /^the dependencies of "(.*)" should include "(.*)"$/ do |child_name, parent_name|
parent = @current_user.todos.find_by_description(parent_name)
parent.should_not be_nil

View file

@ -47,7 +47,8 @@ module NavigationHelpers
when /the "([^\"]*)" project for user "([^\"]*)"/i
project_path(User.find_by_login($2).projects.find_by_name($1))
when /the "([^\"]*)" project/i
project_path(@current_user.projects.find_by_name($1))
@project = @current_user.projects.find_by_name($1)
project_path(@project)
# Add more mappings here.
# Here is an example that pulls values out of the Regexp: