protected function ResponsivePreviewTestBase::assertDeviceListEquals in Responsive Theme Preview 8
Tests exposed devices in the responsive preview list.
Parameters
array $devices: An array of devices to check.
3 calls to ResponsivePreviewTestBase::assertDeviceListEquals()
- ResponsivePreviewBlockTest::testBlock in tests/
src/ Functional/ ResponsivePreviewBlockTest.php - Tests responsive preview block.
- ResponsivePreviewToolbarTest::testCacheInvalidation in tests/
src/ Functional/ ResponsivePreviewToolbarTest.php - Tests cache invalidation.
- ResponsivePreviewToolbarTest::testToolbarIntegration in tests/
src/ Functional/ ResponsivePreviewToolbarTest.php - Tests that the toolbar integration works properly.
File
- tests/
src/ Functional/ ResponsivePreviewTestBase.php, line 60
Class
- ResponsivePreviewTestBase
- Responsive preview base test class.
Namespace
Drupal\Tests\responsive_preview\FunctionalCode
protected function assertDeviceListEquals(array $devices) {
$device_buttons = $this
->xpath('//button[@data-responsive-preview-name]');
$this
->assertTrue(count($devices) === count($device_buttons));
foreach ($device_buttons as $button) {
$name = $button
->getAttribute('data-responsive-preview-name');
$this
->assertTrue(!empty($name) && in_array($name, $devices), new FormattableMarkup('%name device shown', [
'%name' => $name,
]));
}
}