Sha256: f27dd9c8d83b04eabc131dd475b50e00b0380bf51e2cc1534d76eea524eb9bfb
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
# encoding: utf-8 RSpec.describe TTY::Cursor do subject(:cursor) { described_class } it "shows cursor" do expect(cursor.show).to eq("\e[?25h") end it "hides cursor" do expect(cursor.hide).to eq("\e[?25l") end it "saves cursor position" do expect(cursor.save).to eq("\e[s") end it "restores cursor position" do expect(cursor.restore).to eq("\e[u") end it "gets current cursor position" do expect(cursor.current).to eq("\e[6n") end it "moves cursor up default by 1 line" do expect(cursor.up).to eq("\e[1A") end it "moves cursor up by 5 lines" do expect(cursor.up(5)).to eq("\e[5A") end it "moves cursor down default by 1 line" do expect(cursor.down).to eq("\e[1B") end it "moves cursor down by 5 lines" do expect(cursor.down(5)).to eq("\e[5B") end it "moves to line start" do expect(cursor.move_start).to eq("\e[1000D") end it "moves cursorleft by 1 line default" do expect(cursor.backward).to eq("\e[1D") end it "moves cursor left by 5" do expect(cursor.backward(5)).to eq("\e[5D") end it "moves cursor right by 1 line default" do expect(cursor.forward).to eq("\e[1C") end it "moves cursor right by 5 lines" do expect(cursor.forward(5)).to eq("\e[5C") end it "moves cursor to next line" do expect(cursor.next_line).to eq("\e[E") end it "moves cursor to previous line" do expect(cursor.prev_line).to eq("\e[A\e[1G") end it "hides cursor for the duration of block call" do stream = StringIO.new cursor.invisible(stream) { } expect(stream.string).to eq("\e[?25l\e[?25h") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tty-cursor-0.3.0 | spec/unit/cursor_spec.rb |