You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure how to write a test for this, as I don't know the best way to test for colors in the console component, but here's an example that shows the behavior that I'm talking about:
'Header with comment style' => array(
array(
newTableCell('<comment>Long Title</comment>', array('colspan' => 3)),
),
array(
array(
newTableCell('9971-5-0210-0', array('colspan' => 3)),
),
newTableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+| Long Title |+------------------+---------+------------------+| 9971-5-0210-0 |+------------------+---------+------------------+| Dante Alighieri | J. R. R. Tolkien | J. R. R |+------------------+---------+------------------+
TABLE
),
(in order to make this fail in the symfony test suite I have to enable the $decorator parameter in the method getOutputStream())
Here's how that table renders:
If I don't use <comment> as the style, and use the <fg> type of style, it works as expected:
),
'Header with comment style' => array(
array(
newTableCell('<fg=yellow>Long Title</>', array('colspan' => 3)),
),
array(
array(
newTableCell('9971-5-0210-0', array('colspan' => 3)),
),
newTableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+| Long Title |+------------------+---------+------------------+| 9971-5-0210-0 |+------------------+---------+------------------+| Dante Alighieri | J. R. R. Tolkien | J. R. R |+------------------+---------+------------------+
TABLE
),
Output:
The <error> style also fails:
So does the <question> style:
But the <info> style is fine (I assume this is the default for the header rows):
This doesn't happen if there is no colspan:
'Header with comment style' => array(
array(
newTableCell('<comment>Long Title</comment>'),
'Test',
'Test'
),
array(
array(
newTableCell('9971-5-0210-0', array('colspan' => 3)),
),
newTableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+------------------+| Long Title | Test | Test |+------------------+---------+------------------+| 9971-5-0210-0 |+------------------+---------+------------------+| Dante Alighieri | J. R. R. Tolkien | J. R. R |+------------------+---------+------------------+
TABLE
),
Output:
Position of the Cell with the style doesn't seem to matter, so I think it's just setting a colspan that causes it to color the whole table:
'Header with comment style' => array(
array(
'Test',
'Test',
newTableCell('<comment>Long Title</comment>'),
),
array(
array(
newTableCell('9971-5-0210-0', array('colspan' => 3)),
),
newTableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R'
),
),
'default',
<<<'TABLE'
+------------------+---------+---------------------+| Test | Test | Long Title |+------------------+---------+---------------------+| 9971-5-0210-0 |+------------------+---------+---------------------+| Dante Alighieri | J. R. R. Tolkien | J. R. R |+------------------+---------+---------------------+
TABLE
),
Output:
The text was updated successfully, but these errors were encountered:
jaydiablo
changed the title
[Console] Using TableCell with rowspan and certain styles doesn't render properly
[Console] Using TableCell with colspan and certain styles doesn't render properly
Jan 27, 2017
Thanks for all the inputs you've provided to help reproducing and debugging this issue. I was able to reproduce the issue, and noticed it worked for
newTableCell('<comment>Long Title</>')
while it doesn't for
newTableCell('<comment>Long Title</comment>')
Nothing is wrong with the short or long closing tag, but the main difference is the length.
It appears using a TableCell didn't properly inspect the content length, as it may contain some styles. Then Helper::strlenWithoutDecoration should be used.
I'm not sure how to write a test for this, as I don't know the best way to test for colors in the console component, but here's an example that shows the behavior that I'm talking about:
(in order to make this fail in the symfony test suite I have to enable the
$decorator
parameter in the methodgetOutputStream()
)Here's how that table renders:
If I don't use
<comment>
as the style, and use the<fg>
type of style, it works as expected:Output:
The
<error>
style also fails:So does the
<question>
style:But the
<info>
style is fine (I assume this is the default for the header rows):This doesn't happen if there is no colspan:
Output:
Position of the Cell with the style doesn't seem to matter, so I think it's just setting a colspan that causes it to color the whole table:
Output:
The text was updated successfully, but these errors were encountered: