Chore: make method private, add tests

This commit is contained in:
Pieter Vander Vennet 2024-01-16 04:04:17 +01:00
parent 876c766130
commit a9e145076d
2 changed files with 7 additions and 2 deletions

View file

@ -610,6 +610,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
* const target = {"id":"test"}
* const result = Utils.Merge(source, target)
* result // => {"id":"test","condition":{"and":["xyz"]}}
*
* const source = {"=name": {"en": "XYZ"}}
* const target = {"name":null, "x":"y"}
* const result = Utils.Merge(source, target)
* result // => {"name": {"en": "XYZ"}, "x": "y"}
*/
static Merge<T, S>(source: Readonly<S>, target: T): T & S {
if (target === null) {
@ -1451,7 +1456,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
public static scrollIntoView(element: HTMLBaseElement | HTMLDivElement) {
// Is the element completely in the view?
const parentRect = Utils.findParentWithScrolling(element)?.getBoundingClientRect()
if(!parentRect){
if (!parentRect) {
return
}
const elementRect = element.getBoundingClientRect()