60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
90 lines
1.7 KiB
Markdown
90 lines
1.7 KiB
Markdown
# @inquirer/ansi
|
|
|
|
A lightweight package providing ANSI escape sequences for terminal cursor manipulation and screen clearing.
|
|
|
|
# Installation
|
|
|
|
<table>
|
|
<tr>
|
|
<th>npm</th>
|
|
<th>yarn</th>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
|
|
```sh
|
|
npm install @inquirer/ansi
|
|
```
|
|
|
|
</td>
|
|
<td>
|
|
|
|
```sh
|
|
yarn add @inquirer/ansi
|
|
```
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
## Usage
|
|
|
|
```js
|
|
import {
|
|
cursorUp,
|
|
cursorDown,
|
|
cursorTo,
|
|
cursorLeft,
|
|
cursorHide,
|
|
cursorShow,
|
|
eraseLines,
|
|
} from '@inquirer/ansi';
|
|
|
|
// Move cursor up 3 lines
|
|
process.stdout.write(cursorUp(3));
|
|
|
|
// Move cursor to specific position (x: 10, y: 5)
|
|
process.stdout.write(cursorTo(10, 5));
|
|
|
|
// Hide/show cursor
|
|
process.stdout.write(cursorHide);
|
|
process.stdout.write(cursorShow);
|
|
|
|
// Clear 5 lines
|
|
process.stdout.write(eraseLines(5));
|
|
```
|
|
|
|
Or when used inside an inquirer prompt:
|
|
|
|
```js
|
|
import { cursorHide } from '@inquirer/ansi';
|
|
import { createPrompt } from '@inquirer/core';
|
|
|
|
export default createPrompt((config, done: (value: void) => void) => {
|
|
return `Choose an option${cursorHide}`;
|
|
});
|
|
```
|
|
|
|
## API
|
|
|
|
### Cursor Movement
|
|
|
|
- **`cursorUp(count?: number)`** - Move cursor up by `count` lines (default: 1)
|
|
- **`cursorDown(count?: number)`** - Move cursor down by `count` lines (default: 1)
|
|
- **`cursorTo(x: number, y?: number)`** - Move cursor to position (x, y). If y is omitted, only moves horizontally
|
|
- **`cursorLeft`** - Move cursor to beginning of line
|
|
|
|
### Cursor Visibility
|
|
|
|
- **`cursorHide`** - Hide the cursor
|
|
- **`cursorShow`** - Show the cursor
|
|
|
|
### Screen Manipulation
|
|
|
|
- **`eraseLines(count: number)`** - Clear `count` lines and position cursor at the beginning of the first cleared line
|
|
|
|
# License
|
|
|
|
Copyright (c) 2025 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
|
|
Licensed under the MIT license.
|