Skip to content
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 @@ -173,7 +173,10 @@ private TableHeaderInfo GenerateTableHeaderInfoFromDataBaseInfo(PSObject so)
ci.alignment = colHeader.alignment;
if (colHeader.label != null)
{
ci.HeaderMatchesProperty = so.Properties[colHeader.label.text] is not null;
if (colHeader.label.text != string.Empty)
{
ci.HeaderMatchesProperty = so.Properties[colHeader.label.text] is not null;
}

ci.label = this.dataBaseInfo.db.displayResourceManagerCache.GetTextTokenString(colHeader.label);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,55 @@ A Name B
$numDecimals | Should -Be $expectedDecimals -Because $num
}
}

It 'Works for empty column header label' {
$ps1xml = @'
<Configuration>
<ViewDefinitions>
<View>
<Name>Test.Header.Empty</Name>
<ViewSelectedBy>
<TypeName>Test.Format</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label></Label>
<Width>4</Width>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Prop</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
'@

$ps1xmlPath = Join-Path -Path $TestDrive -ChildPath 'empty.format.ps1xml'
Set-Content -Path $ps1xmlPath -Value $ps1xml
$object = [pscustomobject]@{Prop = '123'}
# run in own runspace so not affect global sessionstate
$ps = [powershell]::Create()
$ps.AddScript( {
param($ps1xmlPath, $object)
Update-FormatData -AppendPath $ps1xmlPath
$object.PSObject.TypeNames.Insert(0, 'Test.Format')
$object | Format-Table | Out-String
} ).AddArgument($ps1xmlPath).AddArgument($object) | Out-Null
$output = $ps.Invoke()
$expected = @"
Prop----123
"@
$output.Replace("`n","").Replace("`r","") | Should -BeExactly $expected
}
}

Describe 'Table color tests' -Tag 'CI' {
Expand Down