forked from MapComplete/MapComplete
Fix popups and core functionality
This commit is contained in:
parent
9cc721abad
commit
8ad9b816ac
13 changed files with 116 additions and 144 deletions
|
@ -190,12 +190,6 @@ export default class TagSpec extends T{
|
|||
]
|
||||
};
|
||||
|
||||
const constr = new TagRenderingConfig(def, undefined, "test");
|
||||
const uiEl = new EditableTagRendering(new UIEventSource<any>(
|
||||
{leisure: "park", "access": "no"}), constr
|
||||
);
|
||||
const rendered = uiEl.ConstructElement().innerHTML;
|
||||
equal(true, rendered.indexOf("Niet toegankelijk") > 0)
|
||||
|
||||
}
|
||||
], [
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
import T from "./TestHelper";
|
||||
import {Utils} from "../Utils";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
import TagRenderingQuestion from "../UI/Popup/TagRenderingQuestion";
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
import TagRenderingConfig from "../Customizations/JSON/TagRenderingConfig";
|
||||
|
||||
export default class TagQuestionSpec extends T {
|
||||
constructor() {
|
||||
super("TagQuestionElement",
|
||||
[
|
||||
["Freeform has textfield", () => {
|
||||
const tags = new UIEventSource({
|
||||
id: "way/123",
|
||||
amenity: 'public_bookcases'
|
||||
});
|
||||
const config = new TagRenderingConfig(
|
||||
{
|
||||
render: "The name is {name}",
|
||||
question: "What is the name of this bookcase?",
|
||||
freeform: {
|
||||
key: "name",
|
||||
type: "string"
|
||||
}
|
||||
}, undefined, "Testing tag"
|
||||
);
|
||||
const questionElement = new TagRenderingQuestion(tags, config);
|
||||
const html = questionElement.InnerRenderAsString();
|
||||
T.assertContains("What is the name of this bookcase?", html);
|
||||
T.assertContains("<input type='text'", html);
|
||||
}],
|
||||
["TagsQuestion with Freeform and mappings has textfield", () => {
|
||||
const tags = new UIEventSource({
|
||||
id: "way/123",
|
||||
amenity: 'public_bookcases'
|
||||
});
|
||||
const config = new TagRenderingConfig(
|
||||
{
|
||||
render: "The name is {name}",
|
||||
question: "What is the name of this bookcase?",
|
||||
freeform: {
|
||||
key: "name",
|
||||
type: "string"
|
||||
},
|
||||
mappings: [
|
||||
{
|
||||
"if": "noname=yes",
|
||||
"then": "This bookcase has no name"
|
||||
}
|
||||
]
|
||||
}, undefined, "Testing tag"
|
||||
);
|
||||
const questionElement = new TagRenderingQuestion(tags, config);
|
||||
const html = questionElement.InnerRenderAsString();
|
||||
T.assertContains("What is the name of this bookcase?", html);
|
||||
T.assertContains("This bookcase has no name", html);
|
||||
T.assertContains("<input type='text'", html);
|
||||
}]
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,8 @@
|
|||
import {Utils} from "../Utils";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
|
||||
import TagSpec from "./Tag.spec";
|
||||
import ImageAttributionSpec from "./ImageAttribution.spec";
|
||||
import GeoOperationsSpec from "./GeoOperations.spec";
|
||||
import TagQuestionSpec from "./TagQuestion.spec";
|
||||
import ImageSearcherSpec from "./ImageSearcher.spec";
|
||||
import ThemeSpec from "./Theme.spec";
|
||||
import UtilsSpec from "./Utils.spec";
|
||||
|
@ -34,7 +31,6 @@ const allTests = [
|
|||
new TagSpec(),
|
||||
new ImageAttributionSpec(),
|
||||
new GeoOperationsSpec(),
|
||||
new TagQuestionSpec(),
|
||||
new ImageSearcherSpec(),
|
||||
new ThemeSpec(),
|
||||
new UtilsSpec()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue