use of com.vaadin.client.flow.util.NativeFunction in project flow by vaadin.
the class GwtPolymerModelTest method createHtmlElement.
private Element createHtmlElement() {
String name = "custom-div";
Element element = Browser.getDocument().createElement(name);
WidgetUtil.setJsProperty(element, "localName", name);
setupSetMethod(element);
setupMockSpliceMethod(element);
WidgetUtil.setJsProperty(element, "removeAttribute", new NativeFunction(""));
WidgetUtil.setJsProperty(element, "getAttribute", new NativeFunction("return false;"));
WidgetUtil.setJsProperty(element, "setAttribute", new NativeFunction(""));
return element;
}
use of com.vaadin.client.flow.util.NativeFunction in project flow by vaadin.
the class GwtPolymerApiImplTest method setPolymerVersion.
static void setPolymerVersion(String version) {
NativeFunction function = NativeFunction.create("return { 'version': '" + version + "' };");
setPolymer(WidgetUtil.crazyJsCast(function.call(null)));
}
use of com.vaadin.client.flow.util.NativeFunction in project flow by vaadin.
the class GwtBasicElementBinderTest method assertDeferredPolymerElement_originalReadyIsCalled.
private void assertDeferredPolymerElement_originalReadyIsCalled(Element element) {
initPolymer(element);
mockWhenDefined(element);
NativeFunction function = NativeFunction.create("this['foo']='bar';");
WidgetUtil.setJsProperty(element, "ready", function);
Binder.bind(node, element);
runWhenDefined(element);
NativeFunction readyCall = new NativeFunction("this.ready();");
readyCall.call(element);
assertEquals("bar", WidgetUtil.getJsProperty(element, "foo"));
}
use of com.vaadin.client.flow.util.NativeFunction in project flow by vaadin.
the class GwtBasicElementBinderTest method assertPolymerElement_originalReadyIsCalled.
private void assertPolymerElement_originalReadyIsCalled() {
initPolymer(element);
NativeFunction function = NativeFunction.create("this['foo']='bar';");
WidgetUtil.setJsProperty(element, "ready", function);
Binder.bind(node, element);
NativeFunction readyCall = new NativeFunction("this.ready();");
readyCall.call(element);
assertEquals("bar", WidgetUtil.getJsProperty(element, "foo"));
}
Aggregations