forked from MapComplete/MapComplete
Fix tests
This commit is contained in:
parent
f05a7d239e
commit
5628be3632
4 changed files with 23 additions and 7 deletions
|
@ -11,7 +11,7 @@ export default class ChangeTagAction extends OsmChangeAction {
|
||||||
|
|
||||||
constructor(elementId: string, tagsFilter: TagsFilter, currentTags: any, meta: {
|
constructor(elementId: string, tagsFilter: TagsFilter, currentTags: any, meta: {
|
||||||
theme: string,
|
theme: string,
|
||||||
changeType: "answer" | "soft-delete"
|
changeType: "answer" | "soft-delete" | "add-image"
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
this._elementId = elementId;
|
this._elementId = elementId;
|
||||||
|
|
|
@ -16,7 +16,10 @@ export default class DeleteImage extends Toggle {
|
||||||
.SetClass("rounded-full p-1")
|
.SetClass("rounded-full p-1")
|
||||||
.SetStyle("color:white;background:#ff8c8c")
|
.SetStyle("color:white;background:#ff8c8c")
|
||||||
.onClick(async() => {
|
.onClick(async() => {
|
||||||
await State.state?.changes?.applyAction(new ChangeTagAction(tags.data.id, new Tag(key, oldValue), tags.data))
|
await State.state?.changes?.applyAction(new ChangeTagAction(tags.data.id, new Tag(key, oldValue), tags.data, {
|
||||||
|
changeType: "answer",
|
||||||
|
theme: "test"
|
||||||
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
const deleteButton = Translations.t.image.doDelete.Clone()
|
const deleteButton = Translations.t.image.doDelete.Clone()
|
||||||
|
@ -24,7 +27,10 @@ export default class DeleteImage extends Toggle {
|
||||||
.SetStyle("color:white;background:#ff8c8c; border-top-left-radius:30rem; border-top-right-radius: 30rem;")
|
.SetStyle("color:white;background:#ff8c8c; border-top-left-radius:30rem; border-top-right-radius: 30rem;")
|
||||||
.onClick( async() => {
|
.onClick( async() => {
|
||||||
await State.state?.changes?.applyAction(
|
await State.state?.changes?.applyAction(
|
||||||
new ChangeTagAction(tags.data.id, new Tag(key, ""), tags.data)
|
new ChangeTagAction(tags.data.id, new Tag(key, ""), tags.data,{
|
||||||
|
changeType: "answer",
|
||||||
|
theme: "test"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,11 @@ export class ImageUploadFlow extends Toggle {
|
||||||
console.log("Adding image:" + key, url);
|
console.log("Adding image:" + key, url);
|
||||||
Promise.resolve(State.state.changes
|
Promise.resolve(State.state.changes
|
||||||
.applyAction(new ChangeTagAction(
|
.applyAction(new ChangeTagAction(
|
||||||
tags.id, new Tag(key, url), tagsSource.data
|
tags.id, new Tag(key, url), tagsSource.data,
|
||||||
|
{
|
||||||
|
changeType: "add-image",
|
||||||
|
theme: State.state.layoutToUse.id
|
||||||
|
}
|
||||||
)))
|
)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,9 @@ export default class SplitActionSpec extends T {
|
||||||
// Lets split road https://www.openstreetmap.org/way/295132739
|
// Lets split road https://www.openstreetmap.org/way/295132739
|
||||||
const id = "way/295132739"
|
const id = "way/295132739"
|
||||||
const splitPoint: [number, number] = [3.246733546257019, 51.181710380278176]
|
const splitPoint: [number, number] = [3.246733546257019, 51.181710380278176]
|
||||||
const splitter = new SplitAction(id, [splitPoint])
|
const splitter = new SplitAction(id, [splitPoint], {
|
||||||
|
theme: "test"
|
||||||
|
})
|
||||||
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
||||||
|
|
||||||
equal(changeDescription[0].type, "node")
|
equal(changeDescription[0].type, "node")
|
||||||
|
@ -235,7 +237,9 @@ export default class SplitActionSpec extends T {
|
||||||
|
|
||||||
const id = "way/61435323"
|
const id = "way/61435323"
|
||||||
const splitPoint: [number, number] = [ 3.2021324336528774, 51.2170001600597]
|
const splitPoint: [number, number] = [ 3.2021324336528774, 51.2170001600597]
|
||||||
const splitter = new SplitAction(id, [splitPoint])
|
const splitter = new SplitAction(id, [splitPoint], {
|
||||||
|
theme: "test"
|
||||||
|
})
|
||||||
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
||||||
|
|
||||||
// Should be a new node
|
// Should be a new node
|
||||||
|
@ -247,7 +251,9 @@ export default class SplitActionSpec extends T {
|
||||||
// Lets split road near an already existing point https://www.openstreetmap.org/way/295132739
|
// Lets split road near an already existing point https://www.openstreetmap.org/way/295132739
|
||||||
const id = "way/295132739"
|
const id = "way/295132739"
|
||||||
const splitPoint: [number, number] = [3.2451081275939937, 51.18116898253599]
|
const splitPoint: [number, number] = [3.2451081275939937, 51.18116898253599]
|
||||||
const splitter = new SplitAction(id, [splitPoint])
|
const splitter = new SplitAction(id, [splitPoint], {
|
||||||
|
theme: "test"
|
||||||
|
})
|
||||||
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
const changeDescription = await splitter.CreateChangeDescriptions(new Changes())
|
||||||
|
|
||||||
equal(2, changeDescription.length)
|
equal(2, changeDescription.length)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue