Skip to content

Commit

Permalink
Fixes #12659 - Fixed "inherit" behavior
Browse files Browse the repository at this point in the history
Non-inherited attributes are now sent in the form data.
  • Loading branch information
ShimShtein authored and Dominic Cleal committed Dec 11, 2015
1 parent 19d9e22 commit 6f65fd1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,17 @@ function disableButtonToggle(item, explicit) {
}

item = $(item);
item.data('explicit', explicit);
item.attr('data-explicit', explicit);
var isActive = item.hasClass("active");
var formControl = item.closest('.input-group').find('.form-control');
if (!isActive) {
var blankValue = formControl.children("option[value='']");
if (blankValue.length == 0) {
$(item).data('no-blank', true);
$(item).attr('data-no-blank', true);
$(formControl).append("<option value='' />");
}
} else {
var blankAttr = item.data('no-blank');
var blankAttr = item.attr('data-no-blank');
if (blankAttr == 'true') {
$(formControl).children("[value='']").remove();
}
Expand Down
31 changes: 31 additions & 0 deletions test/integration/host_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def class_params
page.find('#inherited_puppetclasses_parameters')
end

def select2(value, attrs)
first("#s2id_#{attrs[:from]}").click
find(".select2-input").set(value)
within ".select2-results" do
find("span", text: value).click
end
end

test "index page" do
assert_index_page(hosts_path,"Hosts","New Host")
end
Expand Down Expand Up @@ -109,6 +117,29 @@ def class_params
assert table.find('td.flags .provision-flag.active')
end

test 'enables override of hostgroup defaults' do
env1 = FactoryGirl.create(:environment)
env2 = FactoryGirl.create(:environment)
hg1 = FactoryGirl.create(:hostgroup, :environment => env1)
hg2 = FactoryGirl.create(:hostgroup, :environment => env2)

visit new_host_path

select2 hg1.name, :from => 'host_hostgroup_id'

Timeout.timeout(Capybara.default_wait_time) do
loop until page.evaluate_script('jQuery.active').zero?
end

find("#host_environment_id + .input-group-btn .btn").click

select2 hg2.name, :from => 'host_hostgroup_id'

environment = find("#s2id_host_environment_id .select2-chosen").text

assert_equal env1.name, environment
end

describe "NIC modal window" do
setup { skip "Temporarily disabled until issue #9138 gets resolved" }

Expand Down

0 comments on commit 6f65fd1

Please sign in to comment.