You are here

public function FractionFieldTest::testFractionWidgetMinMaxDecimal in Fraction 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/FractionFieldTest.php \Drupal\Tests\fraction\Functional\FractionFieldTest::testFractionWidgetMinMaxDecimal()

Test min/max with decimal values.

File

tests/src/Functional/FractionFieldTest.php, line 316

Class

FractionFieldTest
Tests the creation of fraction fields.

Namespace

Drupal\Tests\fraction\Functional

Code

public function testFractionWidgetMinMaxDecimal() {
  $this
    ->drupalCreateContentType([
    'type' => 'article',
  ]);
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('/admin/structure/types/manage/article/fields/add-field');
  $page
    ->selectFieldOption('new_storage_type', 'fraction');
  $page
    ->fillField('label', 'Fraction field');
  $page
    ->fillField('field_name', 'fraction_field');
  $page
    ->pressButton('Save and continue');
  $page
    ->pressButton('Save field settings');
  $page
    ->fillField('settings[min]', 10.5);
  $page
    ->fillField('settings[max]', 100.5);
  $page
    ->pressButton('Save settings');
  $assert_session
    ->pageTextContains('Saved Fraction field configuration.');
}