Browse Source

Fix formatting, improve documentation on autoformat (#11033)

tags/8.6.0.alpha1
Ilia Motornyi 5 years ago
parent
commit
7f06076dc4

+ 4
- 0
CONTRIBUTING.md View File



# Submitting the patches # Submitting the patches


## Source code auto-formatting

Before submitting changes to Github, run the command `mvn process-sources` from project's root. This maven goal automatically formats source code according to Vaadin standards. The same goal is run automatically if you invoke `mvn install` or `mvn compile`.

## Creating a pull request in GitHub ## Creating a pull request in GitHub


All our projects accept contributions as GitHub pull requests. The first time you create a pull request, you will be asked to electronically sign a contribution agreement. All our projects accept contributions as GitHub pull requests. The first time you create a pull request, you will be asked to electronically sign a contribution agreement.

+ 2
- 1
client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java View File

checkBox.setText("Selects row number " + getDOMRowIndex(cell) + "."); checkBox.setText("Selects row number " + getDOMRowIndex(cell) + ".");
boolean editorOpen = grid.isEditorActive(); boolean editorOpen = grid.isEditorActive();
boolean editorBuffered = grid.isEditorBuffered(); boolean editorBuffered = grid.isEditorBuffered();
checkBox.setEnabled(grid.isEnabled() && !(editorOpen && editorBuffered));
checkBox.setEnabled(
grid.isEnabled() && !(editorOpen && editorBuffered));
} }


private int getDOMRowIndex(RendererCellReference cell) { private int getDOMRowIndex(RendererCellReference cell) {

+ 14
- 8
uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxCaretNavigationTest.java View File

comboBox.sendKeys(Keys.HOME); comboBox.sendKeys(Keys.HOME);
assertCaretPosition("Home key didn't work well.", 0, comboBox); assertCaretPosition("Home key didn't work well.", 0, comboBox);
comboBox.sendKeys(Keys.END); comboBox.sendKeys(Keys.END);
assertCaretPosition("End key didn't work well.", text.length(), comboBox);
assertCaretPosition("End key didn't work well.", text.length(),
comboBox);
} }


@Test @Test
String text = comboBox.getPopupSuggestions().get(1); String text = comboBox.getPopupSuggestions().get(1);
comboBox.selectByText(text); comboBox.selectByText(text);
comboBox.sendKeys(Keys.ARROW_LEFT); comboBox.sendKeys(Keys.ARROW_LEFT);
assertCaretPosition("Left Arrow key didn't work well.", text.length() - 1, comboBox);
assertCaretPosition("Left Arrow key didn't work well.",
text.length() - 1, comboBox);
comboBox.sendKeys(Keys.ARROW_RIGHT); comboBox.sendKeys(Keys.ARROW_RIGHT);
assertCaretPosition("Right Arrow key didn't work well.", text.length(), comboBox);
assertCaretPosition("Right Arrow key didn't work well.", text.length(),
comboBox);
} }


@Test @Test
String text = comboBox.getPopupSuggestions().get(1); String text = comboBox.getPopupSuggestions().get(1);
comboBox.selectByText(text); comboBox.selectByText(text);
comboBox.sendKeys(Keys.ARROW_LEFT); comboBox.sendKeys(Keys.ARROW_LEFT);
assertCaretPosition("Left Arrow key didn't work well.", text.length() - 1, comboBox);
assertCaretPosition("Left Arrow key didn't work well.",
text.length() - 1, comboBox);
comboBox.sendKeys(Keys.END); comboBox.sendKeys(Keys.END);
assertCaretPosition("End key didn't work well.", text.length(), comboBox);
assertCaretPosition("End key didn't work well.", text.length(),
comboBox);
} }


private void assertCaretPosition(String message, int position, ComboBoxElement comboBox) {
assertArrayEquals(message, new int[]{position, position},
private void assertCaretPosition(String message, int position,
ComboBoxElement comboBox) {
assertArrayEquals(message, new int[] { position, position },
getSelection(comboBox.getInputField())); getSelection(comboBox.getInputField()));
} }


List<Long> range = (List<Long>) executeScript( List<Long> range = (List<Long>) executeScript(
"return [arguments[0].selectionStart,arguments[0].selectionEnd]", "return [arguments[0].selectionStart,arguments[0].selectionEnd]",
element); element);
return new int[]{range.get(0).intValue(), range.get(1).intValue()};
return new int[] { range.get(0).intValue(), range.get(1).intValue() };
} }


} }

Loading…
Cancel
Save