Revision e0c9ad0a
Added by Shimon Shtein over 8 years ago
app/assets/javascripts/host_edit.js | ||
---|---|---|
function reset_explicit_values(element) {
|
||
$("[name=is_overridden_btn]").each(function(i, btn) {
|
||
var item = $(btn)
|
||
item.attr('data-explicit', false);
|
||
var formControl = item.closest('.input-group').find('.form-control');
|
||
formControl.attr('disabled', true);
|
||
})
|
||
}
|
||
|
||
... | ... | |
|
||
//Serializes only those input elements from form that are set explicitly
|
||
function serializeForm() {
|
||
return $($('form')[0].elements).filter(isExplicit).serialize()
|
||
}
|
||
|
||
//This function decides for a given input element is it set explicitly by the user.
|
||
function isExplicit(index, element) {
|
||
if (element.nextSibling == undefined) return true;
|
||
if (element.nextSibling.children == undefined) return true;
|
||
if (element.nextSibling.children[0] == undefined) return true;
|
||
if (element.nextSibling.children[0].dataset == undefined) return true;
|
||
if (element.nextSibling.children[0].dataset.explicit == undefined) return true;
|
||
return element.nextSibling.children[0].dataset.explicit == 'true';
|
||
return $('form').serialize()
|
||
}
|
||
|
||
function subnet_contains(number, cidr, ip){
|
test/integration/hostgroup_test.rb | ||
---|---|---|
click_link 'Parameters'
|
||
assert page.has_no_selector?('#params tr.has-error')
|
||
end
|
||
|
||
describe 'JS enabled tests' do
|
||
setup do
|
||
@old_driver = Capybara.current_driver
|
||
Capybara.current_driver = Capybara.javascript_driver
|
||
login_admin
|
||
end
|
||
|
||
teardown do
|
||
Capybara.current_driver = @old_driver
|
||
end
|
||
|
||
test 'submit updates taxonomy' do
|
||
group = FactoryGirl.create(:hostgroup, :with_puppetclass)
|
||
new_location = FactoryGirl.create(:location)
|
||
|
||
visit edit_hostgroup_path(group)
|
||
page.find(:css, "a[href='#locations']").click()
|
||
select_from_list 'hostgroup_location_ids', new_location
|
||
|
||
click_button "Submit"
|
||
#wait for submit to finish
|
||
page.find('#search-form')
|
||
|
||
group.locations.reload
|
||
|
||
assert_not_nil group.locations.first{ |l| l.name == new_location.name }
|
||
end
|
||
end
|
||
|
||
private
|
||
|
||
def select_from_list(list_id, item)
|
||
span = page.all(:css, "#ms-#{list_id} .ms-selectable ul li span").first{ |i| i.text == item.name }
|
||
span.click
|
||
end
|
||
end
|
Also available in: Unified diff
Fixes #12793 - reverted field filtration to enabled fields only
(cherry picked from commit 77b36c947ac954393dd2e7a09abfcaf4bc959bc9)