Commit 2f17715c authored by alexpott's avatar alexpott

Issue #1530774 by lokapujya, jenlampton, Cottser, svdhout, alexrayu, hpz:...

Issue #1530774 by lokapujya, jenlampton, Cottser, svdhout, alexrayu, hpz: Fixed Test coverage for adding classes into region template.
parent 67c8a34c
......@@ -278,4 +278,17 @@ function testPreprocessHtml() {
$this->assertText('theme test page bottom markup', 'Modules are able to set the page bottom region.');
}
/**
* Tests that region attributes can be manipulated via preprocess functions.
*/
function testRegionClass() {
\Drupal::moduleHandler()->install(array('block', 'theme_region_test'));
// Place a block.
$this->drupalPlaceBlock('system_main_block');
$this->drupalGet('');
$elements = $this->cssSelect(".region-sidebar-first.new_class");
$this->assertEqual(count($elements), 1, 'New class found.');
}
}
name: 'Theme region test'
type: module
description: 'Provides hook implementations for testing regions.'
package: Testing
version: VERSION
core: 8.x
<?php
/**
* @file
* Provides hook implementations for testing purposes.
*/
/**
* Implements hook_preprocess_HOOK() for region templates.
*/
function theme_region_test_preprocess_region(&$variables) {
if ($variables['region'] == 'sidebar_first') {
$variables['attributes']['class'][] = 'new_class';
}
}
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