Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/325 #326

Merged
merged 4 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,10 @@ class FormFieldsTagLib {
}

private List<String> resolvePropertyNames(PersistentEntity domainClass, Map attrs) {
if (attrs.containsKey('properties')) {
if (attrs.containsKey('order')) {
return getList(attrs.order)
}
else if (attrs.containsKey('properties')) {
sbglasius marked this conversation as resolved.
Show resolved Hide resolved
return getList(attrs.remove('properties'))
} else {

Expand Down
20 changes: 20 additions & 0 deletions src/test/groovy/grails/plugin/formfields/taglib/TableSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,26 @@ class TableSpec extends AbstractFormFieldsTagLibSpec implements TagLibUnitTest<F
renderedTableColumns.containsAll(expectedTableColumns)
}

@Issue('https://github.com/grails-fields-plugin/grails-fields/issues/325')
void "table tag renders transient columns when using the order attribute '<f:table collection=\"collection\" order=\"['transient']\"/>'"(String order, List expectedTableColumns) {
when:
def table = XML.parse(applyTemplate(
'<f:table collection="collection" order="${order}"/>',
[
collection: personList,
order: order
]
))
def renderedTableColumns = table.thead.tr.th.a.collect { it.text().trim() }

then:
renderedTableColumns == expectedTableColumns

where:
order | expectedTableColumns
'transientText, name' | ['Transient Text', 'Name']
'name, transientText' | ['Name', 'Transient Text']
}

void "table tag displays embedded properties by default with toString"() {
when:
Expand Down