Skip to content
Snippets Groups Projects
Commit 97eb4137 authored by catch's avatar catch
Browse files

Issue #3303278 by smustgrave, longwave: Decouple NodeDisplayConfigurableTest from RDF module

parent 42a77435
No related branches found
No related tags found
Loading
langcode: en
status: true
dependencies:
config:
- node.type.page
module:
- node
id: node.page
targetEntityType: node
bundle: page
types:
- 'schema:WebPage'
fieldMappings:
title:
properties:
- 'schema:name'
created:
properties:
- 'schema:dateCreated'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
changed:
properties:
- 'schema:dateModified'
datatype_callback:
callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
body:
properties:
- 'schema:text'
uid:
properties:
- 'schema:author'
mapping_type: rel
comment_count:
properties:
- 'schema:interactionCount'
datatype_callback:
callable: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount'
arguments:
interaction_type: UserComments
...@@ -18,7 +18,7 @@ class NodeDisplayConfigurableTest extends NodeTestBase { ...@@ -18,7 +18,7 @@ class NodeDisplayConfigurableTest extends NodeTestBase {
* *
* @var array * @var array
*/ */
protected static $modules = ['rdf', 'block']; protected static $modules = ['block'];
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -90,15 +90,12 @@ public function testDisplayConfigurable(string $theme, string $metadata_region, ...@@ -90,15 +90,12 @@ public function testDisplayConfigurable(string $theme, string $metadata_region,
$this->assertNodeHtml($node, $user, FALSE, $metadata_region, $field_classes, FALSE); $this->assertNodeHtml($node, $user, FALSE, $metadata_region, $field_classes, FALSE);
$assert->elementExists('css', 'div[rel="schema:author"]');
// Remove from display. // Remove from display.
$display->removeComponent('uid') $display->removeComponent('uid')
->removeComponent('created') ->removeComponent('created')
->save(); ->save();
$this->drupalGet($node->toUrl()); $this->drupalGet($node->toUrl());
$assert->elementNotExists('css', 'div[rel="schema:author"]');
$assert->elementTextNotContains('css', 'article', $user->getAccountName()); $assert->elementTextNotContains('css', 'article', $user->getAccountName());
} }
...@@ -148,12 +145,14 @@ protected function assertNodeHtml(NodeInterface $node, UserInterface $user, bool ...@@ -148,12 +145,14 @@ protected function assertNodeHtml(NodeInterface $node, UserInterface $user, bool
if (!$is_inline) { if (!$is_inline) {
$field_classes_selector = $field_classes ? "[contains(concat(' ', normalize-space(@class), ' '), ' field--name-uid ')]" : ''; $field_classes_selector = $field_classes ? "[contains(concat(' ', normalize-space(@class), ' '), ' field--name-uid ')]" : '';
$assert->elementExists('xpath', sprintf('//article//%s//*%s//%s[text()="Authored by"]', $html_element, $field_classes_selector, $html_element)); $assert->elementExists('xpath', sprintf('//article//%s//*%s//%s[text()="Authored by"]', $html_element, $field_classes_selector, $html_element));
$assert->elementTextContains('css', "$uid_selector $html_element" . '[rel="schema:author"]', $user->getAccountName()); $assert->elementTextContains('css', $uid_selector, $user->getAccountName());
$assert->elementNotExists('css', "$uid_selector a"); $assert->elementNotExists('css', "$uid_selector a");
$assert->elementExists('css', 'span[property="schema:dateCreated"]'); if ($field_classes) {
$assert->elementExists('css', $created_selector);
}
} }
else { else {
$assert->elementTextContains('css', $uid_selector . ' a[property="schema:name"]', $user->getAccountName()); $assert->elementTextContains('css', $uid_selector . ' a', $user->getAccountName());
$assert->elementTextContains('css', 'article ' . $metadata_region, 'Submitted by'); $assert->elementTextContains('css', 'article ' . $metadata_region, 'Submitted by');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment