[Rt-commit] rt branch, 4.2/per-user-dashboards-in-menu, updated. rt-3.9.7-1231-gba9337b

? sunnavy sunnavy at bestpractical.com
Mon Jan 31 02:43:33 EST 2011


The branch, 4.2/per-user-dashboards-in-menu has been updated
       via  ba9337ba9bce3ca0a59c447945cc3a4a9516efde (commit)
       via  efe06c9210d8c7610525baf9569d737716a632a3 (commit)
      from  418f61c4a62d0c4cb69e7949579e64b43c337deb (commit)

Summary of changes:
 share/html/Prefs/DashboardsInMenu.html |    4 +-
 t/web/dashboards-in-menu.t             |   85 ++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 t/web/dashboards-in-menu.t

- Log -----------------------------------------------------------------
commit efe06c9210d8c7610525baf9569d737716a632a3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jan 31 15:39:20 2011 +0800

    make words consistent

diff --git a/share/html/Prefs/DashboardsInMenu.html b/share/html/Prefs/DashboardsInMenu.html
index a9b6f9f..3bdebae 100644
--- a/share/html/Prefs/DashboardsInMenu.html
+++ b/share/html/Prefs/DashboardsInMenu.html
@@ -96,14 +96,14 @@ my @dashboards = map { [$_->id, $_->Name] } $m->comp("/Dashboards/Elements/ListO
 my @panes = $m->comp(
     '/Admin/Elements/ConfigureDashboardsInMenu',
     Action => 'DashboardsInMenu.html',
-    panes => ['dashboards in menu'],
+    panes => ['dashboards_in_menu'],
     items => \@dashboards,
     current_portlets => $session{'dashboards_in_menu'},
     OnSave => sub {
         my ( $conf ) = @_;
         my ( $ok, $msg ) =
           $user->SetPreferences( 'DashboardsInMenu', $conf );
-        push @results, $ok ? loc('Preferences saved for dashboards_in_menu.') : $msg;
+        push @results, $ok ? loc('Preferences saved for dashboards in menu.') : $msg;
         delete $session{'dashboards_in_menu'};
     }
 );

commit ba9337ba9bce3ca0a59c447945cc3a4a9516efde
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jan 31 15:43:01 2011 +0800

    dashboards-in-menu test

diff --git a/t/web/dashboards-in-menu.t b/t/web/dashboards-in-menu.t
new file mode 100644
index 0000000..d33c31c
--- /dev/null
+++ b/t/web/dashboards-in-menu.t
@@ -0,0 +1,85 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 31;
+my ($baseurl, $m) = RT::Test->started_ok;
+
+my $system_foo = RT::Dashboard->new($RT::SystemUser);
+$system_foo->Save(
+    Name    => 'system foo',
+    Privacy => 'RT::System-' . $RT::System->id,
+);
+
+my $system_bar = RT::Dashboard->new($RT::SystemUser);
+$system_bar->Save(
+    Name    => 'system bar',
+    Privacy => 'RT::System-' . $RT::System->id,
+);
+
+ok( $m->login(), "logged in" );
+
+diag "global setting";
+# in case "RT at a glance" contains dashboards stuff.
+$m->get_ok( $baseurl . "/Search/Simple.html" );
+ok( !$m->find_link( text => 'system foo' ), 'no system foo link' );
+$m->get_ok( $baseurl."/Admin/Global/DashboardsInMenu.html");
+
+my $form_name = 'SelectionBox-dashboards_in_menu';
+$m->form_name($form_name);
+
+$m->field('dashboards_in_menu-Available' => [$system_foo->id],);
+$m->click_button(name => 'add');
+$m->content_contains('Global dashboards in menu saved.', 'saved');
+
+$m->logout;
+ok( $m->login(), "relogged in" );
+
+$m->get_ok( $baseurl . "/Search/Simple.html" );
+$m->follow_link_ok( { text => 'system foo' }, 'follow system foo link' );
+$m->title_is( 'Dashboard system foo', 'got system foo dashboard page' );
+
+diag "setting in admin users";
+my $root = RT::CurrentUser->new( $RT::SystemUser );
+ok( $root->Load('root') );
+my $self_foo = RT::Dashboard->new($root);
+$self_foo->Save( Name => 'self foo', Privacy => 'RT::User-' . $root->id );
+my $self_bar = RT::Dashboard->new($root);
+$self_bar->Save( Name => 'self bar', Privacy => 'RT::User-' . $root->id );
+
+ok( !$m->find_link( text => 'self foo' ), 'no self foo link' );
+$m->get_ok( $baseurl."/Admin/Users/DashboardsInMenu.html?id=" . $root->id);
+$m->form_name($form_name);
+$m->field('dashboards_in_menu-Available' => [$self_foo->id]);
+$m->click_button(name => 'add');
+$m->content_contains( 'Preferences saved for dashboards in menu.',
+    'prefs saved' );
+$m->form_name($form_name);
+$m->field('dashboards_in_menu-Selected' => [$system_foo->id]);
+$m->content_contains( 'Preferences saved for dashboards in menu.',
+    'prefs saved' );
+$m->click_button(name => 'remove');
+
+$m->logout;
+ok( $m->login(), "relogged in" );
+$m->get_ok( $baseurl . "/Search/Simple.html" );
+ok( !$m->find_link( text => 'system foo' ), 'no system foo link' );
+$m->follow_link_ok( { text => 'self foo' }, 'follow self foo link' );
+$m->title_is( 'Dashboard self foo', 'got self foo dashboard page' );
+
+diag "setting in prefs";
+$m->get_ok( $baseurl."/Prefs/DashboardsInMenu.html");
+$m->form_name($form_name);
+$m->field('dashboards_in_menu-Available' => [$self_bar->id]);
+$m->click_button(name => 'add');
+$m->content_contains( 'Preferences saved for dashboards in menu.',
+    'prefs saved' );
+$m->follow_link_ok( { text => 'self bar' }, 'follow self bar link' );
+$m->title_is( 'Dashboard self bar', 'got self bar dashboard page' );
+$m->get_ok( $baseurl."/Prefs/DashboardsInMenu.html");
+$m->form_with_fields('Reset');
+$m->click;
+$m->content_contains( 'Preferences saved', 'prefs saved' );
+ok( $m->find_link( text => 'system foo' ), 'got system foo link' );
+ok( !$m->find_link( text => 'self foo' ), 'no self foo link' );
+ok( !$m->find_link( text => 'self bar' ), 'no self bar link' );
+

-----------------------------------------------------------------------


More information about the Rt-commit mailing list