tiny bit of cleanup
This commit is contained in:
parent
cdbb11b14a
commit
da016f2e03
3 changed files with 365 additions and 361 deletions
|
@ -22,7 +22,6 @@ const useTabs = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Tabs: ParentComponent<{ active?: Setter<string | undefined>, onClose?: CommandType<[string]> }> = (props) => {
|
export const Tabs: ParentComponent<{ active?: Setter<string | undefined>, onClose?: CommandType<[string]> }> = (props) => {
|
||||||
const commandsContext = useCommands();
|
|
||||||
const [active, setActive] = createSignal<string | undefined>(undefined);
|
const [active, setActive] = createSignal<string | undefined>(undefined);
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @refresh reload
|
// @refresh reload
|
||||||
import { createHandler, StartServer } from "@solidjs/start/server";
|
import { createHandler, StartServer } from "@solidjs/start/server";
|
||||||
import { installIntoGlobal } from "iterator-helpers-polyfill";
|
import { installIntoGlobal } from "iterator-helpers-polyfill";
|
||||||
|
import { isServer } from "solid-js/web";
|
||||||
|
|
||||||
installIntoGlobal();
|
installIntoGlobal();
|
||||||
|
|
||||||
|
@ -26,11 +27,14 @@ export default createHandler(({ nonce }) => {
|
||||||
);
|
);
|
||||||
}, event => {
|
}, event => {
|
||||||
const nonce = crypto.randomUUID();
|
const nonce = crypto.randomUUID();
|
||||||
const base = `'self' 'nonce-${nonce}'`;
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
|
const base = `'self' 'nonce-${nonce}' ${isDev ? `'unsafe-eval'` : ''}`;
|
||||||
|
|
||||||
const policies = {
|
const policies = {
|
||||||
default: base,
|
default: base,
|
||||||
connect: `${base} ws://localhost:*`,
|
connect: `${base} ws://localhost:*`,
|
||||||
|
script: `${base}`,
|
||||||
style: `'self' data: https://fonts.googleapis.com 'unsafe-inline'`,
|
style: `'self' data: https://fonts.googleapis.com 'unsafe-inline'`,
|
||||||
// style: `${base} data: https://fonts.googleapis.com`,
|
// style: `${base} data: https://fonts.googleapis.com`,
|
||||||
font: `${base} https://*.gstatic.com`,
|
font: `${base} https://*.gstatic.com`,
|
||||||
|
|
|
@ -21,7 +21,8 @@ const first = <T>(iterable: Iterable<T>): T | undefined => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('splitAt', () => {
|
describe('utilities', () => {
|
||||||
|
describe('splitAt', () => {
|
||||||
it('should split the given string at the given index', async () => {
|
it('should split the given string at the given index', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const given = 'this.is.some.concatenated.string';
|
const given = 'this.is.some.concatenated.string';
|
||||||
|
@ -69,9 +70,9 @@ describe('splitAt', () => {
|
||||||
expect(a).toBe(expected[0]);
|
expect(a).toBe(expected[0]);
|
||||||
expect(b).toBe(expected[1]);
|
expect(b).toBe(expected[1]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('debounce', () => {
|
describe('debounce', () => {
|
||||||
const { tick } = useFakeTimers();
|
const { tick } = useFakeTimers();
|
||||||
|
|
||||||
it('should run the given callback after the provided time', async () => {
|
it('should run the given callback after the provided time', async () => {
|
||||||
|
@ -103,9 +104,9 @@ describe('debounce', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(callback).toHaveBeenCalledTimes(1);
|
expect(callback).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deepCopy', () => {
|
describe('deepCopy', () => {
|
||||||
it('can skip values passed by reference (non-objects, null, and undefined)', async () => {
|
it('can skip values passed by reference (non-objects, null, and undefined)', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
const given = 'some string';
|
const given = 'some string';
|
||||||
|
@ -188,9 +189,9 @@ describe('deepCopy', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(actual.some.deep.value).not.toBe(given.some.deep.value);
|
expect(actual.some.deep.value).not.toBe(given.some.deep.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deepDiff', () => {
|
describe('deepDiff', () => {
|
||||||
it('should immedietly return when either `a` is not iterable', async () => {
|
it('should immedietly return when either `a` is not iterable', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
const a: any = 0;
|
const a: any = 0;
|
||||||
|
@ -378,9 +379,9 @@ describe('deepDiff', () => {
|
||||||
{ kind: MutarionKind.Update, key: 'key.key', original: 'old', value: 'new' },
|
{ kind: MutarionKind.Update, key: 'key.key', original: 'old', value: 'new' },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('filter', () => {
|
describe('filter', () => {
|
||||||
it('should yield a value when the predicate returns true', async () => {
|
it('should yield a value when the predicate returns true', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
const generator = async function* () {
|
const generator = async function* () {
|
||||||
|
@ -396,9 +397,9 @@ describe('filter', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
expect(actual).toEqual([0, 2, 4, 6, 8]);
|
expect(actual).toEqual([0, 2, 4, 6, 8]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('map', () => {
|
describe('map', () => {
|
||||||
const generator = async function* () {
|
const generator = async function* () {
|
||||||
for (const i of new Array(10).fill('').map((_, i) => i)) {
|
for (const i of new Array(10).fill('').map((_, i) => i)) {
|
||||||
yield i;
|
yield i;
|
||||||
|
@ -426,5 +427,5 @@ describe('map', () => {
|
||||||
'nr 9',
|
'nr 9',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue