Skip to content

Commit 1e58d9a

Browse files
javier-godoypaodb
authored andcommitted
test: split SelectionFeatureIT into multiple tests
1 parent 331b6a2 commit 1e58d9a

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

src/test/java/com/flowingcode/vaadin/addons/xterm/integration/SelectionFeatureIT.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* #%L
33
* XTerm Console Addon
44
* %%
5-
* Copyright (C) 2020 - 2023 Flowing Code
5+
* Copyright (C) 2020 - 2026 Flowing Code
66
* %%
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -29,12 +29,11 @@
2929
public class SelectionFeatureIT extends AbstractViewTest {
3030

3131
@Test
32-
public void testSelectionFeature() throws InterruptedException {
32+
public void testSelectionFeature1() throws InterruptedException {
3333
XTermElement term = $(XTermElement.class).first();
34-
Position pos;
3534

3635
term.write("abcd");
37-
pos = term.cursorPosition();
36+
Position pos = term.cursorPosition();
3837

3938
// select left, backspace
4039
term.sendKeys(Keys.SHIFT, Keys.ARROW_LEFT);
@@ -69,9 +68,14 @@ public void testSelectionFeature() throws InterruptedException {
6968
term.sendKeys(Keys.BACK_SPACE);
7069
assertThat(term.currentLine(), isEmptyString());
7170
assertThat(term.cursorPosition(), is(pos));
71+
}
72+
73+
@Test
74+
public void testSelectionFeature2() throws InterruptedException {
75+
XTermElement term = $(XTermElement.class).first();
7276

7377
term.write("abcd");
74-
pos = term.cursorPosition();
78+
Position pos = term.cursorPosition();
7579

7680
// select to home, delete
7781
term.sendKeys(Keys.SHIFT, Keys.HOME);
@@ -80,9 +84,16 @@ public void testSelectionFeature() throws InterruptedException {
8084
term.sendKeys(Keys.DELETE);
8185
assertThat(term.currentLine(), isEmptyString());
8286
assertThat(term.cursorPosition(), is(pos.advance(-4, 0)));
87+
}
88+
89+
@Test
90+
public void testSelectionFeature3() throws InterruptedException {
91+
XTermElement term = $(XTermElement.class).first();
8392

84-
// select to end, delete
8593
term.write("abcd");
94+
Position pos = term.cursorPosition();
95+
96+
// select to end, delete
8697
term.sendKeys(Keys.HOME);
8798
pos = term.cursorPosition();
8899
term.sendKeys(Keys.SHIFT, Keys.END);
@@ -91,7 +102,11 @@ public void testSelectionFeature() throws InterruptedException {
91102
term.sendKeys(Keys.DELETE);
92103
assertThat(term.currentLine(), isEmptyString());
93104
assertThat(term.cursorPosition(), is(pos));
105+
}
94106

107+
@Test
108+
public void testSelectionFeature4() throws InterruptedException {
109+
XTermElement term = $(XTermElement.class).first();
95110
String text = makeFullLine(term, true) + makeFullLine(term, false) + makeFullLine(term, false);
96111

97112
// select to home, delete (wrapping)
@@ -101,7 +116,12 @@ public void testSelectionFeature() throws InterruptedException {
101116
assertThat(term.getSelection(), is(text));
102117
term.sendKeys(Keys.DELETE);
103118
assertThat(term.currentLine(), isEmptyString());
119+
}
104120

121+
@Test
122+
public void testSelectionFeature5() throws InterruptedException {
123+
XTermElement term = $(XTermElement.class).first();
124+
String text = makeFullLine(term, true) + makeFullLine(term, false) + makeFullLine(term, false);
105125
// select to end, delete (wrapping)
106126
term.write(text);
107127
assertThat(term.currentLine(), is(text));
@@ -110,7 +130,6 @@ public void testSelectionFeature() throws InterruptedException {
110130
assertThat(term.getSelection(), is(text));
111131
term.sendKeys(Keys.DELETE);
112132
assertThat(term.currentLine(), isEmptyString());
113-
114133
}
115134

116135
}

0 commit comments

Comments
 (0)