', 'determines publish for plugin'));
+ t.true(includes(rendered.html, '
required to save', 'determines save for plugin'));
+ t.true(includes(rendered.html, '
required to publish', 'determines publish for plugin'));
});
});
@@ -174,4 +173,3 @@ test('Form Generation, with repeatables', t => {
t.true(includes(rendered.html, '
'), 'Indexing for input text of second instance');
});
});
-
diff --git a/tests/html.js b/tests/html.js
index 955e8b6..e52937c 100644
--- a/tests/html.js
+++ b/tests/html.js
@@ -10,7 +10,7 @@ test('Add Errors - Pass', t => {
},
input: {
description: 'I am the Bar Content Type Config textarea description',
- html: '
{{textarea.value}}',
+ html: '
{{textarea.value}}',
id: 'my-textarea',
inputs: {
textarea: {
@@ -41,7 +41,7 @@ test('Add Errors Repeatable - Pass', t => {
},
input: {
description: 'An email input with domain validation',
- html: '
',
+ html: '
',
id: 'my-email',
inputs: [
{
@@ -81,10 +81,10 @@ test('Add Errors Repeatable - Pass', t => {
test('Add Required - Pass', t => {
const param = {
- html: '"
test"',
+ html: '"
test"',
input: {
description: 'I am the Bar Content Type Config textarea description',
- html: '
{{textarea.value}}',
+ html: '
{{textarea.value}}',
id: 'my-textarea',
inputs: {
textarea: {
@@ -132,3 +132,64 @@ test('Add Required Checkbox - Pass', t => {
t.false(includes(result, expected));
});
+test('Add Required and Repeatable - Pass', t => {
+ const param = {
+ html: '"
"',
+ input: {
+ description: 'I am the Bar Content Type Config text description',
+ html: '
',
+ id: 'text-required',
+ inputs: {
+ text: {
+ id: '91f79620-ba21-4a4a-a4c7-02f456129b0f--1',
+ label: 'Add Your Text',
+ name: 'name--text',
+ placeholder: 'Text goes here',
+ type: 'text',
+ },
+ },
+ name: 'Add Your Text',
+ required: 'publish',
+ repeatable: 'true',
+ type: 'text',
+ },
+ index: undefined,
+ };
+ const expected = 'aria-required="true" required';
+ const result = html.required(param.html, param.input, param.index);
+ t.false(includes(result, expected));
+});
+
+test('Add Object Required - Pass', t => {
+ const param = {
+ html: '""',
+ input: {
+ name: 'Object',
+ description: 'I am the Foo Object text description',
+ html: '',
+ id: 'object-required',
+ inputs: {
+ text: {
+ id: '91f79620-ba21-4a4a-a4c7-02f456129b0f--1',
+ label: 'Add Your Text',
+ name: 'name--text',
+ placeholder: 'Text goes here',
+ type: 'text',
+ required: 'publish',
+ },
+ url: {
+ id: '91f79620-ba21-4a4a-a4c7-02f456129b0f--2',
+ label: 'Add Your URL',
+ name: 'name--url',
+ placeholder: 'http://',
+ type: 'url',
+ required: 'publish',
+ },
+ },
+ },
+ index: undefined,
+ };
+ const expected = 'aria-required="true" required';
+ const result = html.required(param.html, param.input, param.index);
+ t.false(includes(result, expected));
+});