@lengduan/dsh-client-ui-skin-815 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- /** 宿主加载入口。浏览器皮肤无宿主行为。 */
2
-
3
- /** 不提供宿主侧效果。 */
4
- export function apply(): void {}
@@ -1,59 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { afterEach, describe, expect, it } from 'vitest'
3
- import { Context, type Fiber } from '@deepseek-ai/cordis'
4
- import { readFileSync } from 'node:fs'
5
- import { resolve } from 'node:path'
6
- import { apply } from '../src/client/index.ts'
7
-
8
- let fiber: Fiber | undefined
9
-
10
- async function mount(): Promise<Fiber> {
11
- const f = new Context().plugin({ apply })
12
- await f.await()
13
- return f
14
- }
15
-
16
- afterEach(async () => {
17
- await fiber?.dispose()
18
- fiber = undefined
19
- document.body.innerHTML = ''
20
- document.title = ''
21
- })
22
-
23
- describe('815 skin apply', () => {
24
- it('declares only the public client manifest', () => {
25
- const manifest = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8'))
26
- expect(manifest.dsh.client).toEqual({ inject: [], platform: 'web' })
27
- expect(manifest.peerDependencies).toHaveProperty('@deepseek-ai/cordis', '^4.0.1')
28
- })
29
-
30
- it('sets the body attribute and retracts it on dispose', async () => {
31
- fiber = await mount()
32
- expect(document.body.hasAttribute('data-dsh-815')).toBe(true)
33
- await fiber.dispose()
34
- expect(document.body.hasAttribute('data-dsh-815')).toBe(false)
35
- })
36
-
37
- it('installs the photograph backdrop and restores prior body styles', async () => {
38
- document.body.style.setProperty('background-position', 'left bottom')
39
- fiber = await mount()
40
- expect(document.body.style.backgroundImage).toContain('data:image/jpeg;base64,')
41
- expect(document.body.style.backgroundPosition).toBe('center 42%')
42
- await fiber.dispose()
43
- expect(document.body.style.backgroundImage).toBe('')
44
- expect(document.body.style.backgroundPosition).toBe('left bottom')
45
- })
46
-
47
- it('does not inject the imperial rescript plaque', async () => {
48
- document.body.innerHTML = '<div data-pane="sidebar"><div></div></div>'
49
- fiber = await mount()
50
- expect(document.querySelector("[data-skin-chrome='rescript-plaque']")).toBeNull()
51
- })
52
-
53
- it('injects chrome and retracts every owned element on dispose', async () => {
54
- fiber = await mount()
55
- expect(document.body.querySelectorAll('[data-skin-owner="815"]').length).toBeGreaterThan(0)
56
- await fiber.dispose()
57
- expect(document.body.querySelectorAll('[data-skin-owner="815"]').length).toBe(0)
58
- })
59
- })