mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-27 11:01:48 +01:00
Consolidate all Go tests. Coverage is identical to before. Go tests are around 5% faster while being 7% smaller. No non-test code is touched.
24 lines
840 B
Go
24 lines
840 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package markup
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRenderIFrame(t *testing.T) {
|
|
ctx := NewRenderContext(t.Context()).
|
|
WithRelativePath("tree-path").
|
|
WithMetas(map[string]string{"user": "test-owner", "repo": "test-repo", "RefTypeNameSubURL": "src/branch/master"})
|
|
|
|
// iframe doesn't need sandbox, the sandbox is set in render's response header
|
|
sb := &strings.Builder{}
|
|
require.NoError(t, RenderIFrame(ctx, &ExternalRendererOptions{ContentSandbox: "any"}, sb))
|
|
assert.Equal(t, `<iframe data-src="/test-owner/test-repo/render/src/branch/master/tree-path" data-global-init="initExternalRenderIframe" class="external-render-iframe"></iframe>`, sb.String())
|
|
}
|