Skip to content

Commit d367450

Browse files
committed
done
1 parent 6519236 commit d367450

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

app/controllers/ops_controller/settings/help_menu.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ def help_menu_form_get_vars
3636
id = item.id.to_sym
3737
%i[title href type].map do |field|
3838
param = params["#{id}_#{field}"]
39-
next if param.nil?
4039

4140
@edit[:new][id][field] = param
42-
@edit[:new][id].delete(field) if param.empty?
4341
end
4442
end
4543
changed = @edit[:new] != @edit[:current]

app/javascript/components/settings-help-menu-form/index.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import MiqFormRenderer, { useFormApi } from '@@ddf';
2+
import MiqFormRenderer from '@@ddf';
33
import PropTypes from 'prop-types';
44
import createSchema from './help-menu-form.schema';
55

@@ -39,13 +39,13 @@ const HelpMenuTab = ({ initialValues, initialDropdownValues }) => {
3939

4040
const onSubmit = (values) => {
4141
const submitValues = {};
42-
submitValues.documentation_title = values.item_label_1;
43-
submitValues.product_title = values.item_label_2;
44-
submitValues.about_title = values.item_label_3;
42+
submitValues.documentation_title = values.item_label_1 || '';
43+
submitValues.product_title = values.item_label_2 || '';
44+
submitValues.about_title = values.item_label_3 || '';
4545

46-
submitValues.documentation_href = values.url_1;
47-
submitValues.product_href = values.url_2;
48-
submitValues.about_href = values.url_3;
46+
submitValues.documentation_href = values.url_1 || '';
47+
submitValues.product_href = values.url_2 || '';
48+
submitValues.about_href = values.url_3 || '';
4949

5050
submitValues.documentation_type = values.select_dropdown_1;
5151
submitValues.product_type = values.select_dropdown_2;

cypress/e2e/ui/Settings/SettingsHelpMenu.cy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Settings > Application Settings > Settings', () => {
1818
cy.get('[name="item_label_1"]').type('changed', {force: true});
1919
cy.contains('Save').click({ force: true });
2020
cy.get('[name="item_label_1"]').should('have.value', 'changed');
21-
cy.get('[name="item_label_1"]').clear().type('initial', {force: true});
21+
cy.get('[name="item_label_1"]').clear();
2222
cy.contains('Save').click({ force: true });
2323
});
2424

@@ -27,15 +27,15 @@ describe('Settings > Application Settings > Settings', () => {
2727
cy.get('[name="url_1"]').type('changed', {force: true});
2828
cy.contains('Save').click({ force: true });
2929
cy.get('[name="url_1"]').should('have.value', 'changed');
30-
cy.get('[name="url_1"]').clear().type('initial', {force: true});
30+
cy.get('[name="url_1"]').clear();
3131
cy.contains('Save').click({ force: true });
3232
});
3333

3434
it('Changes dropdown', () => {
35-
cy.get('[name="select_dropdown_1"]').contains('About Modal').click({force: true});
35+
cy.get('#select_dropdown_1').invoke('val', 'default').trigger('change', { force: true });
3636
cy.contains('Save').click({ force: true });
37-
cy.get('[name="select_dropdown_1"]').should('have.value', 'About Modal');
38-
cy.get('[name="select_dropdown_1"]').contains('Current Window').click({force: true});
37+
cy.get('[name="select_dropdown_1"]').should('have.value', 'default');
38+
cy.get('[name="select_dropdown_1"]').select('new_window', { force: true });
3939
cy.contains('Save').click({ force: true });
4040
});
4141
});

0 commit comments

Comments
 (0)