refactoring: remove some tests that don't work anymore

This commit is contained in:
Pieter Vander Vennet 2023-04-13 22:36:07 +02:00
parent ea62b5b7ff
commit a3242a3c7d
7 changed files with 247 additions and 235 deletions

View file

@ -57,29 +57,6 @@ export class TextField extends InputElement<string> {
return this._isValid(t)
}
/**
*
* // should update placeholders dynamically
* const placeholder = new UIEventSource<string>("placeholder")
* const tf = new TextField({
* placeholder
* })
* const html = <HTMLInputElement> tf.InnerConstructElement().children[0];
* html.placeholder // => 'placeholder'
* placeholder.setData("another piece of text")
* html.placeholder// => "another piece of text"
*
* // should update translated placeholders dynamically
* const placeholder = new Translation({nl: "Nederlands", en: "English"})
* Locale.language.setData("nl");
* const tf = new TextField({
* placeholder
* })
* const html = <HTMLInputElement> tf.InnerConstructElement().children[0];
* html.placeholder// => "Nederlands"
* Locale.language.setData("en");
* html.placeholder // => 'English'
*/
protected InnerConstructElement(): HTMLElement {
const options = this._options
const self = this

View file

@ -33,14 +33,6 @@ export default class OpeningHoursPicker extends InputElement<OpeningHour[]> {
return true
}
/**
*
* const rules = OH.ParseRule("Jul-Aug Sa closed; Mo,Tu,Th,Fr,PH 12:00-22:30, We 17:00-22:30, Sa 14:00-19:00, Su 10:00-21:00; Dec 24,25,31 off; Jan 1 off")
* const v = new UIEventSource(rules)
* const ohpicker = new OpeningHoursPicker(v)
* const html = ohpicker.InnerConstructElement()
* html !== undefined // => true
*/
protected InnerConstructElement(): HTMLElement {
return this._backgroundTable.ConstructElement()
}

View file

@ -25,20 +25,6 @@ export default class PublicHolidayInput extends InputElement<string> {
return true
}
/**
*
* // should construct an element
* const html = new PublicHolidayInput().InnerConstructElement()
* html !== undefined // => true
*
* // should construct an element despite having an invalid input
* const html = new PublicHolidayInput(new UIEventSource("invalid")).InnerConstructElement()
* html !== undefined // => true
*
* // should construct an element despite having null as input
* const html = new PublicHolidayInput(new UIEventSource(null)).InnerConstructElement()
* html !== undefined // => true
*/
protected InnerConstructElement(): HTMLElement {
const dropdown = new DropDown(Translations.t.general.opening_hours.open_during_ph.Clone(), [
{ shown: Translations.t.general.opening_hours.ph_not_known.Clone(), value: "" },

View file

@ -118,23 +118,6 @@ export class Translation extends BaseUIElement {
return ""
}
/**
*
* // Should actually change the content based on the current language
* const tr = new Translation({"en":"English", nl: "Nederlands"})
* Locale.language.setData("en")
* const html = tr.InnerConstructElement()
* html.innerHTML // => "English"
* Locale.language.setData("nl")
* html.innerHTML // => "Nederlands"
*
* // Should include a link to weblate if context is set
* const tr = new Translation({"en":"English"}, "core:test.xyz")
* Locale.language.setData("nl")
* Locale.showLinkToWeblate.setData(true)
* const html = tr.InnerConstructElement()
* html.getElementsByTagName("a")[0].href // => "https://hosted.weblate.org/translate/mapcomplete/core/nl/?offset=1&q=context%3A%3D%22test.xyz%22"
*/
InnerConstructElement(): HTMLElement {
const el = document.createElement("span")
const self = this

411
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
"generate:css": "tailwindcss -i index.css -o css/index-tailwind-output.css",
"generate:doctests": "doctest-ts-improved . --ignore .*.spec.ts --ignore .*ConfigJson.ts",
"test:run-only": "vitest --run test",
"test": "(npm run generate:doctests 2>&1 | grep -v \"No doctests found in\") && npm run test:run-only && npm run clean:tests",
"test": "npm run clean:tests && (npm run generate:doctests 2>&1 | grep -v \"No doctests found in\") && npm run test:run-only && npm run clean:tests",
"init": "npm ci && npm run generate && npm run generate:editor-layer-index && npm run generate:layouts && npm run clean && npm run weblate-add-upstream",
"generate:editor-layer-index": "vite-node scripts/downloadEli.ts",
"generate:polygon-features": "vite-node scripts/downloadFile.ts -- https://raw.githubusercontent.com/tyrasd/osm-polygon-features/master/polygon-features.json assets/polygon-features.json",
@ -90,7 +90,7 @@
"lz-string": "^1.4.4",
"mangrove-reviews-typescript": "^1.1.0",
"maplibre-gl": "^2.4.0",
"opening_hours": "^3.6.0",
"opening_hours": "^3.6.0",
"osm-auth": "^1.0.2",
"osmtogeojson": "^3.0.0-beta.5",
"papaparse": "^5.3.1",
@ -125,7 +125,6 @@
"chai": "^4.3.6",
"dependency-cruiser": "^10.4.0",
"fs": "0.0.1-security",
"jsdom": "^21.1.0",
"node-html-parser": "^6.1.5",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.9.0",

View file

@ -1,6 +1,5 @@
import ScriptUtils from "../scripts/ScriptUtils"
import { Utils } from "../Utils"
import * as fakedom from "fake-dom"
import Locale from "../UI/i18n/Locale"
import { beforeEach } from "vitest"
import { ReferencingWaysMetaTagger } from "../Logic/SimpleMetaTagger"
@ -9,9 +8,6 @@ beforeEach(async () => {
ScriptUtils.fixUtils()
Locale.language.setData("en")
ReferencingWaysMetaTagger.enabled = false
if (fakedom === undefined || window === undefined) {
throw "FakeDom not initialized"
}
// Block internet access
Utils.externalDownloadFunction = async (url) => {