From d93588a44f2b7f1db17e80ff1ec61aade2b08ba5 Mon Sep 17 00:00:00 2001 From: Samuel Liu Date: Tue, 5 Nov 2024 14:22:51 -0500 Subject: [PATCH 1/2] Convert Help Menu Form from Haml to React and add Cypress Testing --- app/controllers/ops_controller.rb | 5 + .../ops_controller/settings/help_menu.rb | 22 +- .../help-menu-form.schema.js | 234 ++++++++++++++ .../settings-help-menu-form/index.jsx | 86 ++++++ .../packs/component-definitions-common.js | 2 + .../settings-help-menu.spec.js.snap | 289 ++++++++++++++++++ .../settings-help-menu.spec.js | 58 ++++ app/stylesheet/application-webpack.scss | 1 + app/stylesheet/settings-help-menu-tab.scss | 97 ++++++ .../ops/_settings_help_menu_tab.html.haml | 54 +--- .../e2e/ui/Settings/SettingsHelpMenu.cy.js | 42 +++ 11 files changed, 828 insertions(+), 62 deletions(-) create mode 100644 app/javascript/components/settings-help-menu-form/help-menu-form.schema.js create mode 100644 app/javascript/components/settings-help-menu-form/index.jsx create mode 100644 app/javascript/spec/settings-help-menu/__snapshots__/settings-help-menu.spec.js.snap create mode 100644 app/javascript/spec/settings-help-menu/settings-help-menu.spec.js create mode 100644 app/stylesheet/settings-help-menu-tab.scss create mode 100644 cypress/e2e/ui/Settings/SettingsHelpMenu.cy.js diff --git a/app/controllers/ops_controller.rb b/app/controllers/ops_controller.rb index 7c07a6ea681..72413ccceeb 100644 --- a/app/controllers/ops_controller.rb +++ b/app/controllers/ops_controller.rb @@ -199,6 +199,7 @@ def explorer @ldap_group = @edit[:ldap_group] if params[:cls_id] && params[:cls_id].split('_')[0] == "lg" @x_edit_buttons_locals = set_form_locals if @in_a_form if @edit && (@sb[:active_tab] == 'settings_help_menu' || (@sb[:active_tab] == 'settings_tags' && !%w[settings_import settings_import_tags].include?(@sb[:active_subtab]))) + @hide_bottom_bar = true edit_changed? end # do not show buttons, when settings_workers - it uses react form buttons @@ -496,6 +497,7 @@ def set_form_locals record_id = @sb[:active_tab].split("settings_").last locals[:no_cancel] = true elsif @sb[:active_tab] == "settings_help_menu" + @hide_bottom_bar = true action_url = "settings_update_help_menu" locals[:submit_button] = true locals[:no_cancel] = true @@ -806,6 +808,9 @@ def handle_bottom_cell(nodetype, presenter, locals) if ["settings_workers", "diagnostics_cu_repair"].include?(@sb[:active_tab]) presenter.hide(:form_buttons_div) end + if @hide_bottom_bar + presenter.hide(:form_buttons_div) + end end def replace_explorer_trees(replace_trees, presenter) diff --git a/app/controllers/ops_controller/settings/help_menu.rb b/app/controllers/ops_controller/settings/help_menu.rb index 19b6557db92..0e659764c32 100644 --- a/app/controllers/ops_controller/settings/help_menu.rb +++ b/app/controllers/ops_controller/settings/help_menu.rb @@ -4,6 +4,8 @@ module OpsController::Settings::HelpMenu def settings_update_help_menu assert_privileges("region_edit") + help_menu_form_get_vars + return unless load_edit('customize_help_menu') begin @@ -20,22 +22,12 @@ def settings_update_help_menu if success MiqServer.my_server.add_settings_for_resource(konfig) session.delete(:edit) - add_flash(_('Help menu customization changes successfully stored.'), :success) - else - add_flash(_('Storing the custom help menu configuration was not successful.'), :error) end session[:changed] = !success - - render :update do |page| - page << javascript_prologue - page << javascript_for_miq_button_visibility(!success) - page.replace(:flash_msg_div, :partial => "layouts/flash_msg") - page << "miqScrollTop();" if @flash_array.present? - end end - def help_menu_form_field_changed + def help_menu_form_get_vars assert_privileges("region_edit") return unless load_edit('customize_help_menu') @@ -44,19 +36,11 @@ def help_menu_form_field_changed id = item.id.to_sym %i[title href type].map do |field| param = params["#{id}_#{field}"] - next if param.nil? @edit[:new][id][field] = param - @edit[:new][id].delete(field) if param.empty? end end - changed = @edit[:new] != @edit[:current] session[:changed] = changed - - render :update do |page| - page << javascript_prologue - page << javascript_for_miq_button_visibility(changed) - end end end diff --git a/app/javascript/components/settings-help-menu-form/help-menu-form.schema.js b/app/javascript/components/settings-help-menu-form/help-menu-form.schema.js new file mode 100644 index 00000000000..b048fee7f59 --- /dev/null +++ b/app/javascript/components/settings-help-menu-form/help-menu-form.schema.js @@ -0,0 +1,234 @@ +import { componentTypes } from '@@ddf'; + +const createSchema = (options, dropdownValue, setDropdownValue, values) => { + const fields = [ + { + component: componentTypes.SUB_FORM, + id: 'col1', + name: 'col1', + className: 'col1', + fields: [ + { + component: componentTypes.PLAIN_TEXT, + id: 'menu_item_label', + name: 'menu_item_label', + className: 'menu-item-label', + label: __('Menu item label'), + style: { fontSize: '16px' }, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_2', + name: 'divider_2', + label: '', + className: 'left-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'item_label_1', + name: 'item_label_1', + className: 'item-label', + placeholder: __('Documentation'), + initialValue: values[0].title, + maxLength: 128, + isRequired: true, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_3', + name: 'divider_3', + label: '', + className: 'left-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'item_label_2', + name: 'item_label_2', + className: 'item-label', + placeholder: __('ManageIQ.org'), + initialValue: values[1].title, + maxLength: 128, + isRequired: true, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_4', + name: 'divider_4', + label: '', + className: 'left-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'item_label_3', + name: 'item_label_3', + className: 'item-label', + placeholder: __('About'), + initialValue: values[2].title, + maxLength: 128, + isRequired: true, + }, + ], + }, + { + component: componentTypes.SUB_FORM, + id: 'col2', + name: 'col2', + className: 'col2', + fields: [ + { + component: componentTypes.PLAIN_TEXT, + id: 'url_label', + name: 'url_label', + className: 'url-label', + label: __('URL'), + style: { fontSize: '16px' }, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_5', + name: 'divider_5', + label: '', + className: 'middle-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'url_1', + name: 'url_1', + className: 'url', + placeholder: __('https://www.manageiq.org/docs/'), + initialValue: values[0].href, + maxLength: 128, + isDisabled: dropdownValue[0] === 'modal', + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_6', + name: 'divider_6', + label: '', + className: 'middle-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'url_2', + name: 'url_2', + className: 'url', + placeholder: __('https://www.manageiq.org'), + maxLength: 128, + initialValue: values[0].href, + isDisabled: dropdownValue[1] === 'modal', + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_7', + name: 'divider_7', + label: '', + className: 'middle-divider', + }, + { + component: componentTypes.TEXT_FIELD, + id: 'url_3', + name: 'url_3', + className: 'url', + maxLength: 128, + initialValue: values[0].href, + isDisabled: dropdownValue[2] === 'modal', + }, + ], + }, + { + component: componentTypes.SUB_FORM, + id: 'col3', + name: 'col3', + className: 'col3', + fields: [ + { + component: componentTypes.PLAIN_TEXT, + id: 'open_label', + name: 'open_label', + className: 'open-label', + label: __('Open in'), + style: { fontSize: '16px' }, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_8', + name: 'divider_8', + label: '', + className: 'right-divider', + }, + { + component: componentTypes.SELECT, + id: 'select_dropdown_1', + name: 'select_dropdown_1', + className: 'dropdown', + hideLabel: true, + options, + maxLength: 128, + isRequired: true, + initialValue: dropdownValue[0], + onChange: (value) => { + setDropdownValue((prevValues) => { + const updatedValues = [...prevValues]; + updatedValues[0] = value; + return updatedValues; + }); + }, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_9', + name: 'divider_9', + label: '', + className: 'right-divider', + }, + { + component: componentTypes.SELECT, + id: 'select_dropdown_2', + name: 'select_dropdown_2', + className: 'dropdown', + hideLabel: true, + options, + initialValue: dropdownValue[1], + maxLength: 128, + onChange: (value) => { + setDropdownValue((prevValues) => { + const updatedValues = [...prevValues]; + updatedValues[1] = value; + return updatedValues; + }); + }, + }, + { + component: componentTypes.PLAIN_TEXT, + id: 'divider_10', + name: 'divider_10', + label: '', + className: 'right-divider', + }, + { + component: componentTypes.SELECT, + id: 'select_dropdown_3', + name: 'select_dropdown_3', + className: 'dropdown', + hideLabel: true, + options, + initialValue: dropdownValue[2], + maxLength: 128, + onChange: (value) => { + setDropdownValue((prevValues) => { + const updatedValues = [...prevValues]; + updatedValues[2] = value; + return updatedValues; + }); + }, + }, + ], + }, + ]; + + return { + fields, + }; +}; + +export default createSchema; diff --git a/app/javascript/components/settings-help-menu-form/index.jsx b/app/javascript/components/settings-help-menu-form/index.jsx new file mode 100644 index 00000000000..a6cec41a7d8 --- /dev/null +++ b/app/javascript/components/settings-help-menu-form/index.jsx @@ -0,0 +1,86 @@ +import React, { useState, useEffect } from 'react'; +import MiqFormRenderer from '@@ddf'; +import PropTypes from 'prop-types'; +import createSchema from './help-menu-form.schema'; + +const HelpMenuTab = ({ initialValues, initialDropdownValues }) => { + const [dropdownValue, setDropdownValue] = useState(initialDropdownValues || []); + const [data, setData] = useState({ + params: [], + isLoading: false, + }); + + const options = [ + { label: 'Current Window', value: 'default' }, + { label: 'New Window', value: 'new_window' }, + { label: 'About Modal', value: 'modal' }, + ]; + + useEffect(() => { + if (data.isLoading) { + http.post('/ops/settings_update_help_menu/', data.params).then(() => { + setData({ + ...data, + isLoading: false, + }); + add_flash(__('Help menu customization changes successfully stored.'), 'success'); + window.location.reload(); + }).catch(() => { + setData({ + ...data, + isLoading: false, + }); + add_flash(__('Storing the custom help menu configuration was not successful.'), 'failure'); + window.location.reload(); + }); + setData({ ...data, isLoading: false }); + } + }, [data.isLoading]); + + const onSubmit = (values) => { + const submitValues = {}; + submitValues.documentation_title = values.item_label_1 || ''; + submitValues.product_title = values.item_label_2 || ''; + submitValues.about_title = values.item_label_3 || ''; + + submitValues.documentation_href = values.url_1 || ''; + submitValues.product_href = values.url_2 || ''; + submitValues.about_href = values.url_3 || ''; + + submitValues.documentation_type = values.select_dropdown_1; + submitValues.product_type = values.select_dropdown_2; + submitValues.about_type = values.select_dropdown_3; + + setData({ params: submitValues, isLoading: true }); + }; + + return (( +
+
{`${__('Customize Help Menu')}`}
+
+ i + {`${__('Any change to the help menu will take effect upon a full page reload.')}`} +
+
+
+ {}} + /> +
+
+ )); +}; + +HelpMenuTab.propTypes = { + initialValues: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), + initialDropdownValues: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), +}; + +HelpMenuTab.defaultProps = { + initialValues: undefined, + initialDropdownValues: undefined, +}; + +export default HelpMenuTab; diff --git a/app/javascript/packs/component-definitions-common.js b/app/javascript/packs/component-definitions-common.js index f56709a0b77..1dffc8dcdc8 100644 --- a/app/javascript/packs/component-definitions-common.js +++ b/app/javascript/packs/component-definitions-common.js @@ -134,6 +134,7 @@ import SettingsCategoryForm from '../components/settings-category-form'; import SettingsCompanyCategories from '../components/settings-company-categories'; import SettingsCompanyTags from '../components/settings-company-tags'; import SettingsCompanyTagsEntryForm from '../components/settings-company-tags-entry-form'; +import SettingsHelpMenuTab from '../components/settings-help-menu-form'; import SettingsLabelTagMapping from '../components/settings-label-tag-mapping'; import SettingsTasksForm from '../components/settings-tasks-form'; import SettingsTimeProfileForm from '../components/settings-time-profile-form'; @@ -315,6 +316,7 @@ ManageIQ.component.addReact('SettingsCategoryForm', SettingsCategoryForm); ManageIQ.component.addReact('SettingsCompanyCategories', SettingsCompanyCategories); ManageIQ.component.addReact('SettingsCompanyTags', SettingsCompanyTags); ManageIQ.component.addReact('SettingsCompanyTagsEntryForm', SettingsCompanyTagsEntryForm); +ManageIQ.component.addReact('SettingsHelpMenuTab', SettingsHelpMenuTab); ManageIQ.component.addReact('SettingsLabelTagMapping', SettingsLabelTagMapping); ManageIQ.component.addReact('SettingsTasksForm', SettingsTasksForm); ManageIQ.component.addReact('SettingsTimeProfileForm', SettingsTimeProfileForm); diff --git a/app/javascript/spec/settings-help-menu/__snapshots__/settings-help-menu.spec.js.snap b/app/javascript/spec/settings-help-menu/__snapshots__/settings-help-menu.spec.js.snap new file mode 100644 index 00000000000..2317157e740 --- /dev/null +++ b/app/javascript/spec/settings-help-menu/__snapshots__/settings-help-menu.spec.js.snap @@ -0,0 +1,289 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SettingsHelpMenu should submit a help menu change 1`] = ` +
+
+ Customize Help Menu +
+
+ + i + + Any change to the help menu will take effect upon a full page reload. +
+
+
+ +
+
+`; diff --git a/app/javascript/spec/settings-help-menu/settings-help-menu.spec.js b/app/javascript/spec/settings-help-menu/settings-help-menu.spec.js new file mode 100644 index 00000000000..9f1e5ddb072 --- /dev/null +++ b/app/javascript/spec/settings-help-menu/settings-help-menu.spec.js @@ -0,0 +1,58 @@ +import React from 'react'; +import fetchMock from 'fetch-mock'; +import { shallow } from 'enzyme'; +import toJson from 'enzyme-to-json'; +import SettingsHelpMenu from '../../components/settings-help-menu-form'; + +describe('SettingsHelpMenu', () => { + const settingsHelpMenuMockData = [ + { + href: 'ops/settings_update_help_menu', + }, + ]; + + const initialValues = [ + { + title: 'title1', + href: 'href1', + type: 'type1', + }, + { + title: 'title2', + href: 'href2', + type: 'type2', + }, + { + title: 'title3', + href: 'href3', + type: 'type3', + }, + ]; + + const initialDropdownValues = [ + 'type1', + 'type2', + 'type3', + ]; + + afterEach(() => { + fetchMock.reset(); + fetchMock.restore(); + }); + + it('should submit a help menu change', async() => { + const wrapper = shallow(); + + fetchMock.get(`/ops/settings_update_help_menu/`, settingsHelpMenuMockData); + await new Promise((resolve) => { + setImmediate(() => { + wrapper.update(); + expect(toJson(wrapper)).toMatchSnapshot(); + resolve(); + }); + }); + }); +}); \ No newline at end of file diff --git a/app/stylesheet/application-webpack.scss b/app/stylesheet/application-webpack.scss index aa61b6787dc..829af1bdfc1 100644 --- a/app/stylesheet/application-webpack.scss +++ b/app/stylesheet/application-webpack.scss @@ -24,6 +24,7 @@ @import './quadicon.scss'; @import './search-bar.scss'; @import './settings.scss'; +@import './settings-help-menu-tab.scss'; @import './responsive_layout.scss'; @import './tags.scss'; @import './tree.scss'; diff --git a/app/stylesheet/settings-help-menu-tab.scss b/app/stylesheet/settings-help-menu-tab.scss new file mode 100644 index 00000000000..ceb733c4013 --- /dev/null +++ b/app/stylesheet/settings-help-menu-tab.scss @@ -0,0 +1,97 @@ +.settings-help-menu-tab { + display: flex; + width: 100%; + + form { + width: 100%; + display: flex; + justify-content: space-between; + } + + .col1, .col2, .col3, .labels { + display: flex; + flex-direction: column; + width: 25%; + } + .item-label, .url, .dropdown { + margin-bottom: -5%; + } +} + +.bx--btn-set { + position: absolute; + bottom: -20%; +} + +.title { + font-size: large; +} + +.info-box { + display: flex; + align-items: center; + background-color: #f0f0f0; + padding: 10px; + margin: 10px 0; + border: 1px solid black; + font-size: 16px; + font-weight: bold; +} + +.info-icon { + display: flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + background-color: #5a5a5a; + color: white; + font-weight: bold; + border-radius: 50%; + margin-right: 10px; +} + +.left-divider, .middle-divider, .right-divider, .divider { + border-top: 1px solid black; +} + +.middle-divider { + margin-left: -50%; + margin-right: -50% +} + +.flash-message { + display: flex; + align-items: center; + padding: 10px; + margin-bottom: 15px; + background-color: #dff0d8; + opacity: 0.7; + color: black; + border: 1px solid black; + position: relative; + font-weight: bold; + font-size: 16px; +} + +.flash-icon { + font-size: 16px; + font-weight: bold; + color: green; + width: 24px; + height: 24px; + display: inline-flex; + align-items: center; + justify-content: center; + border: 2px solid green; + border-radius: 50%; + margin-right: 2%; +} + +.flash-close { + margin-left: auto; + background: none; + border: none; + font-size: 24px; + cursor: pointer; +} \ No newline at end of file diff --git a/app/views/ops/_settings_help_menu_tab.html.haml b/app/views/ops/_settings_help_menu_tab.html.haml index a73a5f508bc..b9b9e142de2 100644 --- a/app/views/ops/_settings_help_menu_tab.html.haml +++ b/app/views/ops/_settings_help_menu_tab.html.haml @@ -1,44 +1,12 @@ -- if @sb[:active_tab] == "settings_help_menu" - - url = url_for_only_path(:action => 'help_menu_form_field_changed') +- initial_values = [] +- dropdown_values = [] +- Menu::DefaultMenu.help_menu_items.each do |item| + - val = @edit && @edit[:new][item.id.to_sym].try(:[], :type) || item.defaults[:type] + - title = @edit && @edit[:new][item.id.to_sym].try(:[], :title) || item.defaults[:title] + - href = @edit && @edit[:new][item.id.to_sym].try(:[], :href) || item.defaults[:href] + - initial_values << {title: title, href: href, type: val} + - dropdown_values << val - %h3= _("Customize Help Menu") - .alert.alert-info - %span.pficon.pficon-info - %strong - = _("Any change to the help menu will take effect upon a full page reload.") - = form_tag({:action => "settings_update_help_menu"}, :class => "form-horizontal", :method => :post) do - %table.table.table-borderless - %tr - %th - = _('Menu item label') - %th - = _('URL') - %th - = _('Open in') - - - Menu::DefaultMenu.help_menu_items.each do |item| - %tr - - val = @edit[:new][item.id.to_sym].try(:[], :type) || item.defaults[:type] - %td - = text_field_tag("#{item.id}_title", @edit[:new][item.id.to_sym].try(:[], :title), - :placeholder => item.defaults[:title], - :class => 'form-control', - 'data-miq_observe' => {:interval => '.5', :url => url}.to_json) - %td - = text_field_tag("#{item.id}_href", @edit[:new][item.id.to_sym].try(:[], :href), - :placeholder => item.defaults[:href], - :class => 'form-control', - 'data-miq_observe' => {:interval => '.5', :url => url}.to_json, - :disabled => val.to_s == 'modal') - %td - = select_tag("#{item.id}_type", options_for_select([[_("Current Window"), 'default'], - [_("New Window"), 'new_window'], - [_("About Modal"), 'modal']], val.to_s), - :class => 'selectpicker') - - :javascript - miqInitSelectPicker(); - miqSelectPickerEvent("#{item.id}_type", '#{url}') - $("##{item.id}_type").on('change', function() { - $("##{item.id}_href").prop('disabled', $(this).val() == 'modal'); - }); += react('SettingsHelpMenuTab', + :initialValues => initial_values, + :initialDropdownValues => dropdown_values) diff --git a/cypress/e2e/ui/Settings/SettingsHelpMenu.cy.js b/cypress/e2e/ui/Settings/SettingsHelpMenu.cy.js new file mode 100644 index 00000000000..65b1b99d181 --- /dev/null +++ b/cypress/e2e/ui/Settings/SettingsHelpMenu.cy.js @@ -0,0 +1,42 @@ +/* eslint-disable no-undef */ + +describe('Settings > Application Settings > Settings', () => { + beforeEach(() => { + cy.login(); + cy.intercept('POST', '/ops/accordion_select?id=rbac_accord').as('accordion'); + cy.menu('Settings', 'Application Settings'); + }); + + describe('Help Menu Form', () => { + beforeEach(() => { + cy.contains('ManageIQ Region').click({ force: true }); + cy.contains('Help Menu').click({ force: true }); + }); + + it('Changes menu title', () => { + cy.get('[name="item_label_1"]').clear({ force: true }); + cy.get('[name="item_label_1"]').type('changed', {force: true}); + cy.contains('Save').click({ force: true }); + cy.get('[name="item_label_1"]').should('have.value', 'changed'); + cy.get('[name="item_label_1"]').clear(); + cy.contains('Save').click({ force: true }); + }); + + it('Changes url', () => { + cy.get('[name="url_1"]').clear({ force: true }); + cy.get('[name="url_1"]').type('changed', {force: true}); + cy.contains('Save').click({ force: true }); + cy.get('[name="url_1"]').should('have.value', 'changed'); + cy.get('[name="url_1"]').clear(); + cy.contains('Save').click({ force: true }); + }); + + it('Changes dropdown', () => { + cy.get('#select_dropdown_1').invoke('val', 'default').trigger('change', { force: true }); + cy.contains('Save').click({ force: true }); + cy.get('[name="select_dropdown_1"]').should('have.value', 'default'); + cy.get('[name="select_dropdown_1"]').select('new_window', { force: true }); + cy.contains('Save').click({ force: true }); + }); + }); +}); From 872b1e99eaf766dfd4f2bd552641bcf54d1c8482 Mon Sep 17 00:00:00 2001 From: Samuel Liu Date: Tue, 19 Nov 2024 00:53:45 -0500 Subject: [PATCH 2/2] Fix typos and remove unneeded code --- .../settings-help-menu-form/index.jsx | 2 +- config/routes.rb | 1 - .../ops_controller/settings/help_menu_spec.rb | 29 ------------------- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 spec/controllers/ops_controller/settings/help_menu_spec.rb diff --git a/app/javascript/components/settings-help-menu-form/index.jsx b/app/javascript/components/settings-help-menu-form/index.jsx index a6cec41a7d8..f830468374f 100644 --- a/app/javascript/components/settings-help-menu-form/index.jsx +++ b/app/javascript/components/settings-help-menu-form/index.jsx @@ -30,7 +30,7 @@ const HelpMenuTab = ({ initialValues, initialDropdownValues }) => { ...data, isLoading: false, }); - add_flash(__('Storing the custom help menu configuration was not successful.'), 'failure'); + add_flash(__('Storing the custom help menu configuration was not successful.'), 'error'); window.location.reload(); }); setData({ ...data, isLoading: false }); diff --git a/config/routes.rb b/config/routes.rb index 2056e137c7d..6c5e404e706 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2444,7 +2444,6 @@ forest_delete forest_form_field_changed forest_select - help_menu_form_field_changed label_tag_mapping_delete label_tag_mapping_edit label_tag_mapping_update diff --git a/spec/controllers/ops_controller/settings/help_menu_spec.rb b/spec/controllers/ops_controller/settings/help_menu_spec.rb deleted file mode 100644 index d692bde64b0..00000000000 --- a/spec/controllers/ops_controller/settings/help_menu_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -describe OpsController do - describe 'OpsController::Settings::HelpMenu' do - include_context "valid session" - - describe '#help_menu_form_field_changed' do - let(:session) do - { - :edit => { - :new => { - :documentation => { - :title => 'something' - }, - }, - :key => 'customize_help_menu' - } - } - end - - before do - stub_user(:features => %w[region_edit]) - end - - it 'sets the form field value internally' do - post :help_menu_form_field_changed, :params => {:documentation_title => 'something_else'}, :session => session - expect(assigns(:edit)[:new][:documentation][:title]).to eq('something_else') - end - end - end -end