@DisposeProjectAfter
public void test_ClientBundle_changeCssFileExternally() throws Exception {
prepare_ClientBundle_reloadCreate();
// parse
dontUseSharedGWTState();
WidgetInfo panel =
parse(
"// filler filler filler filler filler",
"// filler filler filler filler filler",
"<ui:UiBinder>",
" <ui:with field='resources' type='test.client.MyResources'/>",
" <g:FlowPanel styleName='{resources.style.one}'/>",
"</ui:UiBinder>");
refresh();
//
Property styleProperty = panel.getPropertyByTitle("styleName");
Property colorProperty = PropertyUtils.getByPath(styleProperty, "color");
// initial state
assertEquals("red", getPropertyText(colorProperty));
assertEquals("red", getComputedStyleAttribute(panel, "color"));
// first change
{
// update CSS file
setFileContentSrc(
"test/client/MyResources.css",
getSource(
"/* filler filler filler filler filler */",
"/* filler filler filler filler filler */",
"/* filler filler filler filler filler */",
".one {",
" color: lime;",
"}",
".two {}"));
// refresh requested
{
EditorActivatedRequest request = new EditorActivatedRequest();
panel.getBroadcast(EditorActivatedListener.class).invoke(request);
assertFalse(request.isReparseRequested());
assertTrue(request.isRefreshRequested());
panel.refresh();
}
// has new value
assertEquals("lime", getPropertyText(colorProperty));
assertEquals("lime", getComputedStyleAttribute(panel, "color"));
}