use of com.vaadin.flow.component.internal.DependencyList in project flow by vaadin.
the class DependencyListTest method testAddingDuplicateDependencies.
private void testAddingDuplicateDependencies(LoadMode first, LoadMode second, LoadMode expected) {
String url = "foo/bar.js";
Type type = Type.JAVASCRIPT;
// need to clear so that there is no leftovers
deps = new DependencyList();
deps.add(new Dependency(type, url, first));
deps.add(new Dependency(type, url, second));
Collection<Dependency> pendingSendToClient = deps.getPendingSendToClient();
assertEquals("Expected to have only one dependency", 1, pendingSendToClient.size());
assertEquals("Wrong load mode resolved", pendingSendToClient.iterator().next().getLoadMode(), expected);
}
use of com.vaadin.flow.component.internal.DependencyList in project flow by vaadin.
the class ComponentTest method circularDependencies.
@Test
public void circularDependencies() {
UIInternals internals = new UI().getInternals();
DependencyList dependencyList = internals.getDependencyList();
internals.addComponentDependencies(CircularDependencies1.class);
Map<String, Dependency> pendingDependencies = getDependenciesMap(dependencyList.getPendingSendToClient());
Assert.assertEquals(2, pendingDependencies.size());
assertDependency(Dependency.Type.JAVASCRIPT, "dep1.js", pendingDependencies);
assertDependency(Dependency.Type.JAVASCRIPT, "dep2.js", pendingDependencies);
internals = new UI().getInternals();
dependencyList = internals.getDependencyList();
internals.addComponentDependencies(CircularDependencies2.class);
pendingDependencies = getDependenciesMap(dependencyList.getPendingSendToClient());
Assert.assertEquals(2, pendingDependencies.size());
assertDependency(Dependency.Type.JAVASCRIPT, "dep2.js", pendingDependencies);
assertDependency(Dependency.Type.JAVASCRIPT, "dep1.js", pendingDependencies);
}
Aggregations