-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
748 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import RelativeDate from '../src/lib/components/util/RelativeDate.svelte' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
describe('RelativeDate.svelte', () => { | ||
let host = document.createElement('div') | ||
host.setAttribute('id', 'host') | ||
document.body.appendChild(host) | ||
|
||
it('mounts', () => { | ||
let host = document.createElement('div') | ||
const instance = new RelativeDate({ | ||
target: host, | ||
props: { | ||
date: new Date(), | ||
relativeTo: new Date(), | ||
}, | ||
}) | ||
expect(instance).toBeTruthy() | ||
}) | ||
it('shows the correct date', () => { | ||
const date = new Date('2023-01-01 00:00:00') | ||
const relativeTo = new Date('2023-01-01 01:00:00') | ||
|
||
const instance = new RelativeDate({ | ||
target: host, | ||
props: { date: date, relativeTo: relativeTo }, | ||
}) | ||
|
||
expect(instance).toBeTruthy() | ||
expect(host.innerHTML).toContain('1 hour ago') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { sveltekit } from '@sveltejs/kit/vite' | ||
import { visualizer } from 'rollup-plugin-visualizer' | ||
import { defineConfig, type PluginOption } from 'vite' | ||
|
||
export default defineConfig({ | ||
plugins: [sveltekit(), visualizer() as PluginOption], | ||
plugins: [sveltekit()], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { svelte } from '@sveltejs/vite-plugin-svelte' | ||
import { defineConfig } from 'vitest/dist/config' | ||
|
||
export default defineConfig({ | ||
// @ts-ignore | ||
plugins: [svelte()], | ||
test: { | ||
globals: true, | ||
environment: 'jsdom', | ||
}, | ||
}) |
Oops, something went wrong.