diff --git a/app/components/metadata-form/index.js b/app/components/metadata-form/index.js index 6046c28b..a9293602 100644 --- a/app/components/metadata-form/index.js +++ b/app/components/metadata-form/index.js @@ -1,5 +1,4 @@ /* eslint-disable ember/no-classic-components, ember/no-classic-classes, ember/require-tagless-components, ember/no-component-lifecycle-hooks, ember/no-get */ -// import Component from '@ember/component'; import Component from '@ember/component'; import _ from 'lodash'; import { get } from '@ember/object'; @@ -41,6 +40,8 @@ export default Component.extend({ }, }; + newForm.options.hideInitValidationError = true; + $('#schemaForm').empty(); $('#schemaForm').alpaca(newForm); }, diff --git a/app/services/metadata-schema.js b/app/services/metadata-schema.js index af32efa7..b1e2b244 100644 --- a/app/services/metadata-schema.js +++ b/app/services/metadata-schema.js @@ -103,6 +103,7 @@ export default class MetadataSchemaService extends Service { addDisplayData(schema, data, readonly) { if (!schema.data) { schema.data = {}; + schema.data.authors = [{}]; } // Will merge 'data' onto 'schema.data'. 'schema.data' values may be overwritten by values from 'data' schema.data = Object.assign(schema.data, data); diff --git a/tests/acceptance/nih-submission-test.js b/tests/acceptance/nih-submission-test.js index 29518ae7..87a8fbca 100644 --- a/tests/acceptance/nih-submission-test.js +++ b/tests/acceptance/nih-submission-test.js @@ -467,7 +467,7 @@ module('Acceptance | submission', function (hooks) { await click('.alpaca-form-button-Next'); await waitFor(document.querySelector('#swal2-content')); - assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'authors'"); + assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'author'"); // Some reason, setting the document query to a variable before clicking works, // but calling the query selector in the click does not work @@ -612,7 +612,7 @@ module('Acceptance | submission', function (hooks) { await click('.alpaca-form-button-Next'); await waitFor(document.querySelector('#swal2-content')); - assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'authors'"); + assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'author'"); const confirmBtn = document.querySelector('.swal2-confirm'); assert.ok(confirmBtn, 'No SweetAlert OK button found'); diff --git a/tests/integration/components/workflow-metadata-test.js b/tests/integration/components/workflow-metadata-test.js index 5f2a65db..eff85a97 100644 --- a/tests/integration/components/workflow-metadata-test.js +++ b/tests/integration/components/workflow-metadata-test.js @@ -268,10 +268,7 @@ module('Integration | Component | workflow-metadata', (hooks) => { @publication={{this.publication}} /> `); - await waitFor('[data-key="Next"]'); - await waitFor('[data-key="Back"]'); - await waitFor('[data-key="Abort"]'); await click('[data-key="Next"]'); // Need to fill out ISSN field @@ -279,10 +276,6 @@ module('Integration | Component | workflow-metadata', (hooks) => { await fillIn('[name="ISSN"]', '1234'); await click('button[data-key="Next"]'); - await waitFor('[data-key="Back"]'); - await waitFor('[data-key="Abort"]'); - await waitFor('input[name="ISSN"]'); - await click('[data-key="Next"]'); await waitFor(document.querySelector('.swal2-confirm'));