
sunnavy at bestpractical
Oct 28, 2009, 5:39 AM
Post #1 of 1
(263 views)
Permalink
|
|
rt branch, 3.8-trunk, updated. rt-3.8.6-48-g0df8fb6
|
|
The branch, 3.8-trunk has been updated via 0df8fb6894d3dfc1cb3d07543ce87f8881df25b2 (commit) via 76d907a69859ad04c172f82acf10e92dc614578f (commit) from 15afb7b20affec5cd0ad59477406c94fefa854d6 (commit) Summary of changes: share/html/Dashboards/Queries.html | 3 +- share/html/Widgets/SelectionBox | 3 + t/web/dashboard_with_deleted_saved_search.t | 90 +++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletions(-) create mode 100644 t/web/dashboard_with_deleted_saved_search.t - Log ----------------------------------------------------------------- commit 76d907a69859ad04c172f82acf10e92dc614578f Author: sunnavy <sunnavy [at] bestpractical> Date: Wed Oct 28 20:37:37 2009 +0800 add t/web/dashboard_with_deleted_saved_search.t diff --git a/t/web/dashboard_with_deleted_saved_search.t b/t/web/dashboard_with_deleted_saved_search.t new file mode 100644 index 0000000..06eadb4 --- /dev/null +++ b/t/web/dashboard_with_deleted_saved_search.t @@ -0,0 +1,90 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use RT::Test tests => 19; +my ( $url, $m ) = RT::Test->started_ok; +ok( $m->login, 'logged in' ); + +# create a saved search +$m->get_ok( $url . "/Search/Build.html?Query=" . 'id=1' ); + +$m->submit_form( + form_name => 'BuildQuery', + fields => { SavedSearchDescription => 'foo', }, + button => 'SavedSearchSave', +); + +my ( $search_uri, $user_id, $search_id ) = + $m->content =~ /value="(RT::User-(\d+)-SavedSearch-(\d+))"/; +$m->submit_form( + form_name => 'BuildQuery', + fields => { SavedSearchLoad => $search_uri }, + button => 'SavedSearchSave', +); + +$m->content_like( qr/name="SavedSearchDelete"\s+value="Delete"/, + 'found Delete button' ); +$m->content_like( + qr/name="SavedSearchDescription"\s+value="foo"/, + 'found Description input with the value filled' +); + +# create a dashboard with the created search + +$m->get_ok( $url . "/Dashboards/Modify.html?Create=1" ); +$m->submit_form( + form_name => 'ModifyDashboard', + fields => { Name => 'bar' }, +); + +$m->content_like( qr/Saved dashboard bar/i, 'dashboard saved' ); +my $dashboard_queries_link = $m->find_link( text_regex => qr/Queries/ ); +my ( $dashboard_id ) = $dashboard_queries_link->url =~ /id=(\d+)/; + +$m->get_ok( $url . "/Dashboards/Queries.html?id=$dashboard_id" ); + +$m->content_lacks( 'value="Update"', 'no update button' ); + +$m->submit_form( + form_name => 'Dashboard-Searches-body', + fields => + { 'Searches-body-Available' => "search-$search_id-RT::User-$user_id" }, + button => 'add', +); + +$m->content_like( qr/Dashboard updated/i, 'added search foo to dashboard bar' ); + +# delete the created search + +$m->get_ok( $url . "/Search/Build.html?Query=" . 'id=1' ); +$m->submit_form( + form_name => 'BuildQuery', + fields => { SavedSearchLoad => $search_uri }, +); +$m->submit_form( + form_name => 'BuildQuery', + button => 'SavedSearchDelete', +); + +$m->content_lacks( $search_uri, 'deleted search foo' ); + +# here is what we really want to test + +$m->get_ok( $url . "/Dashboards/Queries.html?id=$dashboard_id" ); +is( $m->{'status'}, 200, "Loaded /Dashboards/Queries.html" ); +$m->content_like( qr/Deleted queries/i, 'found deleted message' ); + +# Update button shows so we can update the deleted search easily +$m->content_contains( 'value="Update"', 'found update button' ); + +$m->submit_form( + form_name => 'Dashboard-Searches-body', + button => 'update', +); + +$m->content_unlike( qr/Deleted queries/i, 'deleted message is gone' ); +$m->content_lacks( 'value="Update"', 'update button is gone too' ); + +$m->get_warnings; # we'll get a lot of warnings because the deleted search + commit 0df8fb6894d3dfc1cb3d07543ce87f8881df25b2 Author: sunnavy <sunnavy [at] bestpractical> Date: Wed Oct 28 20:39:09 2009 +0800 show Update botton when a dashboard contains deleted searches diff --git a/share/html/Dashboards/Queries.html b/share/html/Dashboards/Queries.html index 2ce092f..df0b44c 100644 --- a/share/html/Dashboards/Queries.html +++ b/share/html/Dashboards/Queries.html @@ -67,7 +67,8 @@ <input type="hidden" class="hidden" name="Privacy" value="<%$Dashboard->Privacy%>" /> <&| /Widgets/TitleBox, title => $pane->{DisplayName} &> - <& /Widgets/SelectionBox:show, self => $pane, nojs => 1 &> + <& /Widgets/SelectionBox:show, self => $pane, nojs => 1, grep( { + lc $_->{pane} eq lc $pane->{DisplayName} } @deleted ) ? ( ShowUpdate => 1 ) : () &> </&> </form> </td></tr> diff --git a/share/html/Widgets/SelectionBox b/share/html/Widgets/SelectionBox index f055b35..7a2e5ad 100644 --- a/share/html/Widgets/SelectionBox +++ b/share/html/Widgets/SelectionBox @@ -220,6 +220,9 @@ selected="selected" % if ($ARGS{'Clear'}) { <input name="clear" type="submit" class="button" value="<&|/l&>Clear</&>" /> % } +% if ( $ARGS{'ShowUpdate'} ) { + <input name="update" type="submit" class="button" value="<&|/l&>Update</&>" /> +% } % } % my $caption = ""; ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|