Search in sources :

Example 16 with NativeFunction

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;
}
Also used : Element(elemental.dom.Element) NativeFunction(com.vaadin.client.flow.util.NativeFunction)

Example 17 with NativeFunction

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)));
}
Also used : NativeFunction(com.vaadin.client.flow.util.NativeFunction)

Example 18 with NativeFunction

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"));
}
Also used : NativeFunction(com.vaadin.client.flow.util.NativeFunction)

Example 19 with NativeFunction

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"));
}
Also used : NativeFunction(com.vaadin.client.flow.util.NativeFunction)

Aggregations

NativeFunction (com.vaadin.client.flow.util.NativeFunction)19 JsonObject (elemental.json.JsonObject)6 StateNode (com.vaadin.client.flow.StateNode)3 JsonArray (elemental.json.JsonArray)3 NodeMap (com.vaadin.client.flow.nodefeature.NodeMap)2 Element (elemental.dom.Element)2 ServerEventObject (com.vaadin.client.flow.binding.ServerEventObject)1 DomNode (com.vaadin.client.flow.dom.DomNode)1 BeanModelType (com.vaadin.client.flow.model.BeanModelType)1 Node (elemental.dom.Node)1