Fix tests
This commit is contained in:
parent
cfa8ff896e
commit
7f6611f9d5
2 changed files with 27 additions and 13 deletions
|
@ -122,7 +122,10 @@ export class OsmConnection {
|
||||||
|
|
||||||
this.updateAuthObject()
|
this.updateAuthObject()
|
||||||
|
|
||||||
this.preferencesHandler = new OsmPreferences(this.auth, this)
|
this.preferencesHandler = new OsmPreferences(
|
||||||
|
this.auth,
|
||||||
|
<any /*This is needed to make the tests work*/>this
|
||||||
|
)
|
||||||
|
|
||||||
if (options.oauth_token?.data !== undefined) {
|
if (options.oauth_token?.data !== undefined) {
|
||||||
console.log(options.oauth_token.data)
|
console.log(options.oauth_token.data)
|
||||||
|
@ -146,7 +149,13 @@ export class OsmConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateChangesetHandler(allElements: ElementStorage, changes: Changes) {
|
public CreateChangesetHandler(allElements: ElementStorage, changes: Changes) {
|
||||||
return new ChangesetHandler(this._dryRun, this, allElements, changes, this.auth)
|
return new ChangesetHandler(
|
||||||
|
this._dryRun,
|
||||||
|
<any>/*casting is needed to make the tests work*/ this,
|
||||||
|
allElements,
|
||||||
|
changes,
|
||||||
|
this.auth
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetPreference(
|
public GetPreference(
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default class ScrollableFullScreen {
|
||||||
private hashToShow: string
|
private hashToShow: string
|
||||||
private _fullscreencomponent: BaseUIElement
|
private _fullscreencomponent: BaseUIElement
|
||||||
private _resetScrollSignal: UIEventSource<void> = new UIEventSource<void>(undefined)
|
private _resetScrollSignal: UIEventSource<void> = new UIEventSource<void>(undefined)
|
||||||
|
private _setHash: boolean
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
title: (options: { mode: string }) => BaseUIElement,
|
title: (options: { mode: string }) => BaseUIElement,
|
||||||
|
@ -32,12 +33,16 @@ export default class ScrollableFullScreen {
|
||||||
resetScrollSignal: UIEventSource<void>
|
resetScrollSignal: UIEventSource<void>
|
||||||
}) => BaseUIElement,
|
}) => BaseUIElement,
|
||||||
hashToShow: string,
|
hashToShow: string,
|
||||||
isShown: UIEventSource<boolean> = new UIEventSource<boolean>(false)
|
isShown: UIEventSource<boolean> = new UIEventSource<boolean>(false),
|
||||||
|
options?: {
|
||||||
|
setHash?: boolean
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
this.hashToShow = hashToShow
|
this.hashToShow = hashToShow
|
||||||
this.isShown = isShown
|
this.isShown = isShown
|
||||||
|
this._setHash = options?.setHash ?? true
|
||||||
|
|
||||||
if (hashToShow === undefined || hashToShow === "") {
|
if ((hashToShow === undefined || hashToShow === "") && this._setHash) {
|
||||||
throw "HashToShow should be defined as it is vital for the 'back' key functionality"
|
throw "HashToShow should be defined as it is vital for the 'back' key functionality"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,17 +57,18 @@ export default class ScrollableFullScreen {
|
||||||
)
|
)
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
Hash.hash.addCallback((h) => {
|
if (this._setHash) {
|
||||||
if (h === undefined) {
|
Hash.hash.addCallback((h) => {
|
||||||
isShown.setData(false)
|
if (h === undefined) {
|
||||||
}
|
isShown.setData(false)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
isShown.addCallbackD((isShown) => {
|
isShown.addCallbackD((isShown) => {
|
||||||
if (isShown) {
|
if (isShown) {
|
||||||
// We first must set the hash, then activate the panel
|
// We first must set the hash, then activate the panel
|
||||||
// If the order is wrong, this will cause the panel to disactivate again
|
// If the order is wrong, this will cause the panel to disactivate again
|
||||||
Hash.hash.setData(hashToShow)
|
|
||||||
ScrollableFullScreen._currentlyOpen = self
|
ScrollableFullScreen._currentlyOpen = self
|
||||||
self.Activate()
|
self.Activate()
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,7 +80,6 @@ export default class ScrollableFullScreen {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (isShown.data) {
|
if (isShown.data) {
|
||||||
Hash.hash.setData(hashToShow)
|
|
||||||
ScrollableFullScreen._currentlyOpen = self
|
ScrollableFullScreen._currentlyOpen = self
|
||||||
this.Activate()
|
this.Activate()
|
||||||
}
|
}
|
||||||
|
@ -111,10 +116,10 @@ export default class ScrollableFullScreen {
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
public Activate(): void {
|
public Activate(): void {
|
||||||
this.isShown.setData(true)
|
if (this.hashToShow && this.hashToShow !== "" && this._setHash) {
|
||||||
if (this.hashToShow && this.hashToShow !== "") {
|
|
||||||
Hash.hash.setData(this.hashToShow)
|
Hash.hash.setData(this.hashToShow)
|
||||||
}
|
}
|
||||||
|
this.isShown.setData(true)
|
||||||
this._fullscreencomponent.AttachTo("fullscreen")
|
this._fullscreencomponent.AttachTo("fullscreen")
|
||||||
const fs = document.getElementById("fullscreen")
|
const fs = document.getElementById("fullscreen")
|
||||||
ScrollableFullScreen._currentlyOpen = this
|
ScrollableFullScreen._currentlyOpen = this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue