public function FormatterTest::testTextAndInteger in Double Field 4.x
Same name and namespace in other branches
- 8.3 tests/src/FunctionalJavascript/FormatterTest.php \Drupal\Tests\double_field\FunctionalJavascript\FormatterTest::testTextAndInteger()
Test callback.
File
- tests/
src/ FunctionalJavascript/ FormatterTest.php, line 167
Class
- FormatterTest
- A tests for Double Field formatter.
Namespace
Drupal\Tests\double_field\FunctionalJavascriptCode
public function testTextAndInteger() : void {
$page = $this
->getSession()
->getPage();
$settings = [];
$settings['storage']['first']['type'] = 'text';
$settings['storage']['second']['type'] = 'integer';
$settings['formatter']['type'] = 'double_field_unformatted_list';
$this
->createField($settings);
$this
->drupalGet($this->displayAdminPath);
$expected_summary = [
'Display as inline element',
'<b>First subfield - text (long)</b>',
'Hidden: no',
'<b>Second subfield - integer</b>',
'Hidden: no',
'Number format: 1234',
];
$this
->assertSettingsSummary($expected_summary);
$this
->openSettingsForm();
$details_2 = $page
->find('xpath', '//details[2]');
$details_2
->click();
$details_2
->selectFieldOption("Thousand marker", 'Space');
$this
->submitSettingsForm();
$expected_summary = [
'Display as inline element',
'<b>First subfield - text (long)</b>',
'Hidden: no',
'<b>Second subfield - integer</b>',
'Hidden: no',
'Number format: 1 234',
];
$this
->assertSettingsSummary($expected_summary);
$this
->submitNode([
'<b>Foo</b>',
123456,
]);
$prefix = '//div[contains(@class, "double-field-unformatted-list")]';
$this
->assertXpath($prefix . '/div[@class = "double-field-first" and text() = "<b>Foo</b>"]');
$this
->assertXpath($prefix . '/div[@class = "double-field-second" and text() = "123 456"]');
}