Skip to content
Snippets Groups Projects
Commit ab105550 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Re-format all code

parent 44c83e8d
Branches
No related tags found
1 merge request!124Add prettier
Pipeline #86099 passed
Showing
with 762 additions and 521 deletions
......@@ -12,9 +12,6 @@
"en": "I am a description of this application"
},
"routing_name": "example",
"activities": [
{"path": "example.metadata.json"},
{"path": "example2.metadata.json"}
],
"activities": [{"path": "example.metadata.json"}, {"path": "example2.metadata.json"}],
"attributes": []
}
module.exports = {
input: [
'src/*.js',
],
input: ['src/*.js'],
output: './',
options: {
debug: false,
......@@ -10,7 +8,7 @@ module.exports = {
lngs: ['en', 'de'],
resource: {
loadPath: 'src/i18n/{{lng}}/{{ns}}.json',
savePath: 'src/i18n/{{lng}}/{{ns}}.json'
savePath: 'src/i18n/{{lng}}/{{ns}}.json',
},
},
}
};
......@@ -7,22 +7,25 @@ import del from 'rollup-plugin-delete';
import json from '@rollup/plugin-json';
import {getPackagePath, getDistPath} from '../../rollup.utils.js';
const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
console.log("build: " + build);
const build = typeof process.env.BUILD !== 'undefined' ? process.env.BUILD : 'local';
console.log('build: ' + build);
export default (async () => {
return {
input: (build !='test') ? ['src/dbp-app-shell.js', 'src/dbp-activity-example.js'] : glob.sync('test/**/*.js'),
input:
build != 'test'
? ['src/dbp-app-shell.js', 'src/dbp-activity-example.js']
: glob.sync('test/**/*.js'),
output: {
dir: 'dist',
entryFileNames: '[name].js',
chunkFileNames: 'shared/[name].[hash].[format].js',
format: 'esm',
sourcemap: true
sourcemap: true,
},
plugins: [
del({
targets: 'dist/*'
targets: 'dist/*',
}),
resolve(),
commonjs(),
......@@ -32,13 +35,20 @@ export default (async () => {
{src: 'assets/silent-check-sso.html', dest: 'dist'},
{src: 'assets/index.html', dest: 'dist'},
{src: 'assets/*.json', dest: 'dist'},
{src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'), dest: 'dist/' + await getDistPath('@dbp-toolkit/common', 'icons')},
{
src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'),
dest: 'dist/' + (await getDistPath('@dbp-toolkit/common', 'icons')),
},
],
}),
(process.env.ROLLUP_WATCH === 'true') ? serve({
process.env.ROLLUP_WATCH === 'true'
? serve({
contentBase: 'dist',
historyApiFallback: '/index.html',
host: '127.0.0.1', port: 8002}) : false
]
}
host: '127.0.0.1',
port: 8002,
})
: false,
],
};
})();
This diff is collapsed.
......@@ -4,11 +4,10 @@ import {unsafeHTML} from 'lit/directives/unsafe-html.js';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {Icon} from '@dbp-toolkit/common';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
import {LoginStatus} from "@dbp-toolkit/auth/src/util";
import {AdapterLitElement} from '@dbp-toolkit/provider/src/adapter-lit-element';
import {LoginStatus} from '@dbp-toolkit/auth/src/util';
export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
constructor() {
super();
this._i18n = createInstance();
......@@ -55,7 +54,7 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
* We need to set the width manually because a percent width is in relation to the viewport
*/
updateDropdownWidth() {
const dropdown = this.shadowRoot.querySelector("div.dropdown-menu");
const dropdown = this.shadowRoot.querySelector('div.dropdown-menu');
if (!dropdown) {
return;
......@@ -63,7 +62,7 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
let viewportOffset = this.getBoundingClientRect();
let spaceToRIght = window.innerWidth - viewportOffset.left;
dropdown.setAttribute("style", `width: ${spaceToRIght - 20}px`);
dropdown.setAttribute('style', `width: ${spaceToRIght - 20}px`);
}
onLoginClicked(e) {
......@@ -77,7 +76,7 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
if (propName === "lang") {
if (propName === 'lang') {
this._i18n.changeLanguage(this.lang);
}
});
......@@ -102,7 +101,9 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
display: block;
}
input::-moz-focus-inner { border: 0; }
input::-moz-focus-inner {
border: 0;
}
:focus-visible {
outline: none !important;
......@@ -113,7 +114,8 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
box-shadow: 0px 0px 4px 2px var(--dbp-accent);
}
.dropdown.is-active .dropdown-menu, .dropdown.is-hoverable:hover .dropdown-menu {
.dropdown.is-active .dropdown-menu,
.dropdown.is-hoverable:hover .dropdown-menu {
display: block;
}
......@@ -224,13 +226,13 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
margin-right: 0.5em
margin-right: 0.5em;
}
`;
}
setChevron(name) {
const chevron = this.shadowRoot.querySelector("#menu-chevron-icon");
const chevron = this.shadowRoot.querySelector('#menu-chevron-icon');
if (chevron !== null) {
chevron.name = name;
}
......@@ -239,7 +241,9 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
onDropdownClick(event) {
event.stopPropagation();
event.currentTarget.classList.toggle('is-active');
this.setChevron(event.currentTarget.classList.contains('is-active') ? 'chevron-up' : 'chevron-down');
this.setChevron(
event.currentTarget.classList.contains('is-active') ? 'chevron-up' : 'chevron-down'
);
this.updateDropdownWidth();
}
......@@ -259,13 +263,18 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
<a href="#">
<div class="dropdown-trigger login-button">
<div class="name">${this.auth['user-full-name']}</div>
<dbp-icon class="menu-icon" name="chevron-down" id="menu-chevron-icon"></dbp-icon>
<dbp-icon
class="menu-icon"
name="chevron-down"
id="menu-chevron-icon"></dbp-icon>
</div>
</a>
<div class="dropdown-menu" id="dropdown-menu2" role="menu">
<div class="dropdown-content" @blur="${this.closeDropdown}">
<div class="menu">
<a href="#" @click="${this.onLogoutClicked}" class="dropdown-item">${i18n.t('logout')}</a>
<a href="#" @click="${this.onLogoutClicked}" class="dropdown-item">
${i18n.t('logout')}
</a>
</div>
</div>
</div>
......@@ -307,11 +316,9 @@ export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
}
render() {
const loggedIn = (this.auth['login-status'] === 'logged-in');
const loggedIn = this.auth['login-status'] === 'logged-in';
return html`
<div class="authbox">
${loggedIn ? this.renderLoggedIn() : this.renderLoggedOut()}
</div>
<div class="authbox">${loggedIn ? this.renderLoggedIn() : this.renderLoggedOut()}</div>
`;
}
}
import {html, css} from 'lit';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
import {AdapterLitElement} from '@dbp-toolkit/provider/src/adapter-lit-element';
export class BuildInfo extends AdapterLitElement {
constructor() {
super();
this.env = '';
......@@ -16,9 +15,9 @@ export class BuildInfo extends AdapterLitElement {
return {
...super.properties,
env: {type: String},
buildUrl: { type: String, attribute: "build-url" },
buildTime: { type: String, attribute: "build-time" },
gitInfo: { type: String, attribute: "git-info" }
buildUrl: {type: String, attribute: 'build-url'},
buildTime: {type: String, attribute: 'build-time'},
gitInfo: {type: String, attribute: 'git-info'},
};
}
......
......@@ -3,7 +3,6 @@ import {createInstance} from './i18n.js';
import * as commonUtils from '@dbp-toolkit/common/utils';
class ActivityExample extends LitElement {
constructor() {
super();
this._i18n = createInstance();
......@@ -19,7 +18,7 @@ class ActivityExample extends LitElement {
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
switch (propName) {
case "lang":
case 'lang':
this._i18n.changeLanguage(this.lang);
break;
}
......@@ -32,7 +31,14 @@ class ActivityExample extends LitElement {
const i18n = this._i18n;
return html`
<h3>${i18n.t('activity-example.hello-world')}</h3>
<ul>${(Array.from(Array(100).keys())).map(i => html`<li>${i18n.t('activity-example.hello-world') + ' ' + i}</li>`)}</ul>
<ul>
${Array.from(Array(100).keys()).map(
(i) =>
html`
<li>${i18n.t('activity-example.hello-world') + ' ' + i}</li>
`
)}
</ul>
`;
}
}
......
......@@ -5,7 +5,6 @@ import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles';
class AppShellWelcome extends ScopedElementsMixin(LitElement) {
constructor() {
super();
this._i18n = createInstance();
......@@ -26,7 +25,7 @@ class AppShellWelcome extends ScopedElementsMixin(LitElement) {
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
if (propName === "lang") {
if (propName === 'lang') {
this._i18n.changeLanguage(this.lang);
}
});
......@@ -35,14 +34,17 @@ class AppShellWelcome extends ScopedElementsMixin(LitElement) {
}
static get styles() {
// language=css
return css`
${commonStyles.getThemeCSS()}
${commonStyles.getGeneralCSS()}
p { line-height: 1.8em }
.item { padding-top: 0.5em;}
p {
line-height: 1.8em;
}
.item {
padding-top: 0.5em;
}
.description {
padding-left: 2em;
font-style: italic;
......@@ -61,7 +63,7 @@ class AppShellWelcome extends ScopedElementsMixin(LitElement) {
}
h2 a::after {
content: "\\00a0\\00a0";
content: '\\00a0\\00a0';
background-color: var(--dbp-text);
-webkit-mask-image: url('data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Ebene_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20viewBox%3D%220%200%2014.8%2062.4%22%20style%3D%22enable-background%3Anew%200%200%2014.8%2062.4%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cg%20transform%3D%22translate%28-382.21%20-336.98%29%22%3E%0A%09%3Cg%3E%0A%09%09%3Cpath%20d%3D%22M383%2C380.5c-0.2%2C0-0.4-0.1-0.6-0.3c-0.3-0.3-0.3-0.8%2C0.1-1.1l12.5-10.9l-12.5-10.9c-0.3-0.3-0.4-0.8-0.1-1.1%0A%09%09%09c0.3-0.3%2C0.8-0.4%2C1.1-0.1l13.1%2C11.5c0.2%2C0.2%2C0.3%2C0.4%2C0.3%2C0.6s-0.1%2C0.5-0.3%2C0.6l-13.1%2C11.5C383.4%2C380.4%2C383.2%2C380.5%2C383%2C380.5z%22%2F%3E%0A%09%3C%2Fg%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A');
mask-image: url('data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20version%3D%221.1%22%20id%3D%22Ebene_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20viewBox%3D%220%200%2014.8%2062.4%22%20style%3D%22enable-background%3Anew%200%200%2014.8%2062.4%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cg%20transform%3D%22translate%28-382.21%20-336.98%29%22%3E%0A%09%3Cg%3E%0A%09%09%3Cpath%20d%3D%22M383%2C380.5c-0.2%2C0-0.4-0.1-0.6-0.3c-0.3-0.3-0.3-0.8%2C0.1-1.1l12.5-10.9l-12.5-10.9c-0.3-0.3-0.4-0.8-0.1-1.1%0A%09%09%09c0.3-0.3%2C0.8-0.4%2C1.1-0.1l13.1%2C11.5c0.2%2C0.2%2C0.3%2C0.4%2C0.3%2C0.6s-0.1%2C0.5-0.3%2C0.6l-13.1%2C11.5C383.4%2C380.4%2C383.2%2C380.5%2C383%2C380.5z%22%2F%3E%0A%09%3C%2Fg%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A');
......@@ -111,39 +113,50 @@ class AppShellWelcome extends ScopedElementsMixin(LitElement) {
for (let routeName of app.visibleRoutes) {
let data = app.metadata[routeName];
if (routeName !== "welcome") {
if (routeName !== 'welcome') {
itemTemplates.push(html`
<div class="item">
<h2><a href="#" @click=${(e) => {switchActivity(e, data);}}>${data.name[this.lang]}</a></h2>
<h2>
<a
href="#"
@click=${(e) => {
switchActivity(e, data);
}}>
${data.name[this.lang]}
</a>
</h2>
<p class="description">${data.description[this.lang]}</p>
</div>`);
</div>
`);
}
}
return html`
<p>${i18n.t('welcome.headline', {appname: app.topic.name[this.lang]})}
${app.topic.description[this.lang] }</p>
<br>
<p>
${i18n.t('welcome.headline', {appname: app.topic.name[this.lang]})}
${app.topic.description[this.lang]}
</p>
<br />
${itemTemplates}
`;
}
}
export const appWelcomeMeta = {
"element": "dbp-app-shell-welcome",
"module_src": "",
"routing_name": "welcome",
"name": {
"de": "Willkommen",
"en": "Welcome"
element: 'dbp-app-shell-welcome',
module_src: '',
routing_name: 'welcome',
name: {
de: 'Willkommen',
en: 'Welcome',
},
"short_name": {
"de": "Willkommen",
"en": "Welcome"
short_name: {
de: 'Willkommen',
en: 'Welcome',
},
"description": {
"de": "Willkommen",
"en": "Welcome"
description: {
de: 'Willkommen',
en: 'Welcome',
},
visible: true,
required_roles: [],
......
......@@ -5,7 +5,6 @@ import generateUrls from 'universal-router/generateUrls';
* A wrapper around UniversalRouter which adds history integration
*/
export class Router {
/**
* @param {Array} routes The routes passed to UniversalRouter
* @param {object} options Options
......@@ -42,7 +41,9 @@ export class Router {
setStateFromCurrentLocation() {
const oldPathName = location.pathname;
this.router.resolve({pathname: oldPathName}).then(page => {
this.router
.resolve({pathname: oldPathName})
.then((page) => {
const newPathname = this.getPathname(page);
// In case of a router redirect, set the new location
if (newPathname !== oldPathName) {
......@@ -53,7 +54,8 @@ export class Router {
page = this.getDefaultState();
}
this.setState(page);
}).catch((e) => {
})
.catch((e) => {
// In case we can't resolve the location, just leave things as is.
// This happens when a user enters a wrong URL or when testing with karma.
});
......@@ -72,8 +74,7 @@ export class Router {
setTimeout(() => {
const newPathname = this.getPathname();
const oldPathname = location.pathname;
if (newPathname === oldPathname)
return;
if (newPathname === oldPathname) return;
const defaultPathname = this.getPathname(this.getDefaultState());
if (newPathname === defaultPathname && this.isBasePath(oldPathname)) {
......@@ -92,14 +93,16 @@ export class Router {
* @param {string} pathname
*/
updateFromPathname(pathname) {
this.router.resolve({pathname: pathname}).then(page => {
if (location.pathname === pathname)
return;
this.router
.resolve({pathname: pathname})
.then((page) => {
if (location.pathname === pathname) return;
const referrerUrl = location.href;
window.history.pushState({}, '', pathname);
this.setState(page);
this.dispatchLocationChanged(referrerUrl);
}).catch((err) => {
})
.catch((err) => {
throw new Error(`Route not found: ${pathname}: ${err}`);
});
}
......@@ -114,8 +117,7 @@ export class Router {
*/
getPathname(partialState) {
const currentState = this.getState();
if (partialState === undefined)
partialState = {};
if (partialState === undefined) partialState = {};
let combined = {...currentState, ...partialState};
try {
......@@ -126,13 +128,15 @@ export class Router {
}
}
dispatchLocationChanged(referrerUrl = "") {
dispatchLocationChanged(referrerUrl = '') {
// fire a locationchanged event
window.dispatchEvent(new CustomEvent('locationchanged', {
window.dispatchEvent(
new CustomEvent('locationchanged', {
detail: {
referrerUrl: referrerUrl,
},
bubbles: true
}));
bubbles: true,
})
);
}
}
import {html, css} from 'lit';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {createInstance} from './i18n.js';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
import {AdapterLitElement} from '@dbp-toolkit/provider/src/adapter-lit-element';
export class TUGrazLogo extends AdapterLitElement {
constructor() {
super();
......@@ -15,13 +14,13 @@ export class TUGrazLogo extends AdapterLitElement {
static get properties() {
return {
...super.properties,
lang: { type: String }
lang: {type: String},
};
}
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
if (propName === "lang") {
if (propName === 'lang') {
this._i18n.changeLanguage(this.lang);
}
});
......@@ -37,8 +36,7 @@ export class TUGrazLogo extends AdapterLitElement {
display: inline-block;
}
#claim
{
#claim {
font-size: 12px;
text-align: right;
padding: 0 17px 0 0;
......@@ -73,7 +71,58 @@ export class TUGrazLogo extends AdapterLitElement {
<div class="int-header-logo-claim-single">${i18n.t('logo.word2')}</div>
<div class="int-header-logo-claim-single">${i18n.t('logo.word3')}</div>
</div>
<svg id="img" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="51.862" width="141.1" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 141.10001 51.862499"><g transform="matrix(1.25 0 0 -1.25 0 51.862)"><g transform="scale(.1)"><path style="fill:#e4154b" d="m0 103.73h207.45v207.46l-207.45 0.01v-207.47z"></path><path style="fill:#e4154b" d="m228.19 103.73h207.46v207.46h-207.46v-207.46z"></path><path style="fill:#e4154b" d="m456.41 103.73h207.44v207.46h-207.44v-207.46z"></path><path style="fill:#e4154b" d="m103.72 0h207.47v207.46h-207.47v-207.46z"></path><path style="fill:#e4154b" d="m352.68 207.46h207.44v207.46h-207.44v-207.46z"></path><path style="fill:var(--dbp-base-inverted)" d="m751.04 277.91h-66.426v33.195h171.19v-33.195h-66.407v-173.73h-38.359v173.73"></path><path style="fill:var(--dbp-base-inverted)" d="m1048.3 180.22c0-12.461-2.25-23.711-6.72-33.75-4.5-10.039-10.61-18.555-18.36-25.567-7.76-7.031-16.9-12.421-27.503-16.21-10.605-3.809-22.109-5.7036-34.551-5.7036-12.422 0-23.945 1.8946-34.551 5.7036-10.605 3.789-19.824 9.179-27.656 16.21-7.851 7.012-13.984 15.528-18.34 25.567-4.394 10.039-6.582 21.289-6.582 33.75v130.89h38.379v-129.59c0-5.039 0.801-10.351 2.442-15.898 1.64-5.547 4.336-10.664 8.125-15.332s8.789-8.516 15.039-11.523c6.211-3.008 13.926-4.512 23.144-4.512 9.199 0 16.914 1.504 23.145 4.512 6.23 3.007 11.25 6.855 15.039 11.523 3.77 4.668 6.48 9.785 8.12 15.332 1.63 5.547 2.45 10.859 2.45 15.898v129.59h38.38v-130.89"></path><path style="fill:var(--dbp-base-inverted)" d="m832.56 75.664c-7.597 3.2812-17.46 4.8632-25.332 4.8632-22.929 0-35.605-14.434-35.605-33.184 0-18.613 12.383-32.637 33.34-32.637 5.351 0 9.59 0.5274 12.969 1.3086v23.867h-20.84v14.414h39.687v-49.297c-10.41-2.6172-21.25-4.707-31.816-4.707-31.797 0-53.906 14.805-53.906 45.742 0 31.348 20.566 48.906 53.906 48.906 11.406 0 20.41-1.4453 28.867-3.8086l-1.27-15.469"></path><path style="fill:var(--dbp-base-inverted)" d="m856.2 69.375h16.758v-15.332h0.293c0.84 6.289 8.574 16.914 19.824 16.914 1.836 0 3.828 0 5.782-0.5273v-17.715c-1.68 0.918-5.059 1.4454-8.457 1.4454-15.333 0-15.333-17.832-15.333-27.52v-24.785h-18.867v67.52"></path><path style="fill:var(--dbp-base-inverted)" d="m913.75 65.84c7.324 3.1446 17.187 5.1172 25.215 5.1172 22.09 0 31.23-8.5351 31.23-28.457v-8.6523c0-6.8165 0.156-11.934 0.293-16.914 0.137-5.1172 0.41-9.8242 0.84-15.078h-16.602c-0.703 3.5352-0.703 8.0078-0.839 10.098h-0.293c-4.36-7.4618-13.81-11.661-22.38-11.661-12.793 0-25.332 7.207-25.332 20.059 0 10.078 5.195 15.976 12.383 19.258 7.187 3.2812 16.464 3.9453 24.355 3.9453h10.41c0 10.879-5.195 14.551-16.328 14.551-8.008 0-16.035-2.8907-22.363-7.3438l-0.586 15.078zm22.11-52.715c5.782 0 10.274 2.3633 13.223 6.0352 3.105 3.8086 3.945 8.6523 3.945 13.906h-8.164c-8.437 0-20.957-1.3086-20.957-11.68 0-5.7617 5.195-8.2617 11.953-8.2617"></path><path style="fill:var(--dbp-base-inverted)" d="m985.69 69.375h57.422v-14.414l-36.04-39.473h37.31v-13.633h-60.235v14.297l36.715 39.59h-35.172v13.633"></path><path style="fill:#e4154b" d="m1059.6 0h69.102v69.121h-69.102v-69.121z"></path></g></g></svg>
<svg
id="img"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xml:space="preserve"
height="51.862"
width="141.1"
version="1.1"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
viewBox="0 0 141.10001 51.862499">
<g transform="matrix(1.25 0 0 -1.25 0 51.862)">
<g transform="scale(.1)">
<path
style="fill:#e4154b"
d="m0 103.73h207.45v207.46l-207.45 0.01v-207.47z"></path>
<path
style="fill:#e4154b"
d="m228.19 103.73h207.46v207.46h-207.46v-207.46z"></path>
<path
style="fill:#e4154b"
d="m456.41 103.73h207.44v207.46h-207.44v-207.46z"></path>
<path
style="fill:#e4154b"
d="m103.72 0h207.47v207.46h-207.47v-207.46z"></path>
<path
style="fill:#e4154b"
d="m352.68 207.46h207.44v207.46h-207.44v-207.46z"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m751.04 277.91h-66.426v33.195h171.19v-33.195h-66.407v-173.73h-38.359v173.73"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m1048.3 180.22c0-12.461-2.25-23.711-6.72-33.75-4.5-10.039-10.61-18.555-18.36-25.567-7.76-7.031-16.9-12.421-27.503-16.21-10.605-3.809-22.109-5.7036-34.551-5.7036-12.422 0-23.945 1.8946-34.551 5.7036-10.605 3.789-19.824 9.179-27.656 16.21-7.851 7.012-13.984 15.528-18.34 25.567-4.394 10.039-6.582 21.289-6.582 33.75v130.89h38.379v-129.59c0-5.039 0.801-10.351 2.442-15.898 1.64-5.547 4.336-10.664 8.125-15.332s8.789-8.516 15.039-11.523c6.211-3.008 13.926-4.512 23.144-4.512 9.199 0 16.914 1.504 23.145 4.512 6.23 3.007 11.25 6.855 15.039 11.523 3.77 4.668 6.48 9.785 8.12 15.332 1.63 5.547 2.45 10.859 2.45 15.898v129.59h38.38v-130.89"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m832.56 75.664c-7.597 3.2812-17.46 4.8632-25.332 4.8632-22.929 0-35.605-14.434-35.605-33.184 0-18.613 12.383-32.637 33.34-32.637 5.351 0 9.59 0.5274 12.969 1.3086v23.867h-20.84v14.414h39.687v-49.297c-10.41-2.6172-21.25-4.707-31.816-4.707-31.797 0-53.906 14.805-53.906 45.742 0 31.348 20.566 48.906 53.906 48.906 11.406 0 20.41-1.4453 28.867-3.8086l-1.27-15.469"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m856.2 69.375h16.758v-15.332h0.293c0.84 6.289 8.574 16.914 19.824 16.914 1.836 0 3.828 0 5.782-0.5273v-17.715c-1.68 0.918-5.059 1.4454-8.457 1.4454-15.333 0-15.333-17.832-15.333-27.52v-24.785h-18.867v67.52"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m913.75 65.84c7.324 3.1446 17.187 5.1172 25.215 5.1172 22.09 0 31.23-8.5351 31.23-28.457v-8.6523c0-6.8165 0.156-11.934 0.293-16.914 0.137-5.1172 0.41-9.8242 0.84-15.078h-16.602c-0.703 3.5352-0.703 8.0078-0.839 10.098h-0.293c-4.36-7.4618-13.81-11.661-22.38-11.661-12.793 0-25.332 7.207-25.332 20.059 0 10.078 5.195 15.976 12.383 19.258 7.187 3.2812 16.464 3.9453 24.355 3.9453h10.41c0 10.879-5.195 14.551-16.328 14.551-8.008 0-16.035-2.8907-22.363-7.3438l-0.586 15.078zm22.11-52.715c5.782 0 10.274 2.3633 13.223 6.0352 3.105 3.8086 3.945 8.6523 3.945 13.906h-8.164c-8.437 0-20.957-1.3086-20.957-11.68 0-5.7617 5.195-8.2617 11.953-8.2617"></path>
<path
style="fill:var(--dbp-base-inverted)"
d="m985.69 69.375h57.422v-14.414l-36.04-39.473h37.31v-13.633h-60.235v14.297l36.715 39.59h-35.172v13.633"></path>
<path
style="fill:#e4154b"
d="m1059.6 0h69.102v69.121h-69.102v-69.121z"></path>
</g>
</g>
</svg>
</a>
`;
}
......
......@@ -3,7 +3,6 @@ import {assert} from '@esm-bundle/chai';
import {Router} from '../src/router.js';
suite('router', () => {
test('basics', () => {
const routes = [
{
......@@ -11,20 +10,24 @@ suite('router', () => {
path: '',
action: (context) => {
return {};
}
},
},
];
const router = new Router(routes, {
routeName: 'foo',
getState: () => { return {}; },
getState: () => {
return {};
},
setState: (state) => {},
getDefaultState: () => { return {}; },
getDefaultState: () => {
return {};
},
});
router.setStateFromCurrentLocation();
router.update();
router.updateFromPathname("/");
router.updateFromPathname('/');
assert.equal(router.getPathname(), '/');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment