WebformElementImageResolutionTest.php in Webform 6.x
File
tests/src/Functional/Element/WebformElementImageResolutionTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Element;
class WebformElementImageResolutionTest extends WebformElementBrowserTestBase {
protected static $testWebforms = [
'test_element_image_resolution',
];
public function testImageResolution() {
$this
->drupalGet('/webform/test_element_image_resolution');
$this
->assertRaw('<label>webform_image_resolution_advanced</label>');
$this
->assertRaw('<label for="edit-webform-image-resolution-advanced-x" class="visually-hidden">{width_title}</label>');
$this
->assertRaw('<input data-drupal-selector="edit-webform-image-resolution-advanced-x" type="number" id="edit-webform-image-resolution-advanced-x" name="webform_image_resolution_advanced[x]" value="300" step="1" min="1" class="form-number" />');
$this
->assertRaw('<label for="edit-webform-image-resolution-advanced-y" class="visually-hidden">{height_title}</label>');
$this
->assertRaw('<input data-drupal-selector="edit-webform-image-resolution-advanced-y" type="number" id="edit-webform-image-resolution-advanced-y" name="webform_image_resolution_advanced[y]" value="400" step="1" min="1" class="form-number" />');
$this
->assertRaw('{description}');
$this
->drupalPostForm('/webform/test_element_image_resolution', [
'webform_image_resolution[x]' => '100',
], 'Submit');
$this
->assertRaw('Both a height and width value must be specified in the webform_image_resolution field.');
$this
->drupalPostForm('/webform/test_element_image_resolution', [], 'Submit');
$this
->assertRaw("webform_image_resolution: ''\nwebform_image_resolution_advanced: 300x400");
}
}