commit 6ec3afc43eaddee2357b9b00183d143f7d3c0b92 Author: MegaChriz Date: Thu Apr 11 09:59:15 2013 +0200 1433034-new_changes diff --git a/templates/uc-addresses-list-address.tpl.php b/templates/uc-addresses-list-address.tpl.php index 7f5b388..9de59a1 100644 --- a/templates/uc-addresses-list-address.tpl.php +++ b/templates/uc-addresses-list-address.tpl.php @@ -41,7 +41,7 @@ * @ingroup themeable */ ?> -
+

@@ -59,7 +59,7 @@ - + diff --git a/tests/uc_addresses.views.test b/tests/uc_addresses.views.test index 0196620..d14982a 100644 --- a/tests/uc_addresses.views.test +++ b/tests/uc_addresses.views.test @@ -946,4 +946,67 @@ class UcAddressesViewsTestCase extends UcAddressesTestCase { return $view; } + + /** + * Tests if the default view works as expected. + */ + public function testDefaultView() { + // Enable the default view. + $view = views_get_view('uc_addresses_address_book'); + $view->disabled = FALSE; + $view->save(); + + // Get addresses for basic user. + $other_user_address_default = UcAddressesAddressBook::get($this->basicUser->uid)->getDefaultAddress(); + $other_user_address_other = UcAddressesAddressBook::get($this->basicUser->uid)->getAddressByName($this->basicUser->uid . '_other'); + + foreach ($this->accounts as $account) { + $this->drupalLogin($account); + $addressBook = UcAddressesAddressBook::get($account->uid); + $default_address = $addressBook->getDefaultAddress(); + $other_address = $addressBook->getAddressByName($account->uid . '_other'); + + // Test if the user can view his/her own address book if he/she + // has access. + $this->viewAddressBook($account, $account->uc_addresses_permissions['view_own_def']); + // Test if the user's default address is displayed when the user + // may view his/her own default addresses. + if ($account->uc_addresses_permissions['view_own_def']) { + $this->assertAddressLabel($default_address); + // Ensure the View is used to display the address book. + $this->assertRaw('view-uc-addresses-address-book'); + } + else { + $this->assertNoAddressLabel($default_address); + } + // Test if the user's other address is displayed when the user + // may view all of his/her own addresses. + if ($account->uc_addresses_permissions['view_own']) { + $this->assertAddressLabel($other_address); + } + else { + $this->assertNoAddressLabel($other_address); + } + + // Test if the user can view other address books if he/she is allowed + // to view them. + $this->viewAddressBook($this->basicUser, $account->uc_addresses_permissions['view_all_def']); + // Test if the other user's default address is displayed when + // the user may view all default addresses. + if ($account->uc_addresses_permissions['view_all_def']) { + $this->assertAddressLabel($other_user_address_default); + } + else { + $this->assertNoAddressLabel($other_user_address_default); + } + // Test if the other user's other address is displayed when + // the user may view all addresses. + if ($account->uc_addresses_permissions['view_all']) { + $this->assertAddressLabel($other_user_address_other); + } + else { + $this->assertNoAddressLabel($other_user_address_other); + } + } + } } diff --git a/uc_addresses.css b/uc_addresses.css index e9ca49c..1a81a9a 100644 --- a/uc_addresses.css +++ b/uc_addresses.css @@ -35,8 +35,8 @@ vertical-align: top; } -.address-book .default-addresses li.address-item .address-item-inner, -.view-uc-addresses-address-book td.address-item .address-item-inner { +.address-book .default-addresses li.address-item .list-address-wrapper, +.view-uc-addresses-address-book td.address-item .list-address-wrapper { background: #FFFFFF; border: 1px solid #CCCCCC; padding: 10px 13px; @@ -63,6 +63,11 @@ /* @group Single address */ .list-address { width: 20em; + border: 0px; +} + +.list-address td { + border: 0px; } .list-address .title-col { diff --git a/views/uc_addresses.views_default.inc b/views/uc_addresses.views_default.inc index 01a1218..0cefa1d 100644 --- a/views/uc_addresses.views_default.inc +++ b/views/uc_addresses.views_default.inc @@ -22,7 +22,7 @@ function uc_addresses_views_default_views() { $view->human_name = 'Address book'; $view->core = 7; $view->api_version = '3.0'; - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + $view->disabled = TRUE; /* Display: Master */ $handler = $view->new_display('default', 'Master', 'default');