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.
139 lines
3.6 KiB
JavaScript
139 lines
3.6 KiB
JavaScript
const readWasm = require("../lib/read-wasm");
|
|
|
|
/**
|
|
* Provide the JIT with a nice shape / hidden class.
|
|
*/
|
|
function Mapping() {
|
|
this.generatedLine = 0;
|
|
this.generatedColumn = 0;
|
|
this.lastGeneratedColumn = null;
|
|
this.source = null;
|
|
this.originalLine = null;
|
|
this.originalColumn = null;
|
|
this.name = null;
|
|
}
|
|
|
|
let cachedWasm = null;
|
|
|
|
module.exports = function wasm() {
|
|
if (cachedWasm) {
|
|
return cachedWasm;
|
|
}
|
|
|
|
const callbackStack = [];
|
|
|
|
cachedWasm = readWasm()
|
|
.then(buffer => {
|
|
return WebAssembly.instantiate(buffer, {
|
|
env: {
|
|
mapping_callback(
|
|
generatedLine,
|
|
generatedColumn,
|
|
|
|
hasLastGeneratedColumn,
|
|
lastGeneratedColumn,
|
|
|
|
hasOriginal,
|
|
source,
|
|
originalLine,
|
|
originalColumn,
|
|
|
|
hasName,
|
|
name
|
|
) {
|
|
const mapping = new Mapping();
|
|
// JS uses 1-based line numbers, wasm uses 0-based.
|
|
mapping.generatedLine = generatedLine + 1;
|
|
mapping.generatedColumn = generatedColumn;
|
|
|
|
if (hasLastGeneratedColumn) {
|
|
// JS uses inclusive last generated column, wasm uses exclusive.
|
|
mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
|
|
}
|
|
|
|
if (hasOriginal) {
|
|
mapping.source = source;
|
|
// JS uses 1-based line numbers, wasm uses 0-based.
|
|
mapping.originalLine = originalLine + 1;
|
|
mapping.originalColumn = originalColumn;
|
|
|
|
if (hasName) {
|
|
mapping.name = name;
|
|
}
|
|
}
|
|
|
|
callbackStack[callbackStack.length - 1](mapping);
|
|
},
|
|
|
|
start_all_generated_locations_for() {
|
|
console.time("all_generated_locations_for");
|
|
},
|
|
end_all_generated_locations_for() {
|
|
console.timeEnd("all_generated_locations_for");
|
|
},
|
|
|
|
start_compute_column_spans() {
|
|
console.time("compute_column_spans");
|
|
},
|
|
end_compute_column_spans() {
|
|
console.timeEnd("compute_column_spans");
|
|
},
|
|
|
|
start_generated_location_for() {
|
|
console.time("generated_location_for");
|
|
},
|
|
end_generated_location_for() {
|
|
console.timeEnd("generated_location_for");
|
|
},
|
|
|
|
start_original_location_for() {
|
|
console.time("original_location_for");
|
|
},
|
|
end_original_location_for() {
|
|
console.timeEnd("original_location_for");
|
|
},
|
|
|
|
start_parse_mappings() {
|
|
console.time("parse_mappings");
|
|
},
|
|
end_parse_mappings() {
|
|
console.timeEnd("parse_mappings");
|
|
},
|
|
|
|
start_sort_by_generated_location() {
|
|
console.time("sort_by_generated_location");
|
|
},
|
|
end_sort_by_generated_location() {
|
|
console.timeEnd("sort_by_generated_location");
|
|
},
|
|
|
|
start_sort_by_original_location() {
|
|
console.time("sort_by_original_location");
|
|
},
|
|
end_sort_by_original_location() {
|
|
console.timeEnd("sort_by_original_location");
|
|
},
|
|
},
|
|
});
|
|
})
|
|
.then(Wasm => {
|
|
return {
|
|
exports: Wasm.instance.exports,
|
|
withMappingCallback: (mappingCallback, f) => {
|
|
callbackStack.push(mappingCallback);
|
|
try {
|
|
f();
|
|
} finally {
|
|
callbackStack.pop();
|
|
}
|
|
},
|
|
};
|
|
})
|
|
.then(null, e => {
|
|
cachedWasm = null;
|
|
throw e;
|
|
});
|
|
|
|
return cachedWasm;
|
|
};
|