mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
minor tweaks to make some tests pass
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user