Add plain text clipboard transfers and refine input feedback
This commit is contained in:
25
apps/server/test/clipboard-access.test.js
Normal file
25
apps/server/test/clipboard-access.test.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mayReadClipboardAutomatically } from '../../web/src/clipboardAccess.js';
|
||||
|
||||
test('클립보드 자동 읽기는 모바일 확인과 지원하지 않는 권한 API를 우회하지 않는다', async () => {
|
||||
assert.equal(await mayReadClipboardAutomatically({}, true), false);
|
||||
const nav = (state) => ({ permissions: { query: async () => ({ state }) } });
|
||||
assert.equal(await mayReadClipboardAutomatically(nav('granted'), true), true);
|
||||
assert.equal(await mayReadClipboardAutomatically(nav('prompt'), true), false);
|
||||
assert.equal(await mayReadClipboardAutomatically(nav('denied'), false), false);
|
||||
assert.equal(await mayReadClipboardAutomatically(nav('prompt'), false), true);
|
||||
assert.equal(
|
||||
await mayReadClipboardAutomatically(
|
||||
{
|
||||
permissions: {
|
||||
query: async () => {
|
||||
throw new TypeError('unsupported');
|
||||
},
|
||||
},
|
||||
},
|
||||
false,
|
||||
),
|
||||
false,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user