Sha256: ed7acf8f644177175caabe40481ae65a5831c1e5e4138671690d72e7a33fedb5
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require_relative '../helper' MajorMode = VER::MajorMode MinorMode = VER::MinorMode Action = VER::Action Keymap = VER::Keymap WMM = VER::WidgetMajorMode VER.spec do describe VER::WidgetMajorMode do before do MajorMode.clear MinorMode.clear end it 'associates a widget with a major mode' do entry = Tk::Entry.new major = MajorMode[:entry] major.map(:get, ['g']) wmm = WMM.new(entry, major) wmm.widget.should == entry wmm.major.should == major action = wmm.resolve(['g']) action.mode.should == major action.invocation.should == :get action.handler.should == nil entry.destroy end it 'inserts the major tag into the widget bindtags' do entry = Tk::Entry.new major = MajorMode[:entry] major.map(:get, ['g']) wmm = WMM.new(entry, major) entry.bindtags[1].should == major.tag.name entry.destroy end it 'binds all the keys of its major and minor modes' do entry = Tk::Entry.new major = MajorMode[:entry] major.map(:get, ['g']) wmm = WMM.new(entry, major) (wmm.tag.bind & %w[g]).should == %w[g] entry.destroy end it 'binds all keys found in its minor modes to the tag' do entry = Tk::Entry.new major = MajorMode[:major] minoa = MinorMode[:minoa] minob = MinorMode[:minob] major.use(:minoa, :minob) major.map(:major1, ['m', '1']) minoa.map(:minoa2, ['a', '2']) minob.map(:minob3, ['b', '3']) wmm = WMM.new(entry, major) (wmm.tag.bind.sort & %w[1 2 3 a b m]).should == %w[1 2 3 a b m] entry.destroy end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ver-2010.08 | spec/ver/widget_major_mode.rb |