From 831ee85d2e10c5c2cc38f33704af9a0042d4ed5b Mon Sep 17 00:00:00 2001 From: Anthony Cook Date: Wed, 11 Oct 2023 12:39:53 -0500 Subject: [PATCH] Test for that resize bug fixed a few commits ago --- spec/frame_size_spec.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 spec/frame_size_spec.rb diff --git a/spec/frame_size_spec.rb b/spec/frame_size_spec.rb new file mode 100644 index 0000000..1c102e2 --- /dev/null +++ b/spec/frame_size_spec.rb @@ -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