Skip to content

Commit

Permalink
Test for that resize bug fixed a few commits ago
Browse files Browse the repository at this point in the history
  • Loading branch information
acook committed Oct 11, 2023
1 parent 7b29e10 commit 831ee85
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions spec/frame_size_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require_relative "spec_helper"
require "remedy/frame"

describe Remedy::Frame do
let(:sizeclass) { ::Remedy::Tuple }
let(:console_size) { sizeclass.new 6, 6 }
subject(:f) do
f0 = described_class.new name: "subject"
f0.available_size = console_size
f0.arrangement = :stacked
f0
end

before do
f << "foo"
f << "bar\nbaz"
end

xit "occupies the size specified" do
f.size = Tuple 5, 5
actual = f.to_s
expect(actual).to eq "???"
end

describe "#resize" do
let(:new_size) { sizeclass.new 5, 5 }

before do
f.size = :fill
end

it "it resizes the buffer" do
f.compile_contents
expect(f.compute_actual_size).to eq console_size
f.available_size = new_size
expect(f.compute_actual_size).to eq new_size
f.compile_contents # buffer size is not updated until recompile
expect(f.buffer.size).to eq new_size
end
end
end

0 comments on commit 831ee85

Please sign in to comment.