Commit 90351aa7 authored by Dries's avatar Dries
Browse files

- Patch #748976 by jpmckinney, David_Rothstein: 'Show/hide descriptions' links no longer work.

parent f2e3917a
...@@ -2703,11 +2703,15 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, ...@@ -2703,11 +2703,15 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL,
} }
/** /**
* Determine if a user is in compact mode. * Determines if the current user is in compact mode.
*
* @return
* TRUE when in compact mode, FALSE when in expanded mode.
*/ */
function system_admin_compact_mode() { function system_admin_compact_mode() {
global $user; // PHP converts dots into underscores in cookie names to avoid problems with
return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode', FALSE); // its parser, so we use a converted cookie name.
return isset($_COOKIE['Drupal_visitor_admin_compact_mode']) ? $_COOKIE['Drupal_visitor_admin_compact_mode'] : variable_get('admin_compact_mode', FALSE);
} }
/** /**
...@@ -2717,8 +2721,7 @@ function system_admin_compact_mode() { ...@@ -2717,8 +2721,7 @@ function system_admin_compact_mode() {
* Valid values are 'on' and 'off'. * Valid values are 'on' and 'off'.
*/ */
function system_admin_compact_page($mode = 'off') { function system_admin_compact_page($mode = 'off') {
global $user; user_cookie_save(array('admin_compact_mode' => ($mode == 'on')), array('admin_compact_mode'));
user_save($user, array('admin_compact_mode' => ($mode == 'on')));
drupal_goto(); drupal_goto();
} }
......
...@@ -1719,7 +1719,7 @@ class ShutdownFunctionsTest extends DrupalWebTestCase { ...@@ -1719,7 +1719,7 @@ class ShutdownFunctionsTest extends DrupalWebTestCase {
} }
/** /**
* Test flood control mechanism clean-up. * Test shutdown functions.
*/ */
function testShutdownFunctions() { function testShutdownFunctions() {
$arg1 = $this->randomName(); $arg1 = $this->randomName();
...@@ -1729,3 +1729,40 @@ class ShutdownFunctionsTest extends DrupalWebTestCase { ...@@ -1729,3 +1729,40 @@ class ShutdownFunctionsTest extends DrupalWebTestCase {
$this->assertText(t('Second shutdown function, arg1 : @arg1, arg2: @arg2', array('@arg1' => $arg1, '@arg2' => $arg2))); $this->assertText(t('Second shutdown function, arg1 : @arg1, arg2: @arg2', array('@arg1' => $arg1, '@arg2' => $arg2)));
} }
} }
/**
* Functional tests compact mode.
*/
class CompactModeTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Compact mode',
'description' => 'Tests compact mode functionality.',
'group' => 'System',
);
}
function setUp() {
$admin_user = $this->drupalCreateUser(array('access administration pages'));
$this->drupalLogin($admin_user);
}
/**
* Test compact mode.
*/
function testCompactMode() {
$this->drupalGet('admin/compact/on');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode turns on.'));
$this->drupalGet('admin/compact/on');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode remains on after a repeat call.'));
$this->drupalGet('');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
$this->drupalGet('admin/compact/off');
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode turns off.'));
$this->drupalGet('admin/compact/off');
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode remains off after a repeat call.'));
$this->drupalGet('');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment