diff options
Diffstat (limited to 'sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test')
-rw-r--r-- | sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test b/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test new file mode 100644 index 000000000..0c0e88254 --- /dev/null +++ b/sites/all/modules/views/tests/styles/views_plugin_style_unformatted.test @@ -0,0 +1,53 @@ +<?php + +/** + * @file + * Definition of ViewsPluginStyleUnformattedTestCase. + */ + +/** + * Tests the default/unformatted row style. + */ +class ViewsPluginStyleUnformattedTestCase extends ViewsPluginStyleTestBase { + + public static function getInfo() { + return array( + 'name' => 'Style: unformatted', + 'description' => 'Test unformatted style functionality.', + 'group' => 'Views Plugins', + ); + } + + /** + * Take sure that the default css classes works as expected. + */ + function testDefaultRowClasses() { + $view = $this->getBasicView(); + $rendered_output = $view->preview(); + $this->storeViewPreview($rendered_output); + + $rows = $this->elements->body->div->div->div; + $count = 0; + $count_result = count($view->result); + foreach ($rows as $row) { + $count++; + $attributes = $row->attributes(); + $class = (string) $attributes['class'][0]; + // Take sure that each row has a row css class. + $this->assertTrue(strpos($class, "views-row-$count") !== FALSE, 'Take sure that each row has a row css class.'); + // Take sure that the odd/even classes are set right. + $odd_even = $count % 2 == 0 ? 'even' : 'odd'; + $this->assertTrue(strpos($class, "views-row-$odd_even") !== FALSE, 'Take sure that the odd/even classes are set right.'); + + if ($count == 1) { + $this->assertTrue(strpos($class, "views-row-first") !== FALSE, 'Take sure that the first class is set right.'); + } + else if ($count == $count_result) { + $this->assertTrue(strpos($class, "views-row-last") !== FALSE, 'Take sure that the last class is set right.'); + + } + $this->assertTrue(strpos($class, 'views-row') !== FALSE, 'Take sure that the views row class is set right.'); + } + } + +} |