From 621803ab28a10c85e647e5ff6da0842182470c29 Mon Sep 17 00:00:00 2001 From: Beth Jacobson Date: Wed, 4 Dec 2024 17:22:06 -0500 Subject: [PATCH] Remove 'Other' option from File Format select list for Dataset Distributions. (#4318) --- .../Functional/AdminDatasetFileUploadTest.php | 4 ++-- .../Functional/AdminDatasetJsonFormTest.php | 22 +++++++++++++++---- schema/collections/dataset.ui.json | 3 ++- schema/collections/distribution.json | 1 + 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/modules/json_form_widget/tests/src/Functional/AdminDatasetFileUploadTest.php b/modules/json_form_widget/tests/src/Functional/AdminDatasetFileUploadTest.php index b5636a8c57..10e6ea47cb 100644 --- a/modules/json_form_widget/tests/src/Functional/AdminDatasetFileUploadTest.php +++ b/modules/json_form_widget/tests/src/Functional/AdminDatasetFileUploadTest.php @@ -94,7 +94,7 @@ public function testCreateDatasetWithRemoteFile() { 'edit-field-json-metadata-0-value-keyword-keyword-0' => $keyword_data, 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-title' => 'distribution title test', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-description' => 'distribution description test', - 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format-select' => 'csv', + 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format' => 'csv', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-file-url-type-remote' => 'remote', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-file-url-remote' => $file_url, ], 'Save'); @@ -192,7 +192,7 @@ public function testCreateDatasetWithFileUpload() { 'edit-field-json-metadata-0-value-keyword-keyword-0' => $keyword_data, 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-title' => 'distribution title test', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-description' => 'distribution description test', - 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format-select' => 'csv', + 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format' => 'csv', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-downloadurl-file-url-type-upload' => 'upload', ], 'Save'); $assert->statusCodeEquals(200); diff --git a/modules/json_form_widget/tests/src/Functional/AdminDatasetJsonFormTest.php b/modules/json_form_widget/tests/src/Functional/AdminDatasetJsonFormTest.php index f2cfccb770..2690b19af5 100644 --- a/modules/json_form_widget/tests/src/Functional/AdminDatasetJsonFormTest.php +++ b/modules/json_form_widget/tests/src/Functional/AdminDatasetJsonFormTest.php @@ -62,12 +62,11 @@ public function testAdminDatasetJsonForm() { ); } - // 07_admin_dataset_json_form.spec.js : License and format fields are + // 07_admin_dataset_json_form.spec.js : License field is // select_or_other elements in dataset form. // These select elements have an '- Other -' option. foreach ([ "#edit-field-json-metadata-0-value-license-select option[value='select_or_other']", - "#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format-select option[value='select_or_other']", ] as $locator) { $item = $page->find('css', $locator); $this->assertEquals('select_or_other', $item->getValue()); @@ -76,11 +75,26 @@ public function testAdminDatasetJsonForm() { // fields. foreach ([ '#edit-field-json-metadata-0-value-license-other.form-url', - '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format-other.form-text', ] as $locator) { $this->assertNotNull($page->find('css', $locator)); } + // 07_admin_dataset_json_form.spec.js : format field is select elements in dataset form. + // These select elements have options, but do not have an '- Other -' option. + foreach ([ + "#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format option", + ] as $locator) { + $item = $page->find('css', $locator); + $this->assertNotEquals('select', $item->getValue()); + } + // Assert the nonexistence of the 'other' text element for select_or_other + // fields. + foreach ([ + '#edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format.form-text', + ] as $locator) { + $this->assertNull($page->find('css', $locator)); + } + // 07_admin_dataset_json_form.spec.js : User can create and edit a dataset // with the json form UI. User can delete a dataset. // @@ -145,7 +159,7 @@ public function testAdminDatasetJsonForm() { 'edit-field-json-metadata-0-value-accrualperiodicity' => 'R/P1Y', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-title' => 'DKANTEST distribution title text', 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-description' => 'DKANTEST distribution description text', - 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format-select' => 'csv', + 'edit-field-json-metadata-0-value-distribution-distribution-0-distribution-format' => 'csv', ], 'Save'); $assert->statusCodeEquals(200); $assert->pageTextContains('Data ' . $dataset_new_title . ' has been updated.'); diff --git a/schema/collections/dataset.ui.json b/schema/collections/dataset.ui.json index 75d046ebe3..3881cfa49b 100644 --- a/schema/collections/dataset.ui.json +++ b/schema/collections/dataset.ui.json @@ -143,11 +143,12 @@ "ui:options": { "title": "File Format", "widget": "list", - "type": "select_other", + "type": "select", "other_type": "textfield", "description": "CSV files must be encoded in UTF-8 format to be imported correctly. UTF-8 encoding is an established standard that provides optimal compatibility between applications and operating systems. Note that Excel provides a CSV UTF-8 option when saving data files.", "source": { "enum": [ + "", "arcgis", "csv", "esri rest", diff --git a/schema/collections/distribution.json b/schema/collections/distribution.json index bc35616c30..ecc02ed596 100644 --- a/schema/collections/distribution.json +++ b/schema/collections/distribution.json @@ -39,6 +39,7 @@ "description": "A human-readable description of the file format of a distribution (i.e. csv, pdf, xml, kml, etc.).", "type": "string", "examples": [ + "", "arcgis", "csv", "esri rest",