Skip to content

Commit

Permalink
more tests and fix missing label abstract method in PushButton
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 18, 2016
1 parent 858832a commit 16b8771
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/cwm/src/lib/cwm/widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ def value=(val)
# end
class PushButton < AbstractWidget
self.widget_type = :push_button

abstract_method :label
end

# Widget representing menu button with its submenu
Expand Down
50 changes: 50 additions & 0 deletions library/cwm/test/widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,56 @@ def initialize
expect(TNotHandleEvents.new.cwm_definition).to_not be_key("handle_events")
end
end

class TInit < CWM::AbstractWidget
self.widget_type = :empty
def init
end
end

it "returns hash with key init when init method defined" do
expect(TInit.new.cwm_definition).to be_key("init")
end

class THandle1 < CWM::AbstractWidget
self.widget_type = :empty
def handle
end
end

it "returns hash with key handle when handle without parameter defined" do
expect(THandle1.new.cwm_definition).to be_key("handle")
end

class THandle2 < CWM::AbstractWidget
self.widget_type = :empty
def handle(event)
end
end

it "returns hash with key handle when handle with parameter defined" do
expect(THandle2.new.cwm_definition).to be_key("handle")
end

class TStore < CWM::AbstractWidget
self.widget_type = :empty
def store
end
end

it "returns hash with key store when store method defined" do
expect(TStore.new.cwm_definition).to be_key("store")
end

class TCleanup < CWM::AbstractWidget
self.widget_type = :empty
def cleanup
end
end

it "returns hash with key cleanup when cleanup method defined" do
expect(TCleanup.new.cwm_definition).to be_key("cleanup")
end
end
end

Expand Down

0 comments on commit 16b8771

Please sign in to comment.