Skip to content

Commit

Permalink
chore: test if chromatic can screenshot iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat committed Jan 11, 2024
1 parent fb4ebb8 commit e1f7d11
Show file tree
Hide file tree
Showing 28 changed files with 1,704 additions and 47 deletions.
35 changes: 0 additions & 35 deletions packages/drupal/test_content/contact-webform.yml

This file was deleted.

15 changes: 15 additions & 0 deletions packages/drupal/test_content/export.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
use AmazeeLabs\DefaultContent\Export;
use Drupal\webform\Entity\Webform;
use Drupal\webform\Utility\WebformYaml;

if (PHP_SAPI !== 'cli') {
die;
Expand Down Expand Up @@ -27,3 +29,16 @@
foreach (glob(__DIR__ . '/content/file/generic*.png') as $file) {
unlink($file);
}

// Export webforms.
foreach (Webform::loadMultiple() as $webform) {
$configPrefix = \Drupal::entityTypeManager()
->getDefinition('webform')
->getConfigPrefix();
$configName = $configPrefix . '.' . $webform->getConfigTarget();
$data = \Drupal::config($configName)->getRawData();
file_put_contents(
__DIR__ . '/webforms/' . $webform->id() . '.yml',
WebformYaml::encode($data)
);
}
9 changes: 4 additions & 5 deletions packages/drupal/test_content/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

Import::run('test_content');

// Webforms are ignored from the config. Create an example form now.
var_dump(getcwd());
Webform::create(Yaml::decode(file_get_contents(
'modules/custom/test_content/contact-webform.yml'
)))->save();
// Import webforms.
foreach (glob(__DIR__ . '/webforms/*.yml') as $file) {
Webform::create(Yaml::decode(file_get_contents($file)))->save();
}
95 changes: 95 additions & 0 deletions packages/drupal/test_content/webforms/contact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
uuid: 379fd051-85ab-46d1-a808-02c1b6dde379
langcode: en
status: open
dependencies: { }
weight: 0
open: null
close: null
uid: 0
template: false
archive: false
id: contact
title: Contact
description: 'Example webform.'
categories: { }
elements: |-
name:
'#title': 'Your Name'
'#type': textfield
'#required': false
'#default_value': '[current-user:display-name]'
email:
'#title': 'Your Email'
'#type': email
'#required': false
'#default_value': '[current-user:mail]'
subject:
'#title': Subject
'#type': textfield
'#required': false
'#test': 'Testing contact webform from [site:name]'
message:
'#title': Message
'#type': textarea
'#required': false
'#test': 'Please ignore this email.'
actions:
'#type': webform_actions
'#title': 'Submit button(s)'
'#submit__label': 'Send message'
css: ''
javascript: ''
settings:
confirmation_type: url_message
confirmation_url: /page-minimal
confirmation_message: 'Confirmation message for Contact webform'
access:
create:
roles:
- anonymous
- authenticated
users: { }
permissions: { }
view_any:
roles: { }
users: { }
permissions: { }
update_any:
roles: { }
users: { }
permissions: { }
delete_any:
roles: { }
users: { }
permissions: { }
purge_any:
roles: { }
users: { }
permissions: { }
view_own:
roles: { }
users: { }
permissions: { }
update_own:
roles: { }
users: { }
permissions: { }
delete_own:
roles: { }
users: { }
permissions: { }
administer:
roles: { }
users: { }
permissions: { }
test:
roles: { }
users: { }
permissions: { }
configuration:
roles: { }
users: { }
permissions: { }
handlers: { }
variants: { }
Loading

0 comments on commit e1f7d11

Please sign in to comment.