Search in sources :

Example 86 with StateNode

use of com.vaadin.flow.internal.StateNode in project flow by vaadin.

the class StateNodeNodeListTest method testIndexOf.

@Test
public void testIndexOf() {
    StateNode one = StateNodeTest.createEmptyNode("one");
    StateNode two = StateNodeTest.createEmptyNode("two");
    StateNode three = StateNodeTest.createEmptyNode("three");
    nodeList.add(one);
    nodeList.add(two);
    Assert.assertEquals(0, nodeList.indexOf(one));
    Assert.assertEquals(1, nodeList.indexOf(two));
    Assert.assertEquals(-1, nodeList.indexOf(three));
}
Also used : StateNode(com.vaadin.flow.internal.StateNode) Test(org.junit.Test) StateNodeTest(com.vaadin.flow.internal.StateNodeTest)

Example 87 with StateNode

use of com.vaadin.flow.internal.StateNode in project flow by vaadin.

the class VisibilityDataTest method setVisible.

@Test
public void setVisible() {
    StateNode node = new StateNode(ElementData.class);
    ElementData data = node.getFeature(ElementData.class);
    Assert.assertNull(data.get(NodeProperties.VISIBLE));
    Assert.assertTrue(data.isVisible());
    data.put(NodeProperties.VISIBLE, true);
    Assert.assertTrue(data.isVisible());
    data.put(NodeProperties.VISIBLE, false);
    Assert.assertFalse(data.isVisible());
}
Also used : StateNode(com.vaadin.flow.internal.StateNode) Test(org.junit.Test)

Example 88 with StateNode

use of com.vaadin.flow.internal.StateNode in project flow by vaadin.

the class BasicElementStateProviderTest method doesNotSupportEmptyNode.

@Test
public void doesNotSupportEmptyNode() {
    BasicElementStateProvider provider = BasicElementStateProvider.get();
    Assert.assertFalse(provider.supports(new StateNode()));
}
Also used : StateNode(com.vaadin.flow.internal.StateNode) BasicElementStateProvider(com.vaadin.flow.dom.impl.BasicElementStateProvider) Test(org.junit.Test)

Example 89 with StateNode

use of com.vaadin.flow.internal.StateNode in project flow by vaadin.

the class BasicElementStateProviderTest method supportsSelfCreatedNode.

@Test
public void supportsSelfCreatedNode() {
    BasicElementStateProvider provider = BasicElementStateProvider.get();
    StateNode node = BasicElementStateProvider.createStateNode("foo");
    Assert.assertTrue(provider.supports(node));
}
Also used : StateNode(com.vaadin.flow.internal.StateNode) BasicElementStateProvider(com.vaadin.flow.dom.impl.BasicElementStateProvider) Test(org.junit.Test)

Example 90 with StateNode

use of com.vaadin.flow.internal.StateNode in project flow by vaadin.

the class BasicElementStateProviderTest method supportsUIRootNode.

@Test
public void supportsUIRootNode() {
    BasicElementStateProvider provider = BasicElementStateProvider.get();
    UI ui = new UI() {

        @Override
        protected void init(VaadinRequest request) {
        }
    };
    StateNode rootNode = ui.getInternals().getStateTree().getRootNode();
    Assert.assertTrue(provider.supports(rootNode));
}
Also used : UI(com.vaadin.flow.component.UI) StateNode(com.vaadin.flow.internal.StateNode) VaadinRequest(com.vaadin.flow.server.VaadinRequest) BasicElementStateProvider(com.vaadin.flow.dom.impl.BasicElementStateProvider) Test(org.junit.Test)

Aggregations

StateNode (com.vaadin.flow.internal.StateNode)196 Test (org.junit.Test)122 Element (com.vaadin.flow.dom.Element)32 JsonObject (elemental.json.JsonObject)24 ElementPropertyMap (com.vaadin.flow.internal.nodefeature.ElementPropertyMap)22 UI (com.vaadin.flow.component.UI)19 StateTree (com.vaadin.flow.internal.StateTree)18 TemplateNode (com.vaadin.flow.template.angular.TemplateNode)18 ArrayList (java.util.ArrayList)18 StateNodeTest (com.vaadin.flow.internal.StateNodeTest)17 Serializable (java.io.Serializable)17 ModelMap (com.vaadin.flow.internal.nodefeature.ModelMap)16 ModelList (com.vaadin.flow.internal.nodefeature.ModelList)10 TemplateElementStateProviderTest (com.vaadin.flow.dom.TemplateElementStateProviderTest)9 ElementData (com.vaadin.flow.internal.nodefeature.ElementData)9 VirtualChildrenList (com.vaadin.flow.internal.nodefeature.VirtualChildrenList)9 ElementTemplateNode (com.vaadin.flow.template.angular.ElementTemplateNode)9 Bean (com.vaadin.flow.templatemodel.Bean)9 HashMap (java.util.HashMap)9 Collectors (java.util.stream.Collectors)9