Skip to content

Commit

Permalink
hide categories for draft registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Uditi Mehta authored and Uditi Mehta committed Oct 21, 2024
1 parent e7aa290 commit b166dc6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
2 changes: 2 additions & 0 deletions lib/registries/addon/drafts/draft/metadata/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default class RegistriesDraftMetadata extends Controller {
categoryOptions = Object.values(NodeCategory);
showAddContributorWidget = false;

hideCategories = true;

@not('media.isDesktop') showMobileView!: boolean;
osfUrl = config.OSF.url;

Expand Down
14 changes: 8 additions & 6 deletions lib/registries/addon/drafts/draft/metadata/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@
/>
{{/if}}
{{/let}}
<form.select data-test-metadata-category local-class='SchemaBlockDropdown' id='category'
@label={{t 'registries.registration_metadata.category'}} @valuePath='category'
@options={{this.categoryOptions}} @onchange={{perform this.draftManager.onMetadataInput}} as
|option|>
<NodeCategory @category={{option}} />
</form.select>
{{#unless this.hideCategories}}
<form.select data-test-metadata-category local-class='SchemaBlockDropdown' id='category'
@label={{t 'registries.registration_metadata.category'}} @valuePath='category'
@options={{this.categoryOptions}} @onchange={{perform this.draftManager.onMetadataInput}} as
|option|>
<NodeCategory @category={{option}} />
</form.select>
{{/unless}}
<fieldset id='affiliated_institutions'>
<legend>
{{t 'registries.registration_metadata.affiliated_institutions'}}
Expand Down
1 change: 0 additions & 1 deletion tests/engines/registries/acceptance/branded/new-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,5 @@ module('Registries | Acceptance | branded.new', hooks => {
assert.dom('[data-test-contributor-link]').exists({ count: 1 }, 'Only one contributor');
assert.dom('[data-test-contributor-permission]').containsText('Administrator', 'user is admin');
assert.dom('[data-test-contributor-citation]').containsText('Yes', 'user is bibliographic');
assert.dom('[data-test-option="uncategorized"]').exists('Category is uncategorized by default');
});
});
16 changes: 0 additions & 16 deletions tests/engines/registries/acceptance/draft/draft-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,16 +945,6 @@ module('Registries | Acceptance | draft form', hooks => {
assert.dom('[data-test-validation-errors="description"]')
.exists('error in description appears after removing valid string to blank string');

// Choose category and add a tag
await click('[data-test-metadata-category] > div');
await percySnapshot('Registries | Acceptance | draft form | metadata editing | metadata: categories opened');
assert.dom('[data-option-index="1"]').containsText('Other');
await click('[data-option-index="1"]');

await click('[data-test-metadata-tags]');
await fillIn('[data-test-metadata-tags] input', 'ragtagbag');
await triggerKeyEvent('[data-test-metadata-tags] input', 'keydown', 'Enter');

// No errors for nodelicense fields
assert.dom('[data-test-validation-errors="subjects"]')
.doesNotExist('no error for required fields that user has yet to change: subjects');
Expand All @@ -970,12 +960,6 @@ module('Registries | Acceptance | draft form', hooks => {
assert.dom('[data-test-validation-errors="subjects"]');
assert.dom('[data-test-validation-errors="license"]');

// Category and tag added appear on review page
assert.dom('[data-test-review-response="category"]')
.containsText('Other', 'category that was selected in metadata page shows up in review');
assert.dom('[data-test-tags-widget-tag="ragtagbag"]')
.exists('tag added in metadata shows up in review page');

// Return to Metadata page and address errors for subjects and license
await click('[data-test-link="metadata"]');

Expand Down

0 comments on commit b166dc6

Please sign in to comment.