fix(frontend/MkUrlPreview): allow fullscreen from tweets (#11712)

* fix(frontend/MkUrlPreview): allow fullscreen from tweets

* Update url-preview.test.ts
This commit is contained in:
Kagami Sascha Rosylight 2023-08-13 05:29:13 +02:00 committed by GitHub
parent 8b7f54df66
commit 2896fc6cb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -13,7 +13,7 @@ import MkUrlPreview from '@/components/MkUrlPreview.vue';
type SummalyResult = Awaited<ReturnType<typeof summaly>>;
describe('MkMediaImage', () => {
describe('MkUrlPreview', () => {
const renderPreviewBy = async (summary: Partial<SummalyResult>): Promise<RenderResult> => {
if (!summary.player) {
summary.player = {
@ -143,4 +143,13 @@ describe('MkMediaImage', () => {
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.parentElement?.style.paddingTop, '200px');
});
test('Loading a tweet in iframe', async () => {
const iframe = await renderAndOpenPreview({
url: 'https://twitter.com/i/web/status/1685072521782325249',
});
assert.exists(iframe, 'iframe should exist');
assert.strictEqual(iframe?.getAttribute('allow'), 'fullscreen;web-share');
assert.strictEqual(iframe?.getAttribute('sandbox'), 'allow-popups allow-scripts allow-same-origin');
});
});