Search in sources :

Example 6 with Registry

use of com.vaadin.client.Registry in project flow by vaadin.

the class ExecuteJavaScriptProcessorTest method isBound_hasElementHasFeatureAndBoundAndUnboundParent_notBound.

@Test
public void isBound_hasElementHasFeatureAndBoundAndUnboundParent_notBound() {
    TestJsProcessor processor = new TestJsProcessor();
    Registry registry = processor.getRegistry();
    StateNode node = new StateNode(37, registry.getStateTree());
    node.getMap(NodeFeatures.VISIBILITY_DATA).getProperty(NodeProperties.VISIBILITY_BOUND_PROPERTY).setValue(true);
    StateNode parent = new StateNode(43, registry.getStateTree());
    node.setParent(parent);
    // emulate binding
    JsElement element = new JsElement() {
    };
    node.setDomNode(element);
    Assert.assertFalse(processor.isBound(node));
}
Also used : JsElement(elemental.js.dom.JsElement) Registry(com.vaadin.client.Registry) Test(org.junit.Test)

Example 7 with Registry

use of com.vaadin.client.Registry in project flow by vaadin.

the class ExecuteJavaScriptProcessorTest method execute_nodeParameterIsNotVirtualChild.

@Test
public void execute_nodeParameterIsNotVirtualChild() {
    CollectingExecuteJavaScriptProcessor processor = new CollectingExecuteJavaScriptProcessor();
    Registry registry = processor.getRegistry();
    StateNode node = new StateNode(12, registry.getStateTree());
    registry.getStateTree().registerNode(node);
    JsonArray json = JsonUtils.createArray(Json.create(JsonCodec.NODE_TYPE), Json.create(node.getId()));
    JsonArray invocation = Stream.of(json, Json.create("$0")).collect(JsonUtils.asArray());
    processor.execute(JsonUtils.createArray(invocation));
    // The invocation has been executed
    Assert.assertEquals(1, processor.nodeParametersList.size());
}
Also used : JsonArray(elemental.json.JsonArray) Registry(com.vaadin.client.Registry) Test(org.junit.Test)

Example 8 with Registry

use of com.vaadin.client.Registry in project flow by vaadin.

the class ExecuteJavaScriptProcessorTest method isBound_hasElementHasNoFeatureAndUnboundParent_notBound.

@Test
public void isBound_hasElementHasNoFeatureAndUnboundParent_notBound() {
    TestJsProcessor processor = new TestJsProcessor();
    Registry registry = processor.getRegistry();
    StateNode node = new StateNode(37, registry.getStateTree());
    StateNode parent = new StateNode(43, registry.getStateTree());
    node.setParent(parent);
    // emulate binding
    JsElement element = new JsElement() {
    };
    node.setDomNode(element);
    Assert.assertFalse(processor.isBound(node));
}
Also used : JsElement(elemental.js.dom.JsElement) Registry(com.vaadin.client.Registry) Test(org.junit.Test)

Example 9 with Registry

use of com.vaadin.client.Registry in project flow by vaadin.

the class ExecuteJavaScriptProcessorTest method isBound_hasElementHasFeatureAndNotBound_notBound.

@Test
public void isBound_hasElementHasFeatureAndNotBound_notBound() {
    TestJsProcessor processor = new TestJsProcessor();
    Registry registry = processor.getRegistry();
    StateNode node = new StateNode(37, registry.getStateTree());
    // emulate binding
    JsElement element = new JsElement() {
    };
    node.setDomNode(element);
    node.getMap(NodeFeatures.VISIBILITY_DATA).getProperty(NodeProperties.VISIBILITY_BOUND_PROPERTY).setValue(false);
    Assert.assertFalse(processor.isBound(node));
}
Also used : JsElement(elemental.js.dom.JsElement) Registry(com.vaadin.client.Registry) Test(org.junit.Test)

Example 10 with Registry

use of com.vaadin.client.Registry in project flow by vaadin.

the class ExecuteJavaScriptProcessorTest method isBound_hasElementHasNoFeature_bound.

@Test
public void isBound_hasElementHasNoFeature_bound() {
    TestJsProcessor processor = new TestJsProcessor();
    Registry registry = processor.getRegistry();
    StateNode node = new StateNode(37, registry.getStateTree());
    // emulate binding
    JsElement element = new JsElement() {
    };
    node.setDomNode(element);
    Assert.assertTrue(processor.isBound(node));
}
Also used : JsElement(elemental.js.dom.JsElement) Registry(com.vaadin.client.Registry) Test(org.junit.Test)

Aggregations

Registry (com.vaadin.client.Registry)18 Test (org.junit.Test)11 JsElement (elemental.js.dom.JsElement)9 ExistingElementMap (com.vaadin.client.ExistingElementMap)4 JsonArray (elemental.json.JsonArray)4 JsonObject (elemental.json.JsonObject)4 InitialPropertiesHandler (com.vaadin.client.InitialPropertiesHandler)2 UILifecycle (com.vaadin.client.UILifecycle)2 MessageHandler (com.vaadin.client.communication.MessageHandler)2 RequestResponseTracker (com.vaadin.client.communication.RequestResponseTracker)2 ServerConnector (com.vaadin.client.communication.ServerConnector)2 DependencyLoader (com.vaadin.client.DependencyLoader)1 ResourceLoader (com.vaadin.client.ResourceLoader)1 ScrollPositionHandler (com.vaadin.client.ScrollPositionHandler)1 ServerRpcQueue (com.vaadin.client.communication.ServerRpcQueue)1 ConstantPool (com.vaadin.client.flow.ConstantPool)1 StateNode (com.vaadin.client.flow.StateNode)1 StateTree (com.vaadin.client.flow.StateTree)1 JsArray (com.vaadin.client.flow.collection.JsArray)1 TemplateRegistry (com.vaadin.client.flow.template.TemplateRegistry)1