diff --git a/react_prerendering_src.js b/react_prerendering_src.js new file mode 100644 index 00000000..02a954a8 --- /dev/null +++ b/react_prerendering_src.js @@ -0,0 +1,19 @@ +( (function () { + if (typeof console !== "undefined" && console.history) { + console.history = []; +} + + var result = this.ReactRailsUJS.serverRender('renderToString', 'React.TopLevelRailsComponent', {"render_params":{},"component_name":"TestComponent77","controller":"ReactTest"}); + (function (history) { + if (history && history.length > 0) { + result += '\n'; + history.forEach(function (msg) { + result += '\nconsole.' + msg.level + '.apply(console, ' + JSON.stringify(msg.arguments) + ');'; + }); + result += '\n'; + } +})(console.history); + + return result; + })() +) \ No newline at end of file diff --git a/spec/test_app/app/assets/javascripts/server_rendering.js b/spec/test_app/app/assets/javascripts/server_rendering.js new file mode 100644 index 00000000..29f5acdd --- /dev/null +++ b/spec/test_app/app/assets/javascripts/server_rendering.js @@ -0,0 +1,4 @@ +//= require 'react-server' +//= require 'react_ujs' +//= require 'components' +Opal.load('components') \ No newline at end of file