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.
119 lines
3.0 KiB
JavaScript
119 lines
3.0 KiB
JavaScript
"use strict";
|
|
module.exports = function(
|
|
Promise, PromiseArray, tryConvertToPromise, apiRejection) {
|
|
var util = require("./util");
|
|
var isObject = util.isObject;
|
|
var es5 = require("./es5");
|
|
var Es6Map;
|
|
if (typeof Map === "function") Es6Map = Map;
|
|
|
|
var mapToEntries = (function() {
|
|
var index = 0;
|
|
var size = 0;
|
|
|
|
function extractEntry(value, key) {
|
|
this[index] = value;
|
|
this[index + size] = key;
|
|
index++;
|
|
}
|
|
|
|
return function mapToEntries(map) {
|
|
size = map.size;
|
|
index = 0;
|
|
var ret = new Array(map.size * 2);
|
|
map.forEach(extractEntry, ret);
|
|
return ret;
|
|
};
|
|
})();
|
|
|
|
var entriesToMap = function(entries) {
|
|
var ret = new Es6Map();
|
|
var length = entries.length / 2 | 0;
|
|
for (var i = 0; i < length; ++i) {
|
|
var key = entries[length + i];
|
|
var value = entries[i];
|
|
ret.set(key, value);
|
|
}
|
|
return ret;
|
|
};
|
|
|
|
function PropertiesPromiseArray(obj) {
|
|
var isMap = false;
|
|
var entries;
|
|
if (Es6Map !== undefined && obj instanceof Es6Map) {
|
|
entries = mapToEntries(obj);
|
|
isMap = true;
|
|
} else {
|
|
var keys = es5.keys(obj);
|
|
var len = keys.length;
|
|
entries = new Array(len * 2);
|
|
for (var i = 0; i < len; ++i) {
|
|
var key = keys[i];
|
|
entries[i] = obj[key];
|
|
entries[i + len] = key;
|
|
}
|
|
}
|
|
this.constructor$(entries);
|
|
this._isMap = isMap;
|
|
this._init$(undefined, isMap ? -6 : -3);
|
|
}
|
|
util.inherits(PropertiesPromiseArray, PromiseArray);
|
|
|
|
PropertiesPromiseArray.prototype._init = function () {};
|
|
|
|
PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
|
this._values[index] = value;
|
|
var totalResolved = ++this._totalResolved;
|
|
if (totalResolved >= this._length) {
|
|
var val;
|
|
if (this._isMap) {
|
|
val = entriesToMap(this._values);
|
|
} else {
|
|
val = {};
|
|
var keyOffset = this.length();
|
|
for (var i = 0, len = this.length(); i < len; ++i) {
|
|
val[this._values[i + keyOffset]] = this._values[i];
|
|
}
|
|
}
|
|
this._resolve(val);
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
|
|
PropertiesPromiseArray.prototype.shouldCopyValues = function () {
|
|
return false;
|
|
};
|
|
|
|
PropertiesPromiseArray.prototype.getActualLength = function (len) {
|
|
return len >> 1;
|
|
};
|
|
|
|
function props(promises) {
|
|
var ret;
|
|
var castValue = tryConvertToPromise(promises);
|
|
|
|
if (!isObject(castValue)) {
|
|
return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
|
} else if (castValue instanceof Promise) {
|
|
ret = castValue._then(
|
|
Promise.props, undefined, undefined, undefined, undefined);
|
|
} else {
|
|
ret = new PropertiesPromiseArray(castValue).promise();
|
|
}
|
|
|
|
if (castValue instanceof Promise) {
|
|
ret._propagateFrom(castValue, 2);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
Promise.prototype.props = function () {
|
|
return props(this);
|
|
};
|
|
|
|
Promise.props = function (promises) {
|
|
return props(promises);
|
|
};
|
|
};
|