Skip to content

Commit

Permalink
test(slb-306): updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elistone committed May 21, 2024
1 parent 298e543 commit 5c890a5
Show file tree
Hide file tree
Showing 3 changed files with 314 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
_meta:
version: '1.0'
entity_type: node
uuid: 3164a225-df20-4794-8cfc-b7cd81cfde58
bundle: page
default_langcode: en
depends:
3a0fe860-a6d6-428a-9474-365bd57509aa: media
default:
revision_uid:
-
target_id: 1
status:
-
value: true
uid:
-
target_id: 1
title:
-
value: 'Info grid'
created:
-
value: 1716194667
promote:
-
value: false
sticky:
-
value: false
moderation_state:
-
value: published
path:
-
alias: /info-grid
langcode: en
pathauto: 0
content_translation_source:
-
value: und
content_translation_outdated:
-
value: false
body:
-
value: |-
<!-- wp:custom/hero {"mediaEntityIds":["3a0fe860-a6d6-428a-9474-365bd57509aa"],"headline":"Info grid","lead":"This is a page for info grid"} /-->
<!-- wp:custom/content -->
<!-- wp:custom/info-grid -->
<!-- wp:custom/info-grid-item {"icon":"EMAIL"} -->
<!-- wp:custom/heading {"text":"I am a heading"} -->
<h2 class="wp-block-custom-heading">I am a heading</h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p>I am the body</p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta {"text":"Link text"} /-->
<!-- /wp:custom/info-grid-item -->
<!-- wp:custom/info-grid-item {"icon":"PHONE"} -->
<!-- wp:custom/heading {"text":"I am second heading"} -->
<h2 class="wp-block-custom-heading">I am second heading</h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p>I am the second body</p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta {"text":"Second link text"} /-->
<!-- /wp:custom/info-grid-item -->
<!-- wp:custom/info-grid-item {"icon":"LIFE-RING"} -->
<!-- wp:custom/heading {"text":"I am the third heading"} -->
<h2 class="wp-block-custom-heading">I am the third heading</h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p>I am the third body</p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta {"text":"third link text"} /-->
<!-- /wp:custom/info-grid-item -->
<!-- /wp:custom/info-grid -->
<!-- wp:custom/info-grid -->
<!-- wp:custom/info-grid-item -->
<!-- wp:custom/heading {"text":"Just one info grid"} -->
<h2 class="wp-block-custom-heading">Just one info grid</h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta /-->
<!-- /wp:custom/info-grid-item -->
<!-- /wp:custom/info-grid -->
<!-- wp:custom/info-grid -->
<!-- wp:custom/info-grid-item -->
<!-- wp:custom/heading -->
<h2 class="wp-block-custom-heading"></h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta /-->
<!-- /wp:custom/info-grid-item -->
<!-- wp:custom/info-grid-item -->
<!-- wp:custom/heading -->
<h2 class="wp-block-custom-heading"></h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta /-->
<!-- /wp:custom/info-grid-item -->
<!-- wp:custom/info-grid-item -->
<!-- wp:custom/heading -->
<h2 class="wp-block-custom-heading"></h2>
<!-- /wp:custom/heading -->
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
<!-- wp:custom/cta /-->
<!-- /wp:custom/info-grid-item -->
<!-- /wp:custom/info-grid -->
<!-- /wp:custom/content -->
format: gutenberg
summary: ''
186 changes: 171 additions & 15 deletions tests/schema/specs/blocks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,6 @@ test('Blocks', async () => {
}
}
}
... on BlockInfoGrid {
gridItems {
icon
textContent {
markup
}
cta {
url
icon
iconPosition
text
openInNewTab
}
}
}
}
}
{
Expand Down Expand Up @@ -370,3 +355,174 @@ test('Blocks', async () => {
);
expect(germanForm.url).toBe('http://127.0.0.1:8000/de/form/contact');
});

test('Block - info grid', async () => {
const result = await fetch(gql`
{
_loadDrupalPage(id: "3164a225-df20-4794-8cfc-b7cd81cfde58") {
content {
__typename
... on BlockInfoGrid {
gridItems {
icon
textContent {
markup
}
cta {
url
icon
iconPosition
text
openInNewTab
}
}
}
}
}
}
`);
expect(result).toMatchInlineSnapshot(`
{
"data": {
"_loadDrupalPage": {
"content": [
{
"__typename": "BlockInfoGrid",
"gridItems": [
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": "Link text",
"url": null,
},
"icon": "EMAIL",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading">I am a heading</h2>
<p>I am the body</p>
",
},
},
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": "Second link text",
"url": null,
},
"icon": "PHONE",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading">I am second heading</h2>
<p>I am the second body</p>
",
},
},
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": "third link text",
"url": null,
},
"icon": "LIFE-RING",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading">I am the third heading</h2>
<p>I am the third body</p>
",
},
},
],
},
{
"__typename": "BlockInfoGrid",
"gridItems": [
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": null,
"url": null,
},
"icon": "",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading">Just one info grid</h2>
<p></p>
",
},
},
],
},
{
"__typename": "BlockInfoGrid",
"gridItems": [
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": null,
"url": null,
},
"icon": "",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading"></h2>
<p></p>
",
},
},
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": null,
"url": null,
},
"icon": "",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading"></h2>
<p></p>
",
},
},
{
"cta": {
"icon": null,
"iconPosition": null,
"openInNewTab": null,
"text": null,
"url": null,
},
"icon": "",
"textContent": {
"markup": "
<h2 class="wp-block-custom-heading"></h2>
<p></p>
",
},
},
],
},
],
},
},
}
`);
});
2 changes: 1 addition & 1 deletion tests/schema/specs/links.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('Links', async () => {
{
"__typename": "BlockMarkup",
"markup": "
<p><a href="/sites/default/files/2023-04/document_docx.docx" data-type="Media: Document" data-id="[id]" data-entity-type="media">link to file</a></p>
<p><a href="/sites/default/files/2023-04/document_docx.docx" data-type="Media: Document" data-id="[id]">link to file</a></p>
<p><a href="/en/privacy" data-type="Content: Basic page" data-id="[id]" data-entity-type="node">link to page</a></p>
",
Expand Down

0 comments on commit 5c890a5

Please sign in to comment.