-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow table rotation and resizing to be disabled #36
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
let(:renderer) { TTY::Table::Renderer::Basic.new(table, options) } | ||
|
||
context 'with resize' do | ||
let(:options) { { width: 8, resize: true } } | ||
let(:options) { { width: 8, resize: true, rotate: true } } | ||
|
||
it 'calls shrink' do | ||
allow(columns).to receive(:shrink) | ||
|
@@ -42,8 +42,8 @@ | |
end | ||
end | ||
|
||
context 'without resize' do | ||
let(:options) { { width: 8, resize: false }} | ||
context 'with rotate and without resize' do | ||
let(:options) { { width: 8, resize: false, rotate: true } } | ||
|
||
it 'changes table orientation to vertical' do | ||
allow(Kernel).to receive(:warn) | ||
|
@@ -54,6 +54,17 @@ | |
expect(table.orientation.name).to eql(:vertical) | ||
end | ||
end | ||
|
||
context 'without resize nor rotate' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
let(:options) { { width: 8, resize: false, rotate: false } } | ||
|
||
it 'does not alter the column width nor table orientation' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
expect(columns).not_to receive(:shrink) | ||
column_widths = columns.enforce | ||
expect(column_widths).to eql([2,2,2,2]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/SpaceAfterComma: Space missing after comma. |
||
expect(table.orientation.name).to eql(:horizontal) | ||
end | ||
end | ||
end | ||
|
||
context 'with table less than allowed width' do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.