Skip to content

Commit 317b208

Browse files
committed
spotless
1 parent 5b4a115 commit 317b208

File tree

4 files changed

+40
-36
lines changed

4 files changed

+40
-36
lines changed

flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DnDAbsolutePositioningView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import com.vaadin.flow.uitest.servlet.ViewTestLayout;
2525

2626
@Route(value = "com.vaadin.flow.uitest.ui.DnDAbsolutePositioningView", layout = ViewTestLayout.class)
27-
public class DnDAbsolutePositioningView extends Div implements DropTarget<DnDAbsolutePositioningView> {
27+
public class DnDAbsolutePositioningView extends Div
28+
implements DropTarget<DnDAbsolutePositioningView> {
2829

2930
{
3031
// Configure styles for absolutely positioned canvas

flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DnDAttachToDropLocationView.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ public class DnDAttachToDropLocationView extends Div {
3434

3535
public DnDAttachToDropLocationView() {
3636
// Create a palette of draggable items
37-
Div palette = new Div() {{
38-
getStyle().setDisplay(Style.Display.FLEX);
39-
getStyle().setGap("10px");
40-
getStyle().setPadding("10px");
41-
add(new DraggableItem("Red", "red"));
42-
add(new DraggableItem("Green", "green"));
43-
add(new DraggableItem("Blue", "blue"));
44-
}};
37+
Div palette = new Div() {
38+
{
39+
getStyle().setDisplay(Style.Display.FLEX);
40+
getStyle().setGap("10px");
41+
getStyle().setPadding("10px");
42+
add(new DraggableItem("Red", "red"));
43+
add(new DraggableItem("Green", "green"));
44+
add(new DraggableItem("Blue", "blue"));
45+
}
46+
};
4547

4648
// Add instruction text
4749
Div instructions = new Div(
@@ -102,8 +104,8 @@ public Canvas() {
102104
- event.getDragStartOffsetY().orElse(0);
103105

104106
String color = (String) event.getDragData().orElse("gray");
105-
ColoredItem dropped = new ColoredItem(
106-
"Item " + (++itemCounter), color);
107+
ColoredItem dropped = new ColoredItem("Item " + (++itemCounter),
108+
color);
107109
dropped.getStyle().setPosition(Style.Position.ABSOLUTE);
108110
dropped.getStyle().setLeft(x + "px");
109111
dropped.getStyle().setTop(y + "px");

flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/DnDAbsolutePositioningIT.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package com.vaadin.flow.uitest.ui;
1717

18-
import java.util.List;
19-
2018
import org.junit.Assert;
2119
import org.junit.Test;
2220
import org.openqa.selenium.By;
@@ -26,8 +24,8 @@
2624
import com.vaadin.flow.testutil.ChromeBrowserTest;
2725

2826
/**
29-
* Integration test for {@link DnDAbsolutePositioningView} verifying that dragging
30-
* the brick element moves it using clientX/clientY coordinates.
27+
* Integration test for {@link DnDAbsolutePositioningView} verifying that
28+
* dragging the brick element moves it using clientX/clientY coordinates.
3129
*/
3230
public class DnDAbsolutePositioningIT extends ChromeBrowserTest {
3331

@@ -74,12 +72,11 @@ public void dragBrick_logShowsMovement() {
7472
WebElement logEntry = waitForLogEntry();
7573
String logText = logEntry.getText();
7674

77-
Assert.assertTrue("Log should show pixel movement (got: " + logText + ")",
75+
Assert.assertTrue(
76+
"Log should show pixel movement (got: " + logText + ")",
7877
logText.contains("Pixels moved"));
79-
Assert.assertTrue("Log should contain x value",
80-
logText.contains("x:"));
81-
Assert.assertTrue("Log should contain y value",
82-
logText.contains("y:"));
78+
Assert.assertTrue("Log should contain x value", logText.contains("x:"));
79+
Assert.assertTrue("Log should contain y value", logText.contains("y:"));
8380
}
8481

8582
@Test
@@ -106,8 +103,8 @@ public void dragBrick_multipleDrags_positionAccumulates() {
106103

107104
// Position should have increased further
108105
Assert.assertTrue(
109-
"Left should increase after second drag (first: " + leftAfterFirst
110-
+ ", second: " + leftAfterSecond + ")",
106+
"Left should increase after second drag (first: "
107+
+ leftAfterFirst + ", second: " + leftAfterSecond + ")",
111108
leftAfterSecond > leftAfterFirst);
112109
Assert.assertTrue(
113110
"Top should increase after second drag (first: " + topAfterFirst
@@ -121,8 +118,7 @@ private WebElement findBrick() {
121118

122119
private WebElement findCanvas() {
123120
// Canvas has lightyellow background
124-
return findElement(
125-
By.xpath("//div[contains(@style, 'lightyellow')]"));
121+
return findElement(By.xpath("//div[contains(@style, 'lightyellow')]"));
126122
}
127123

128124
private WebElement waitForLogEntry() {
@@ -131,8 +127,8 @@ private WebElement waitForLogEntry() {
131127
}
132128

133129
private void waitForLogEntryCount(int count) {
134-
waitUntil(
135-
driver -> driver.findElements(By.tagName("pre")).size() >= count);
130+
waitUntil(driver -> driver.findElements(By.tagName("pre"))
131+
.size() >= count);
136132
}
137133

138134
private int parsePixelValue(String value) {

flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/DnDAttachToDropLocationIT.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import org.junit.Assert;
2121
import org.junit.Test;
2222
import org.openqa.selenium.By;
23+
import org.openqa.selenium.Point;
2324
import org.openqa.selenium.WebElement;
2425
import org.openqa.selenium.interactions.Actions;
2526

2627
import com.vaadin.flow.testutil.ChromeBrowserTest;
27-
import org.openqa.selenium.Point;
2828

2929
/**
3030
* Integration test for {@link DnDAttachToDropLocationView} verifying that drop
@@ -72,7 +72,8 @@ public void dragAndDrop_multipleItems_eachGetsUniqueNumber() {
7272
.perform();
7373
waitUntilDroppedItemsCount(2);
7474

75-
actions.clickAndHold(blueItem).moveToElement(canvas).release().perform();
75+
actions.clickAndHold(blueItem).moveToElement(canvas).release()
76+
.perform();
7677
waitUntilDroppedItemsCount(3);
7778

7879
// Verify three items were created
@@ -87,19 +88,20 @@ public void dragAndDrop_itemPositionedWithinCanvas() {
8788

8889
final int startOffsetX = 1;
8990
final int startOffsetY = 2;
90-
91+
9192
final int offsetX = 40;
9293
final int offsetY = 30;
9394
WebElement redItem = findDraggableByText("Red");
9495
WebElement canvas = findCanvas();
95-
96+
9697
Point redItemTopLeft = redItem.getLocation();
9798
Point canvasTopLeft = canvas.getLocation();
9899

99100
Actions actions = new Actions(getDriver());
100-
actions.moveToLocation(redItemTopLeft.getX() + startOffsetX, redItemTopLeft.getY() + startOffsetY)
101-
.clickAndHold()
102-
.moveToLocation(canvasTopLeft.getX() + offsetX, canvasTopLeft.getY() + offsetY)
101+
actions.moveToLocation(redItemTopLeft.getX() + startOffsetX,
102+
redItemTopLeft.getY() + startOffsetY).clickAndHold()
103+
.moveToLocation(canvasTopLeft.getX() + offsetX,
104+
canvasTopLeft.getY() + offsetY)
103105
.release().perform();
104106

105107
waitUntilDroppedItemsCount(1);
@@ -116,8 +118,10 @@ public void dragAndDrop_itemPositionedWithinCanvas() {
116118
position);
117119
Assert.assertNotNull("Left should be set", left);
118120
Assert.assertNotNull("Top should be set", top);
119-
Assert.assertEquals("Left should match offsetx", (offsetX - startOffsetX) + "px", left);
120-
Assert.assertEquals("Top should match offsety", (offsetY - startOffsetY) + "px", top);
121+
Assert.assertEquals("Left should match offsetx",
122+
(offsetX - startOffsetX) + "px", left);
123+
Assert.assertEquals("Top should match offsety",
124+
(offsetY - startOffsetY) + "px", top);
121125
}
122126

123127
@Test
@@ -139,7 +143,8 @@ public void dragAndDrop_droppedItemHasCorrectColor() {
139143
Assert.assertTrue(
140144
"Dropped item should have red background (got: "
141145
+ backgroundColor + ")",
142-
backgroundColor.contains("255") && backgroundColor.contains("0"));
146+
backgroundColor.contains("255")
147+
&& backgroundColor.contains("0"));
143148
}
144149

145150
private WebElement findDraggableByText(String text) {

0 commit comments

Comments
 (0)