I have files main.js
and test.js
, containing compiled clojurescript code.
When I open my-site.com/test
, it loads test.js
, which adds an iframe to the page that loads my-site.com/main
, which in turn loads main.js
. test.js
then tests various user interactions with my-site.com/main
inside the iframe.
The problem is that I'm using React
, so I need to simulate React
events. Part of the reason I'm using this iframe structure is because I learned that React.addons.TestUtils
is not loaded in minified code. I thought that, by leaving test.js
un-minified, I woud be able to use its version of React.addons.TestUtils.Simulate
to simulate React
events in main.js
, even if the latter is minified. I thought this would enable me to test production code.
What I found through much trial and error was that, when main.js
is not minified, I can use its version of Simulate
just fine, but when it is minified, I can't use Simulate
from test.js
on elements in main
.
Am I right? Is it possible to use React.addons.TestUtils.Simulate
if the library wasn't loaded in the relevant window? Is it possible to do what I'm trying to do, or is there a better way?
Aucun commentaire:
Enregistrer un commentaire