Skip to content

Commit 4eb3518

Browse files
authored
Issue 52979: App grid customize view doesn't expand lookup field with special char (#2434)
- Test customize view modal select field to take field name and handle EscapeUtil.fieldKeyEncodePart() in FieldSelectionDialog
1 parent e8cb42e commit 4eb3518

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/org/labkey/test/components/ui/grids/FieldSelectionDialog.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.labkey.test.components.UpdatingComponent;
88
import org.labkey.test.components.bootstrap.ModalDialog;
99
import org.labkey.test.components.html.Checkbox;
10+
import org.labkey.test.util.EscapeUtil;
1011
import org.labkey.test.util.selenium.WebElementUtils;
1112
import org.openqa.selenium.Keys;
1213
import org.openqa.selenium.WebDriver;
@@ -97,29 +98,29 @@ public List<String> getAvailableFieldLabels()
9798
/**
9899
* Check to see if the available field listed is shown as selected, has a checkmark, in the 'Available Fields' panel.
99100
*
100-
* @param fieldKeyParts Can be an individual field or a path to a nested field.
101+
* @param fieldNameParts Can be an individual field or a path to a nested field.
101102
* @return True if row has the checkmark, false otherwise.
102103
*/
103-
public boolean isAvailableFieldSelected(String... fieldKeyParts)
104+
public boolean isAvailableFieldSelected(String... fieldNameParts)
104105
{
105-
WebElement listItem = elementCache().getListItemElementByFieldKey(expandAvailableFields(fieldKeyParts));
106+
WebElement listItem = elementCache().getListItemElementByFieldKey(expandAvailableFields(fieldNameParts));
106107
return Locator.tagWithClass("i", "fa-check").findWhenNeeded(listItem).isDisplayed();
107108
}
108109

109-
public boolean isFieldAvailable(String... fieldKeyParts)
110+
public boolean isFieldAvailable(String... fieldNameParts)
110111
{
111-
return elementCache().getListItemElementByFieldKeyOrNull(expandAvailableFields(fieldKeyParts)) != null;
112+
return elementCache().getListItemElementByFieldKeyOrNull(expandAvailableFields(fieldNameParts)) != null;
112113
}
113114

114115
/**
115116
* Select a field the list of available fields. If more than one value is passed in it is assumed to be an expandable path.
116117
*
117-
* @param fieldKeyParts Either an individual field or the path to a field to add.
118+
* @param fieldNameParts Either an individual field or the path to a field to add.
118119
* @return This dialog.
119120
*/
120-
public FieldSelectionDialog selectAvailableField(String... fieldKeyParts)
121+
public FieldSelectionDialog selectAvailableField(String... fieldNameParts)
121122
{
122-
return addFieldByFieldKeyToGrid(expandAvailableFields(fieldKeyParts));
123+
return addFieldByFieldKeyToGrid(expandAvailableFields(fieldNameParts));
123124
}
124125

125126
public WebElement getAvailableFieldElement(String fieldName)
@@ -154,18 +155,18 @@ private FieldSelectionDialog addFieldByFieldKeyToGrid(String fieldKey)
154155
* Expand a field or a hierarchy of fieldKeyParts. If a single field is passed in only it will be expanded. If multiple values
155156
* are passed in it is assumed to be a path and all fieldKeyParts will be expanded to the last field.
156157
*
157-
* @param fieldKeyParts The list of fieldKeyParts to expand.
158+
* @param fieldNameParts The list of fieldKeyParts to expand.
158159
* @return key for the expanded field.
159160
*/
160-
private String expandAvailableFields(String... fieldKeyParts)
161+
private String expandAvailableFields(String... fieldNameParts)
161162
{
162163
StringBuilder fieldKey = new StringBuilder();
163164

164-
Iterator<String> iterator = Arrays.stream(fieldKeyParts).iterator();
165+
Iterator<String> iterator = Arrays.stream(fieldNameParts).iterator();
165166

166167
while(iterator.hasNext())
167168
{
168-
fieldKey.append(iterator.next().trim());
169+
fieldKey.append(EscapeUtil.fieldKeyEncodePart(iterator.next().trim()));
169170

170171
// If this isn't the last item in the collection keep expanding and building the expected data-fieldkey value.
171172
if(iterator.hasNext())

0 commit comments

Comments
 (0)