mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Fix SettingHelper for hidden field
This commit is contained in:
parent
ea74c384b5
commit
7d9a23cdcd
@ -12,7 +12,7 @@ module SettingsHelper
|
||||
def field_resolver(type, html, form, key, opts)
|
||||
case type
|
||||
when :hidden
|
||||
return form.hidden_field(key)
|
||||
html << form.hidden_field(key)
|
||||
when :boolean, :flag
|
||||
boolean_field(html, form, key, opts)
|
||||
when :choice
|
||||
|
||||
40
spec/features/fluentd/setting/out_forward_spec.rb
Normal file
40
spec/features/fluentd/setting/out_forward_spec.rb
Normal file
@ -0,0 +1,40 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_forward", stub: :daemon do
|
||||
before { login_with exists_user }
|
||||
|
||||
let(:type) { "out_forward" }
|
||||
let(:page_url) { send("daemon_setting_#{type}_path") }
|
||||
let(:form_values) { {
|
||||
Match: "*",
|
||||
Name: "name",
|
||||
Host: "host",
|
||||
Port: "9999",
|
||||
Path: "/dev/null",
|
||||
} }
|
||||
|
||||
it "Updated config after submit" do
|
||||
daemon.agent.config.should_not include("type file") # out_forward's Secondary hidden field
|
||||
form_values.each_pair do |k,v|
|
||||
daemon.agent.config.should_not include(v)
|
||||
end
|
||||
visit page_url
|
||||
within("#new_fluentd_setting_#{type}") do
|
||||
form_values.each_pair do |k,v|
|
||||
fill_in k, with: v
|
||||
end
|
||||
end
|
||||
click_button I18n.t("fluentd.common.finish")
|
||||
form_values.each_pair do |k,v|
|
||||
daemon.agent.config.should include(v)
|
||||
end
|
||||
daemon.agent.config.should include("type file") # out_forward's Secondary hidden field
|
||||
end
|
||||
|
||||
it "Click to append Server fields", js: true do
|
||||
visit page_url
|
||||
all(".js-multiple").length.should == 1
|
||||
first(".js-multiple .js-append").click
|
||||
all(".js-multiple").length.should == 2
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user