I had previously posted a few patches (991121, 931967,
931310, and 931306) based on version 1.4.
Attached is a zip of source files that I modified (or
created) to achieve the following functionality:
* Support Back and Forward Button Browser functionality
* Support cases where a page contains multiple forms
* Support triggering postbacks from DataGrid
ButtonColumns
*Support DataGrids with paging
* DataListTester and RepeaterTester (this definitely
could have benefited from some abstraction)
I believe these are all functional, but they were a
product of a short time-frame. I'm sure if someone
spent some more time, they could clean them up
significantly.
Hopefully these at least help to give someone a jump
start.
Set of patches by pjaffe
Logged In: NO
Argh. Would be cool if the patches were made with vs.net
2003. We've not made the jump.
Logged In: NO
Never mind. I'm an idiot. Really.
Logged In: YES
user_id=824839
OK... I feel like less of an idiot. I will confess to being lazy,
as witnessed by posting code here instead of sending it in as
a patch. Then again, maybe this code will confirm my idiocy...
It looks to me like when you have a cell in a datagrid that
contains a link column, the cell's contents are parsed as an
empty string. So the original code for ClickColumn didn't work
in this case - it was trying to click an empty string.
My workaround follows. It replaces Tag.Children and so on
with a Regex that looks at Tag.Body. It extracts the url,
then alternately does a Browser.GetPage or a PostBack...
public void ClickColumn(int
columnNumberZeroBased)
{
HtmlTag tag = Tag.Children("td")
[columnNumberZeroBased];
string pattern =@"<A[^>]*?HREF\s*=\s*[""']?([^'""
>]+?)[ '""].*?>";
MatchCollection matchCollection = Regex.Matches
(tag.Body, pattern, RegexOptions.Singleline |
RegexOptions.IgnoreCase);
Assertion.Assert("Attempted to click a cell that
doesn't have an anchor (" + HtmlIdAndDescription + ")",
matchCollection[0].Groups[1].Captures.Count != 0);
Assertion.Assert("Expect sort link to have exactly
one anchor tag", matchCollection[0].Groups
[1].Captures.Count == 1);
string hrefString = matchCollection[0].Groups
[1].Value;
if (IsPostBack(hrefString))
{
PostBack(hrefString);
}
else
{
Browser.GetPage(hrefString);
}
}
Logged In: YES
user_id=499667
Excellent, quality work. I'd like to integrate these
patches but I need a copyright assignment to do so.
Logged In: YES
user_id=824839
This may be me being an idiot again, but if you're referring to
my code snippet in your request for copyright assignment,
then you've got it.... If you're not referring to my stuff, then
consider me appropriately embarassed.
Logged In: YES
user_id=499667
Actually, I was referring to pjaffe's patches, but yours
looks good too :-)
Logged In: YES
user_id=1003735
If this is sufficient, please consider this comment an
assignment of copyright from me (Peter Jaffe or pjaffe) to you
(jlittle82 and/or the NUnit-ASP project).
If that is not sufficient, please let me know how you would
like to go about formalizing the assignment of copyright. I
have no concerns about what I wrote being folded into the
project in any way.
I'm glad that you found this useful, and I look forward to
probably not having to integrate it back in to a future release
of NUnit-ASP. Thanks for continuing to maintain this library.
Logged In: YES
user_id=499667
Thanks, Peter. That's sufficient.