minor tweaks to make some tests pass

This commit is contained in:
Kyle Hensel
2024-09-03 19:15:16 +10:00
parent 90c4241723
commit 7afecd39ec
14 changed files with 35 additions and 25 deletions
+3
View File
@@ -23,6 +23,9 @@ export * from './validations/index';
// This is only done in testing because of the performance penalty.
export let debug = false;
/** @param {boolean} newValue */
export const setDebug = (newValue) => { debug = newValue; };
// Reexport just what our tests use, see #4379
import * as D3 from 'd3';
export let d3 = {
+1 -1
View File
@@ -11,7 +11,7 @@ import { IntervalTasksQueue } from '../util/IntervalTasksQueue';
var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
// listen for DPI change, e.g. when dragging a browser window from a retina to non-retina screen
window.matchMedia(`
window.matchMedia?.(`
(-webkit-min-device-pixel-ratio: 2), /* Safari */
(min-resolution: 2dppx), /* standard */
(min-resolution: 192dpi) /* fallback */
+1 -10
View File
@@ -34,18 +34,9 @@ async function fetchAvailableLayers() {
const urlForRequest = owsEndpoint + utilQsString(params);
const response = await d3_xml(urlForRequest);
const xPathSelector = '/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name';
const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
const NSResolver = response.createNSResolver(response);
const l = response.evaluate(
xPathSelector,
response,
NSResolver,
XPathResult.ANY_TYPE
);
let node;
const availableLayers = [];
while ( (node = l.iterateNext()) !== null ) {
for (const node of response.querySelectorAll('FeatureType > Name')) {
const match = node.textContent?.match(regexMatcher);
if (match) {
availableLayers.push({
+1 -1
View File
@@ -298,7 +298,7 @@ export function uiCombobox(context, klass) {
// https://stackoverflow.com/questions/11039885/scrollintoview-causing-the-whole-page-to-move
var selected = combo.selectAll('.combobox-option.selected').node();
if (selected) {
selected.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
selected.scrollIntoView?.({ behavior: 'smooth', block: 'nearest' });
}
}