<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>stories/context_detail/change_context_name.story</filename>
    </added>
    <added>
      <filename>stories/steps/context_detail.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -10,8 +10,13 @@ module Webrat
       @selenium.open(url)
     end
     
-    def fills_in(label_text, options)
-      @selenium.type(&quot;webrat=#{label_text}&quot;, &quot;#{options[:with]}&quot;)
+    def fills_in(field_identifier, options)
+      locator = if field_identifier == :current
+        &quot;css=:focus&quot;
+      else
+        &quot;webrat=#{Regexp.escape(field_identifier)}&quot;
+      end
+      @selenium.type(locator, &quot;#{options[:with]}&quot;)
     end
     
     def response_body
@@ -25,11 +30,16 @@ module Webrat
       wait_for_result(options[:wait])
     end
 
-   def clicks_link(link_text, options = {})
+    def clicks_link(link_text, options = {})
       @selenium.click(&quot;webratlink=#{link_text}&quot;)
       wait_for_result(options[:wait])
     end
     
+    def clicks_link_within(selector, link_text, options = {})
+      @selenium.click(&quot;webratlinkwithin=#{selector}|#{link_text}&quot;)
+      wait_for_result(options[:wait])
+    end
+
     def wait_for_result(wait_type)
       if wait_type == :ajax
         wait_for_ajax
@@ -55,8 +65,8 @@ module Webrat
     def wait_for_ajax_and_effects
       wait_for_ajax
       wait_for_effects
-    end
-          
+    end    
+    
     def selects(option_text, options = {})
       id_or_name_or_label = options[:from]
       
@@ -130,6 +140,24 @@ module Webrat
         return candidateLinks.first();
       JS
       
+      @selenium.add_location_strategy('webratlinkwithin', &lt;&lt;-JS)
+        var locatorParts = locator.split('|');
+        var cssAncestor = locatorParts[0];
+        var linkText = locatorParts[1];
+        var matchingElements = cssQuery(cssAncestor, inDocument);
+        var candidateLinks = matchingElements.collect(function(ancestor){
+          var links = ancestor.getElementsByTagName('a');
+          return $A(links).select(function(candidateLink) {
+            return PatternMatcher.matches(linkText, getText(candidateLink));
+          });
+        }).flatten().compact();
+        if (candidateLinks.length == 0) {
+          return null;
+        }
+        candidateLinks = candidateLinks.sortBy(function(s) { return s.length * -1; }); //reverse length sort
+        return candidateLinks.first();
+      JS
+      
       @selenium.add_location_strategy('webratselectwithoption', &lt;&lt;-JS)
         var optionElements = inDocument.getElementsByTagName('option');
         var locatedOption = $A(optionElements).find(function(candidate){</diff>
      <filename>vendor/plugins/webrat/lib/webrat/selenium/selenium_session.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6f760c768e800714926e284dd955e2990bb60267</id>
    </parent>
  </parents>
  <author>
    <name>Luke Melia</name>
    <email>luke@lukemelia.com</email>
  </author>
  <url>http://github.com/bsag/tracks/commit/adde38eecba66e627dddee9574f9ceecc4f2dd7d</url>
  <id>adde38eecba66e627dddee9574f9ceecc4f2dd7d</id>
  <committed-date>2008-06-22T21:36:05-07:00</committed-date>
  <authored-date>2008-06-22T21:36:05-07:00</authored-date>
  <message>Move over another ajax test from selenium to stories.</message>
  <tree>99728a7f5044617a554912a0c7ce7fc3ec165f7e</tree>
  <committer>
    <name>Luke Melia</name>
    <email>luke@lukemelia.com</email>
  </committer>
</commit>
