Sha256: df4a63a8ec64ee5bffe9e574f627b799dd8075e5da9a21db0dc2dfbba4a331f9
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require 'swt_shoes/spec_helper' describe Shoes::Swt::ListBox do include_context "swt app" let(:items) { ["Pie", "Apple", "Sand"] } let(:dsl) { double('dsl', app: shoes_app, items: items, opts: {}, element_width: 200, element_height: 20).as_null_object } let(:block) { ->(){} } let(:real) { double('real', text: "", set_size: true, add_selection_listener: true, disposed?: false) } subject { Shoes::Swt::ListBox.new dsl, parent, &block } before :each do parent.stub(:real) ::Swt::Widgets::Combo.stub(:new) { real } end it_behaves_like "togglable" it "should return nil when nothing is highlighted" do subject.text.should be_nil end it "should call 'items' when updating values" do real.should_receive(:items=).with(["hello"]) subject.update_items(["hello"]) end it "should respond to choose" do subject.should respond_to :choose end it "should call text= when choosing" do real.should_receive(:text=).with "Bacon" subject.choose "Bacon" end describe "when the backend notifies us that the selection has changed" do it "should call the change listeners" do dsl.should_receive(:call_change_listeners) real.should_receive(:add_selection_listener) do |&blk| blk.call() end subject end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-4.0.0.pre1 | spec/swt_shoes/list_box_spec.rb |