Skip to content

Commit

Permalink
Remove 'Other' option from File Format select list for Dataset Distri…
Browse files Browse the repository at this point in the history
…butions. (#4318)
  • Loading branch information
beeyayjay authored Dec 4, 2024
1 parent 7c9308e commit 621803a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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.
//
Expand Down Expand Up @@ -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.');
Expand Down
3 changes: 2 additions & 1 deletion schema/collections/dataset.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <strong>CSV UTF-8</strong> option when saving data files.",
"source": {
"enum": [
"",
"arcgis",
"csv",
"esri rest",
Expand Down
1 change: 1 addition & 0 deletions schema/collections/distribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 621803a

Please sign in to comment.