-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer #8426
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
Allow 'name' as an alias key for 'label' in ConvertTo-Html, allow the 'width' entry to be an integer #8426
Changes from all commits
f0e5ada
12c24f3
70a830c
a9b5a9a
8e5cb3a
144bd99
db864f1
3e1b38a
b993fad
529fb98
d3a6975
70614e2
10c064c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,15 +169,29 @@ After the object | |
| $returnString | Should -Be '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' | ||
| } | ||
|
|
||
| It "Test ConvertTo-HTML supports scriptblock-based calculated properties: by hashtable"{ | ||
| $returnString = ($customObject | ConvertTo-HTML @{ l='NewAge'; e={ $_.Age + 1 } }) -join $newLine | ||
| It "Test ConvertTo-HTML supports scriptblock-based calculated properties: by hashtable" { | ||
| $returnString = ($customObject | ConvertTo-HTML @{ l = 'NewAge'; e = { $_.Age + 1 } }) -join $newLine | ||
| $returnString | Should -Match '\b43\b' | ||
| } | ||
|
|
||
| It "Test ConvertTo-HTML supports scriptblock-based calculated properties: directly"{ | ||
| It "Test ConvertTo-HTML supports scriptblock-based calculated properties: directly" { | ||
| $returnString = ($customObject | ConvertTo-HTML { $_.Age + 1 }) -join $newLine | ||
| $returnString | Should -Match '\b43\b' | ||
| } | ||
|
|
||
| } | ||
| It "Test ConvertTo-HTML calculated property supports 'name' key as alias of 'label'" { | ||
| $returnString = ($customObject | ConvertTo-Html @{ name = 'AgeRenamed'; e = 'Age'}) -join $newLine | ||
| $returnString | Should -Match 'AgeRenamed' | ||
| } | ||
|
|
||
| It "Test ConvertTo-HTML calculated property supports integer 'width' entry" { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only integer?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iSazonov: Good question: Since we're talking about UIs and column widths, my guess is that |
||
| $returnString = ($customObject | ConvertTo-Html @{ e = 'Age'; width = 10 }) -join $newLine | ||
| $returnString | Should -Match '\swidth\s*=\s*(["''])10\1' | ||
| } | ||
|
|
||
| It "Test ConvertTo-HTML calculated property supports string 'width' entry" { | ||
| $returnString = ($customObject | ConvertTo-Html @{ e = 'Age'; width = '10' }) -join $newLine | ||
| $returnString | Should -Match '\swidth\s*=\s*(["''])10\1' | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not: