- intuitive
- documented anywhere at all (that I could find)
Dictionary.getDictionary( "bundle" );
...requires a JavaScript-level variable bundle to be declared on your 'host HTML page'. When the GWT application is running normally, the 'host HTML page' is the index.html page. However, when running unit tests, there is no host HTML page, so where to define that JavaScript-level variable?
The answer is in those tricky JSNI methods again. Just do...
public class MyTest extends GWTTestCase {
public void testSomething() {
prepareBundle();
...your tests here...
}
...your other tests here...
native void prepareBundle() {
/*-{
$wnd["bundle"] = {
"dateOfBirth": "Date of Birth",
"surname": "Surname"
};
}-*/;
public void testSomething() {
prepareBundle();
...your tests here...
}
...your other tests here...
native void prepareBundle() {
/*-{
$wnd["bundle"] = {
"dateOfBirth": "Date of Birth",
"surname": "Surname"
};
}-*/;
...and use the special $wnd variable to initialize a JavaScript variable bundle prior to running your tests.
Hope that helps somebody. This is going to be in the upcoming release of Metawidget.