Re: Testing native @JsType in GWT tests

2018-03-11 Thread Thomas Broyer
JsInterop doesn't work in legacy DevMode; you have to run the tests in production mode: https://gwt-maven-plugin.github.io/gwt-maven-plugin/test-mojo.html#productionMode (this is the default in GWT 2.8, but Mojo's Maven plugin for GWT forces legacy DevMode by default; may I suggest that you

Re: Testing native @JsType in GWT tests

2018-03-11 Thread Mincong Huang
Hi Vassilis, Thanks for your help. After having specified the TOP_WINDOW as you suggested, the test passed in IntelliJ IDEA. However, it is still failing via Maven plugin [1]. I don't understand any more... Mincong [1]: https://travis-ci.org/mincong-h/learning-gwt/jobs/352049257#L769 On Sun,

Re: Testing native @JsType in GWT tests

2018-03-11 Thread Vassilis Virvilis
I would guess that script injector injects by default inside gwt frame. You need to specify TOP_WINDOW because jsinterop are mapped to $wnd by default. Something like that (can't test right now) ScriptInjector.fromString(js).setWindow(ScriptInjector.TOP_WINDOW).inject(); If you do this then

Testing native @JsType in GWT tests

2018-03-11 Thread Mincong Huang
Hi, I've a simple JavaScript: var ns = { Person: function() { this.sayHello = function() { return 'Hi'; }; } } And I used it to test JsInterop annotation `@JsType` in my GWT test. I injected JS code to GWTTestCase and tried to retrieve the definition via `@JsType`. However, it