Skip to content

Commit

Permalink
Fix the disable of the Scan Network button
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 26, 2021
1 parent becea03 commit a587dae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/lib/y2network/widgets/wireless_essid.rb
Expand Up @@ -112,7 +112,7 @@ def label
end

def init
disable if @settings.newly_added?
disable unless present?
end

def handle
Expand All @@ -126,6 +126,10 @@ def handle

IWLIST_PKG = "wireless-tools".freeze

def present?
!!@settings.interface&.hardware&.present?
end

def scan_supported?
return true if install_needed_packages

Expand Down
6 changes: 3 additions & 3 deletions test/y2network/widgets/wireless_essid_test.rb
Expand Up @@ -48,11 +48,11 @@

describe "#init" do
before do
allow(builder).to receive(:newly_added?).and_return(newly_added?)
allow(subject).to receive(:present?).and_return(iface_present?)
end

context "when the interface exists" do
let(:newly_added?) { false }
let(:iface_present?) { true }

it "does not disable the button" do
expect(subject).to_not receive(:disable)
Expand All @@ -61,7 +61,7 @@
end

context "when the interface does not exist" do
let(:newly_added?) { true }
let(:iface_present?) { false }

it "disables the button" do
expect(subject).to receive(:disable)
Expand Down

0 comments on commit a587dae

Please sign in to comment.