| 7842 | } |
| 7843 | |
| 7844 | func Test_Ctx_RenderWithViewBindLocals(t *testing.T) { |
| 7845 | t.Parallel() |
| 7846 | app := New(Config{ |
| 7847 | PassLocalsToViews: true, |
| 7848 | }) |
| 7849 | |
| 7850 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 7851 | |
| 7852 | err := c.ViewBind(Map{ |
| 7853 | "Title": "Hello, World!", |
| 7854 | }) |
| 7855 | require.NoError(t, err) |
| 7856 | |
| 7857 | c.Locals("Summary", "Test") |
| 7858 | |
| 7859 | err = c.Render("./.github/testdata/template.tmpl", Map{}) |
| 7860 | require.NoError(t, err) |
| 7861 | require.Equal(t, "<h1>Hello, World! Test</h1>", string(c.Response().Body())) |
| 7862 | |
| 7863 | require.Equal(t, "<h1>Hello, World! Test</h1>", string(c.Response().Body())) |
| 7864 | } |
| 7865 | |
| 7866 | func Test_Ctx_RenderWithLocalsAndBinding(t *testing.T) { |
| 7867 | t.Parallel() |