Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hidden authors fields in metadata schema step #1217

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/components/metadata-form/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -41,6 +40,8 @@ export default Component.extend({
},
};

newForm.options.hideInitValidationError = true;

$('#schemaForm').empty();
$('#schemaForm').alpaca(newForm);
},
Expand Down
1 change: 1 addition & 0 deletions app/services/metadata-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/nih-submission-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down
7 changes: 0 additions & 7 deletions tests/integration/components/workflow-metadata-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,21 +268,14 @@ 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
await waitFor('[name="ISSN"]');
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'));

Expand Down