Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make the clipboard work again
  • Loading branch information
rdp committed Feb 8, 2010
1 parent 7422b21 commit 3961580
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/application/lib/application/clipboard.rb
Expand Up @@ -61,8 +61,11 @@ def silently_add(text)
private

def check_for_changes
if controller and controller.changed? && @contents.length > 0
controller.last_set = @contents.last.join("\n")
#puts 'check_for_changes', controller, controller.changed?, @contents.length
if controller and controller.changed?
if @contents.length > 0
controller.last_set = @contents.last.join("\n")
end
contents = controller.get_contents
self << contents if contents
end
Expand Down
12 changes: 12 additions & 0 deletions plugins/application/spec/application/clipboard_spec.rb
Expand Up @@ -30,10 +30,22 @@
it "loads well when the clipboard starts as blank" do
cont = "fake controller"
def cont.changed?; true; end
def cont.last_set=(something); @a = something;end
def cont.get_contents; @a; end
@clipboard.controller = cont
@clipboard.length.should == 0 # shouldn't blow up
end

it "should allow for the controller to return contents" do
cont = "fake controller"
def cont.changed?; true; end
def cont.last_set=(something); @a = something;end
def cont.get_contents; @a; end
@clipboard.controller = cont
@clipboard << "yo"
@clipboard.length.should == 2
end

it "has a maximum length" do
(Redcar::Clipboard.max_length + 1).times do |i|
@clipboard << "foo#{i}"
Expand Down

0 comments on commit 3961580

Please sign in to comment.