public void ChainedRenderFunctionsCalled() { var renderFunctions = new TestRenderFunctions(); var chainedRenderFunctions = new TestRenderFunctions(renderFunctions); chainedRenderFunctions.PreRender(a => "prerender-result"); Assert.Equal("prerender-result", renderFunctions.PreRenderResult); Assert.Equal("prerender-result", chainedRenderFunctions.PreRenderResult); string transformed = chainedRenderFunctions.TransformRender("React.createElement('div', null)"); Assert.Equal("wrap(wrap(React.createElement('div', null)))", transformed); chainedRenderFunctions.PostRender(a => "postrender-result"); Assert.Equal("postrender-result", renderFunctions.PostRenderResult); Assert.Equal("postrender-result", chainedRenderFunctions.PostRenderResult); }
public void ChainedRenderFunctionsCalled() { var renderFunctions = new TestRenderFunctions(); var chainedRenderFunctions = new TestRenderFunctions(renderFunctions); chainedRenderFunctions.PreRender(a => "prerender-result"); Assert.Equal("prerender-result", renderFunctions.PreRenderResult); Assert.Equal("prerender-result", chainedRenderFunctions.PreRenderResult); string wrapComponentResult = chainedRenderFunctions.WrapComponent("React.createElement('div', null)"); Assert.Equal("wrap(wrap(React.createElement('div', null)))", wrapComponentResult); Assert.Equal("outerWrap(input)", renderFunctions.TransformRenderedHtml("input")); Assert.Equal("outerWrap(outerWrap(input))", chainedRenderFunctions.TransformRenderedHtml("input")); chainedRenderFunctions.PostRender(a => "postrender-result"); Assert.Equal("postrender-result", renderFunctions.PostRenderResult); Assert.Equal("postrender-result", chainedRenderFunctions.PostRenderResult); }