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.
136 lines
4.2 KiB
JavaScript
Executable File
136 lines
4.2 KiB
JavaScript
Executable File
"use strict";
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = void 0;
|
|
exports.applyToUpdateRecorder = applyToUpdateRecorder;
|
|
/**
|
|
* An operation that does nothing.
|
|
*/
|
|
class NoopChange {
|
|
description = 'No operation.';
|
|
order = Infinity;
|
|
path = null;
|
|
apply() {
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
exports.NoopChange = NoopChange;
|
|
/**
|
|
* Will add text to the source code.
|
|
*/
|
|
class InsertChange {
|
|
path;
|
|
pos;
|
|
toAdd;
|
|
order;
|
|
description;
|
|
constructor(path, pos, toAdd) {
|
|
this.path = path;
|
|
this.pos = pos;
|
|
this.toAdd = toAdd;
|
|
if (pos < 0) {
|
|
throw new Error('Negative positions are invalid');
|
|
}
|
|
this.description = `Inserted ${toAdd} into position ${pos} of ${path}`;
|
|
this.order = pos;
|
|
}
|
|
/**
|
|
* This method does not insert spaces if there is none in the original string.
|
|
*/
|
|
apply(host) {
|
|
return host.read(this.path).then((content) => {
|
|
const prefix = content.substring(0, this.pos);
|
|
const suffix = content.substring(this.pos);
|
|
return host.write(this.path, `${prefix}${this.toAdd}${suffix}`);
|
|
});
|
|
}
|
|
}
|
|
exports.InsertChange = InsertChange;
|
|
/**
|
|
* Will remove text from the source code.
|
|
*/
|
|
class RemoveChange {
|
|
path;
|
|
pos;
|
|
toRemove;
|
|
order;
|
|
description;
|
|
constructor(path, pos, toRemove) {
|
|
this.path = path;
|
|
this.pos = pos;
|
|
this.toRemove = toRemove;
|
|
if (pos < 0) {
|
|
throw new Error('Negative positions are invalid');
|
|
}
|
|
this.description = `Removed ${toRemove} into position ${pos} of ${path}`;
|
|
this.order = pos;
|
|
}
|
|
apply(host) {
|
|
return host.read(this.path).then((content) => {
|
|
const prefix = content.substring(0, this.pos);
|
|
const suffix = content.substring(this.pos + this.toRemove.length);
|
|
// TODO: throw error if toRemove doesn't match removed string.
|
|
return host.write(this.path, `${prefix}${suffix}`);
|
|
});
|
|
}
|
|
}
|
|
exports.RemoveChange = RemoveChange;
|
|
/**
|
|
* Will replace text from the source code.
|
|
*/
|
|
class ReplaceChange {
|
|
path;
|
|
pos;
|
|
oldText;
|
|
newText;
|
|
order;
|
|
description;
|
|
constructor(path, pos, oldText, newText) {
|
|
this.path = path;
|
|
this.pos = pos;
|
|
this.oldText = oldText;
|
|
this.newText = newText;
|
|
if (pos < 0) {
|
|
throw new Error('Negative positions are invalid');
|
|
}
|
|
this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`;
|
|
this.order = pos;
|
|
}
|
|
apply(host) {
|
|
return host.read(this.path).then((content) => {
|
|
const prefix = content.substring(0, this.pos);
|
|
const suffix = content.substring(this.pos + this.oldText.length);
|
|
const text = content.substring(this.pos, this.pos + this.oldText.length);
|
|
if (text !== this.oldText) {
|
|
return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`));
|
|
}
|
|
// TODO: throw error if oldText doesn't match removed string.
|
|
return host.write(this.path, `${prefix}${this.newText}${suffix}`);
|
|
});
|
|
}
|
|
}
|
|
exports.ReplaceChange = ReplaceChange;
|
|
function applyToUpdateRecorder(recorder, changes) {
|
|
for (const change of changes) {
|
|
if (change instanceof InsertChange) {
|
|
recorder.insertLeft(change.pos, change.toAdd);
|
|
}
|
|
else if (change instanceof RemoveChange) {
|
|
recorder.remove(change.order, change.toRemove.length);
|
|
}
|
|
else if (change instanceof ReplaceChange) {
|
|
recorder.remove(change.order, change.oldText.length);
|
|
recorder.insertLeft(change.order, change.newText);
|
|
}
|
|
else if (!(change instanceof NoopChange)) {
|
|
throw new Error('Unknown Change type encountered when updating a recorder.');
|
|
}
|
|
}
|
|
}
|
|
//# sourceMappingURL=change.js.map
|