Commit c781b9e3 authored by NickWilde's avatar NickWilde

Fix: Issue #2822418 by NickWilde: Tests are missing

parent 33043c87
<?php
namespace Drupal\views_slideshow\Tests\Plugin;
use Drupal\views\Entity\View;
use Drupal\views\Tests\Plugin\PluginTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests the slideshow style views plugin.
*
* @group views
*/
class StyleSlideshowTest extends PluginTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['views', 'views_slideshow', 'views_slideshow_cycle', 'views_test_config', 'views_slideshow_test'];
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_style_slideshow'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp();
$this->enableViewsTestModule();
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), ['views_slideshow_test']);
}
}
/**
* Test slideshow display.
*/
public function testSlideshow() {
$this->drupalGet('test-style-slideshow');
$result = $this->cssSelect('.views_slideshow_main');
$this->assertEqual(count($result), 1, 'Slideshow displayed on page');
}
/**
* Test slideshow control widgets.
*/
public function testSlideshowWidgets() {
$this->drupalGet('test-style-slideshow');
// Ensure no controls are displayed.
$this->assertFalse($this->cssSelect('.views-slideshow-controls-top'));
$this->assertFalse($this->cssSelect('.views-slideshow-controls-bottom'));
// Test top widget position.
$view = View::load('test_style_slideshow');
$display = &$view->getDisplay('default');
$display['display_options']['style']['options']['widgets'] = [
'top' => [
'views_slideshow_controls' => [
'enable' => TRUE,
'weight' => 1,
'hide_on_single_slide' => 0,
'type' => 'views_slideshow_controls_text',
],
],
];
$view->save();
$this->drupalGet('test-style-slideshow');
$this->assertTrue($this->cssSelect('.views-slideshow-controls-top'));
$this->assertFalse($this->cssSelect('.views-slideshow-controls-bottom'));
// Test bottom widget position.
$display['display_options']['style']['options']['widgets'] = [
'bottom' => [
'views_slideshow_controls' => [
'enable' => TRUE,
'weight' => 1,
'hide_on_single_slide' => 0,
'type' => 'views_slideshow_controls_text',
],
],
'top' => []
];
$view->save();
$this->drupalGet('test-style-slideshow');
$this->assertFalse($this->cssSelect('.views-slideshow-controls-top'));
$this->assertTrue($this->cssSelect('.views-slideshow-controls-bottom'));
}
}
langcode: en
status: true
dependencies:
module:
- views_slideshow
- views_slideshow_cycle
id: test_style_slideshow
label: ''
module: views
description: ''
tag: ''
base_table: views_test_data
base_field: id
core: 8.x
display:
default:
display_plugin: page
id: default
display_title: Master
position: null
display_options:
path: test-style-slideshow
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options: { }
exposed_form:
type: basic
options: { }
pager:
type: full
options: { }
style:
type: slideshow
options:
row_class: ''
default_row_class: true
slideshow_skin: default
slideshow_type: views_slideshow_cycle
row:
type: fields
options: { }
fields:
name:
id: name
table: views_test_data
field: name
name: 'Views Slideshow Test Config'
type: module
description: 'Provides default views for tests.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- views
- views_slideshow
- views_slideshow_cycle
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