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.
84 lines
2.5 KiB
JavaScript
84 lines
2.5 KiB
JavaScript
/*!
|
|
* negotiator
|
|
* Copyright(c) 2012 Federico Romero
|
|
* Copyright(c) 2012-2014 Isaac Z. Schlueter
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
* MIT Licensed
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var preferredCharsets = require('./lib/charset')
|
|
var preferredEncodings = require('./lib/encoding')
|
|
var preferredLanguages = require('./lib/language')
|
|
var preferredMediaTypes = require('./lib/mediaType')
|
|
|
|
/**
|
|
* Module exports.
|
|
* @public
|
|
*/
|
|
|
|
module.exports = Negotiator;
|
|
module.exports.Negotiator = Negotiator;
|
|
|
|
/**
|
|
* Create a Negotiator instance from a request.
|
|
* @param {object} request
|
|
* @public
|
|
*/
|
|
|
|
function Negotiator(request) {
|
|
if (!(this instanceof Negotiator)) {
|
|
return new Negotiator(request);
|
|
}
|
|
|
|
this.request = request;
|
|
}
|
|
|
|
Negotiator.prototype.charset = function charset(available) {
|
|
var set = this.charsets(available);
|
|
return set && set[0];
|
|
};
|
|
|
|
Negotiator.prototype.charsets = function charsets(available) {
|
|
return preferredCharsets(this.request.headers['accept-charset'], available);
|
|
};
|
|
|
|
Negotiator.prototype.encoding = function encoding(available, opts) {
|
|
var set = this.encodings(available, opts);
|
|
return set && set[0];
|
|
};
|
|
|
|
Negotiator.prototype.encodings = function encodings(available, options) {
|
|
var opts = options || {};
|
|
return preferredEncodings(this.request.headers['accept-encoding'], available, opts.preferred);
|
|
};
|
|
|
|
Negotiator.prototype.language = function language(available) {
|
|
var set = this.languages(available);
|
|
return set && set[0];
|
|
};
|
|
|
|
Negotiator.prototype.languages = function languages(available) {
|
|
return preferredLanguages(this.request.headers['accept-language'], available);
|
|
};
|
|
|
|
Negotiator.prototype.mediaType = function mediaType(available) {
|
|
var set = this.mediaTypes(available);
|
|
return set && set[0];
|
|
};
|
|
|
|
Negotiator.prototype.mediaTypes = function mediaTypes(available) {
|
|
return preferredMediaTypes(this.request.headers.accept, available);
|
|
};
|
|
|
|
// Backwards compatibility
|
|
Negotiator.prototype.preferredCharset = Negotiator.prototype.charset;
|
|
Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;
|
|
Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;
|
|
Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;
|
|
Negotiator.prototype.preferredLanguage = Negotiator.prototype.language;
|
|
Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages;
|
|
Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;
|
|
Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;
|