mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-25 05:23:35 +08:00
Share workspace packages between Ray Admin and the interactive docs. BREAKING CHANGE: v6 is a new major line. v5 stays on legacy/v5.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { useWatermark } from '../../apps/admin/src/hooks/template/useWatermark'
|
|
import { useSettingGetters } from '../../apps/admin/src/store'
|
|
import setupMiniApp from '../utils/setupMiniApp'
|
|
|
|
describe('useWatermark', async () => {
|
|
await setupMiniApp()
|
|
|
|
const { setWatermarkContent, showWatermark, hiddenWatermark } = useWatermark()
|
|
|
|
it('should set watermark content', () => {
|
|
const { getWatermarkConfig } = useSettingGetters()
|
|
const content = 'Ray Template Yes!'
|
|
|
|
setWatermarkContent(content)
|
|
|
|
expect(getWatermarkConfig.value.content).toBe(content)
|
|
})
|
|
|
|
it('should update watermark', () => {
|
|
showWatermark()
|
|
|
|
const { getWatermarkSwitch: show } = useSettingGetters()
|
|
|
|
expect(show.value).toBe(true)
|
|
|
|
hiddenWatermark()
|
|
|
|
const { getWatermarkSwitch: hidden } = useSettingGetters()
|
|
|
|
expect(hidden.value).toBe(false)
|
|
})
|
|
it('keeps the previous text when an empty string is supplied', () => {
|
|
setWatermarkContent('Keep this')
|
|
setWatermarkContent('')
|
|
expect(useSettingGetters().getWatermarkConfig.value.content).toBe(
|
|
'Keep this',
|
|
)
|
|
})
|
|
})
|