Skip to content

Commit

Permalink
Merge branch 'master' of github.com:baphled/salad
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed May 11, 2010
2 parents 82b3a4f + bbc331b commit 266a405
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 28 deletions.
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Expand Up @@ -18,4 +18,8 @@ def model_name_to_sym models
def display_item_title item
item.class.to_s.eql?('Story')? item.scenario : item.title
end

def link_to_with_tooltip(link_title, link, tooltip)
link_to link_title.camelize, link, :id => link_title.gsub(' ', '-').downcase, :title => tooltip
end
end
8 changes: 8 additions & 0 deletions app/stylesheets/partials/_tooltip.sass
@@ -0,0 +1,8 @@
.tooltip
:display none
:background transparent url('/images/black_arrow.png')
:font-size 12px
:height 70px
:width 160px
:padding 25px
:color #fff
3 changes: 3 additions & 0 deletions app/stylesheets/screen.sass
Expand Up @@ -13,6 +13,9 @@
// Styles for listing application information
@import partials/lists.sass

// Styles for applications cloud
@import partials/tooltip.sass

// Styles for applications cloud
@import partials/cloud.sass

Expand Down
17 changes: 11 additions & 6 deletions app/views/features/show.html.erb
@@ -1,16 +1,21 @@
<% content_for :js_head do %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
<%= javascript_include_tag "tooltips.js" %>
<%end %>
<%= render :partial => '/common/model_info_and_summary', :locals => {:model => @feature, :assoc => :stories } %>

<span id="panel" class="ui-widget ui-widget-content ui-corner-all">
<% if @feature.is_diff? %>
<%= link_to "view changes", changes_feature_path(@feature) %>
<%= link_to "merge changes", merge_feature_path(@feature) %>
<%= link_to "merge system", system_merge_feature_path(@feature) %>
<%= link_to "patch changes", feature_path(@feature, :format => :patch) %>
<%= link_to_with_tooltip "view changes", changes_feature_path(@feature), :title => 'Check the difference between the systems & your applications features' %>
<%= link_to_with_tooltip "merge changes", merge_feature_path(@feature), :title => 'Merge a systems changes with the feature' %>
<%= link_to_with_tooltip "merge system", system_merge_feature_path(@feature), :title => 'Merge a features changes with the system' %>
<%= link_to_with_tooltip "patch changes", feature_path(@feature, :format => :patch), :title => 'Patch a feature with the systems changes' %>
<% end %>
<% if !@feature.stories.blank? %>
<%= link_to "export feature", export_feature_path(@feature) %>
<%= link_to "export feature", export_feature_path(@feature), :id => 'export-feature', :title => 'Export the feature from the system.' %>
<% end %>
<%= link_to "Edit", edit_feature_path(@feature) %>
<%= link_to "Edit", edit_feature_path(@feature), :id => 'edit', :title => 'Edit the feature and it\'s stories' %>
</span>

<%= render :partial => '/common/sortable_list',:locals => {:models => @feature_stories, :item_name => 'story', :assoc => 'step', :order =>true} %>
Expand Down
7 changes: 6 additions & 1 deletion app/views/features/system_merge.html.erb
Expand Up @@ -2,8 +2,13 @@
<%= stylesheet_link_tag "pretty_diff" %>
<% end %>
<% content_for :js_head do %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
<%= javascript_include_tag "tooltips.js" %>
<%end %>

<span id="panel" class="ui-widget ui-widget-content ui-corner-all">
<%= link_to 'Update', system_sync_feature_path(@feature) %>
<%= link_to_with_tooltip 'Update', system_sync_feature_path(@feature), 'Merge the feature file changes to the system' %>
</span>

<%= render :partial => "legend", :locals => {:diff_from => "system", :diff_to => "system"} %>
Expand Down
11 changes: 8 additions & 3 deletions app/views/projects/show.html.erb
@@ -1,9 +1,14 @@
<% content_for :js_head do %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
<%= javascript_include_tag "tooltips.js" %>
<%end %>
<%= render :partial => '/common/model_info_and_summary', :locals => {:model => @project, :assoc => :features } %>

<span id="panel" class="ui-widget ui-widget-content ui-corner-all">
<%= link_to "Import", import_project_path(@project) unless @project.location.blank? %> |
<%= link_to "Import All", import_all_project_path(@project) unless @project.location.blank? %> |
<%= link_to "Edit project", edit_project_path(@project) %>
<%= link_to_with_tooltip "import", import_project_path(@project), 'Allows you to import features singularly' unless @project.location.blank? %> |
<%= link_to_with_tooltip "import all", import_all_project_path(@project), 'Allows you to import all project features in one easy step' unless @project.location.blank? %> |
<%= link_to_with_tooltip "edit project", edit_project_path(@project), 'Allows you to edit a projects information' %>
</span>

<%= render :partial => '/common/sortable_list',:locals => {:models => @project_features, :item_name => 'feature', :assoc => 'story', :order =>true}%>
Expand Down
8 changes: 6 additions & 2 deletions app/views/steps/show.html.erb
@@ -1,12 +1,16 @@
<% content_for :js_head do %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
<%= javascript_include_tag "tooltips.js" %>
<%end %>

<h4>Step Info</h4>
<div id="info">
<%= render :partial => '/common/model_information', :locals => {:model => @step}%>
<%= render :partial => '/common/model_summary', :locals => {:model => @step}%>
</div>


<span id="panel" class="ui-widget ui-widget-content ui-corner-all">
<%= link_to "Edit project", edit_step_path(@step) %>
<%= link_to_with_tooltip "Edit step", edit_step_path(@step), 'Edit the steps' %>
</span>

<% semantic_form_for @step do |form| -%>
Expand Down
7 changes: 6 additions & 1 deletion app/views/stories/show.html.erb
@@ -1,7 +1,12 @@
<% content_for :js_head do %>
<%= javascript_include_tag "http://cdn.jquerytools.org/1.2.0/all/jquery.tools.min.js" %>
<%= javascript_include_tag "tooltips.js" %>
<%end %>
<%= render :partial => '/common/model_info_and_summary', :locals => {:model => @story, :assoc => :steps } %>

<span id="panel" class="ui-widget ui-widget-content ui-corner-all">
<%= link_to "Edit project", edit_story_path(@story) %>
<%= link_to_with_tooltip "Edit story", edit_story_path(@story), 'Edit the features information' %>
</span>

<div>
Expand Down
67 changes: 67 additions & 0 deletions features/enhanced/panel_tooltip_functionality.feature
@@ -0,0 +1,67 @@
Feature: When hovering over a panel link we want to display a speech bubble tooltip
In order to improve the userability of the panel links
As an user
I want to be given functionality information when hovering over a panel link

Scenario: When hovering over the feature's export link displays a tooltip
Given there is a feature
When I view the feature
Then there should be a "Export feature" link
And I hover over the "export-feature" link
Then a tooltip should be visible

Scenario: When hovering over the feature's edit link displays a tooltip
Given there is a feature
When I view the feature
Then there should be a "Edit" link
And I hover over the "edit" link
Then a tooltip should be visible

Scenario Outline: When hovering over the feature changes displays a tooltip
Given we create a feature with a path
When the feature is viewed
Then there should be a "<link>" link
And I hover over the "<id>" link
Then a tooltip should be visible

Examples: List of feature panel links that should have tool tips
| link | id |
| view changes | view-changes |
| merge changes | merge-changes |
| merge system | merge-system |
| patch changes | patch-changes |

Scenario: When hovering over the feature panel links displays a tooltip
Given we create a feature with a path
When the feature is viewed
When we click on the "Merge system" link
Then there should be a "Update" link
And I hover over the "update" link
Then a tooltip should be visible

Scenario Outline: When hovering over the project panel links displays a tooltip
Given there is a project
When the project is viewed
Then there should be a "Import" link
And I hover over the "import" link
Then a tooltip should be visible

Examples: List of project panel links that should have tool tips
| link | id |
| Import | import |
| Import all | import-all |
| Edit project | edit-project |

Scenario: When hovering over the step panel links displays a tooltip
Given there is a step
When the step is viewed
Then there should be a "Edit step" link
And I hover over the "edit-step" link
Then a tooltip should be visible

Scenario: When hovering over the story panel links displays a tooltip
Given there is a story
When the story is viewed
Then there should be a "Edit story" link
And I hover over the "edit-story" link
Then a tooltip should be visible
2 changes: 1 addition & 1 deletion features/plain/patching_modified_feature_files.feature
Expand Up @@ -9,7 +9,7 @@ Feature: Patching modified feature files
And the feature has a path
When the feature has changed "Something different"
And I view the feature
And a "patch changes" link should be displayed within the feature
And a "Patch changes" link should be displayed within the feature
When we click the features "patch changes"
Then we should display the patch

Expand Down
16 changes: 8 additions & 8 deletions features/plain/updating_features.feature
Expand Up @@ -9,15 +9,15 @@ Feature: We need a way to keep our local feature files in sync with what is on t
And the feature has a path
When the feature has changed "Something different"
And I view the feature
And a "view changes" link should be displayed within the feature
And a "View changes" link should be displayed within the feature

Scenario: An existing features story has changed
Given we have a valid feature file
And the feature file is saved
And the feature has a path
When the feature has changed "Something different"
And I view the feature
When we click the features "view changes"
When we click the features "View changes"
Then we should see the changes to the files
And "Something different" should be highlighted as added

Expand All @@ -33,7 +33,7 @@ Feature: We need a way to keep our local feature files in sync with what is on t
And the feature has a path
When the feature has changed "Something different"
And I view the feature
When we click the features "patch changes"
When we click the features "Patch changes"
Then we should see the changes on the system
When I view the feature
And there should be a link to merge the change
Expand All @@ -44,7 +44,7 @@ Feature: We need a way to keep our local feature files in sync with what is on t
And the feature has a path
When the feature has changed "Something different"
When I view the feature
And we click the features "merge changes"
And we click the features "Merge changes"
Then I should see "Dry-run"

Scenario: We need a way to do a dry-run patch on our feature file
Expand All @@ -53,7 +53,7 @@ Feature: We need a way to keep our local feature files in sync with what is on t
And the feature has a path
When the feature has changed "Something different"
When I view the feature
And we click the features "merge changes"
And we click the features "Merge changes"
And I use the "Dry-run" link
Then the flash message "No errors whilst doing dry-run" should be displayed
And we should be redirected back to "merge"
Expand All @@ -65,15 +65,15 @@ Feature: We need a way to keep our local feature files in sync with what is on t
When the feature has changed "Something different"
And the feature file has changed
And I view the feature
And we click the features "merge changes"
And we click the features "Merge changes"
And I use the "Patch" link
Then the flash message "Feature has been patched" should be displayed

Scenario: We need to be able to update a source file with changes made to a system feature
Given we have a valid feature file
And the local feature file has changed
When view the feature
And we click the features "merge system"
And we click the features "Merge system"
And I use the "Update" link
Then the flash message "The system feature has successfully been updated" should be displayed
And the source file should be identical to the system file
Expand All @@ -83,7 +83,7 @@ Feature: We need a way to keep our local feature files in sync with what is on t
And the feature file is saved
And the local feature file has changed a featutes scenario
When view the feature
And we click the features "merge system"
And we click the features "Merge system"
And I use the "Update" link
Then the flash message "The system feature has successfully been updated" should be displayed
And the source file should be identical to the system file
8 changes: 4 additions & 4 deletions features/step_definitions/features_steps.rb
Expand Up @@ -25,10 +25,6 @@
:i_want => 'to have the skills'
end

When /^I view the feature$/ do
visit feature_path @feature
end

When /^the feature is viewed$/ do
visit feature_path @feature
end
Expand All @@ -37,6 +33,10 @@
visit feature_path(@feature)
end

When /^I view the feature$/ do
visit feature_path(@feature)
end

Then /^the feature information should be saved$/ do
assert_response :success
end
Expand Down
39 changes: 39 additions & 0 deletions features/step_definitions/selenium_steps.rb
@@ -1,3 +1,11 @@
Given /^we edit the feature$/ do
visit edit_feature_path @feature
end

Given /^we create a feature with a path$/ do
@feature = Feature.first
end

When /^the first (.*) is hovered over$/ do |model|
selenium.mouse_over("#{model}_1")
end
Expand All @@ -10,10 +18,33 @@
selenium.click "order_icon"
end

When /^I hover over the "([^\"]*)" link$/ do |link|
selenium.mouse_over("#{link}")
end

When /^I view the changed feature$/ do
visit feature_path @feature
selenium.wait_for_element("view-changes")
end

When /^we click on the "([^\"]*)" link$/ do |link|
click_link link
end

Then /^the project's information will be display in the sidebar$/ do
selenium.wait_for_visible("project_1_features")
end

Given /^we click the edit link$/ do
click_link 'Edit'
end

Given /^we change the feature's title to "([^\"]*)"$/ do |content|
selenium.wait_for_visible("id=feature_title")
fill_in 'feature_title', :with => content
click_button 'Save'
end

Then /^the story's information will be display in the sidebar$/ do
selenium.wait_for_visible("story_1_steps")
end
Expand Down Expand Up @@ -59,3 +90,11 @@
Then /^a flash message "([^\"]*)" should be dynamically displayed$/ do |message|
response.should contain "#{message}"
end

Then /^there should be a "([^\"]*)" link$/ do |link|
response.should contain "#{link}"
end

Then /^a tooltip should be visible$/ do
selenium.wait_for_visible("css=div.tooltip")
end
8 changes: 8 additions & 0 deletions features/step_definitions/steps_steps.rb
Expand Up @@ -2,6 +2,10 @@
Step.create(:title => step)
end

Given /^there is a step$/ do
@step = Step.first
end

When /^I choose 'New Step' link$/ do
click_link 'New Step'
end
Expand All @@ -10,6 +14,10 @@
visit('/steps/1')
end

When /^the step is viewed$/ do
visit step_path @step
end

Then /^the new step form should be displayed$/ do
response.should have_selector :form
end
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/updating_feature_steps.rb
Expand Up @@ -54,7 +54,7 @@
end

When /^there should be a link to merge the change$/ do
response.should contain "merge changes"
response.should contain "Merge changes"
end

When /^we click the "([^\"]*)"$/ do |link|
Expand Down
2 changes: 1 addition & 1 deletion lib/feature_file.rb
Expand Up @@ -31,7 +31,7 @@ def scenarios
elsif line.strip =~ /^(Given|When|Then|And)/ and scenarios.last.nil? == false
str = line.strip
str = line.strip.sub('And', scenarios.last.steps.last.first_word) if line.strip =~ /^And/
scenarios.last.steps << Step.find_or_create_by_title(:title => str) # need to clean this up
scenarios.last.steps << Step.find_or_initialize_by_title(:title => str) # need to clean this up
elsif line.strip =~ /^Examples:/
scenarios.last.examples << Example.new(:heading => line.strip.sub(/^Examples:/, '').strip)
elsif (line.strip =~ /^\|\w*|/ and scenarios.last.nil? == false) and scenarios.last.examples.last.nil? == false
Expand Down
Binary file added public/images/black_arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/javascripts/tooltips.js
@@ -0,0 +1,3 @@
$(document).ready(function() {
$('a[title]').tooltip();
});

0 comments on commit 266a405

Please sign in to comment.